Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
d9e2b00679 | |||
677a82142f | |||
4a84587f71 | |||
f8dabec863 |
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.16.0
|
loader_version=0.16.0
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2
|
mod_version = 1.2.4
|
||||||
maven_group = com.kasetoatz
|
maven_group = com.kasetoatz
|
||||||
archives_base_name = TridentHacks
|
archives_base_name = TridentHacks
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ public class TridentHacks implements ClientModInitializer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
client = MinecraftClient.getInstance();
|
|
||||||
Config.load();
|
Config.load();
|
||||||
|
client = MinecraftClient.getInstance();
|
||||||
keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("Toggle Riptide", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_RIGHT_ALT, "RiptideHacks"));
|
keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("Toggle Riptide", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_RIGHT_ALT, "RiptideHacks"));
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
while (keyBinding.wasPressed()) {
|
while (keyBinding.wasPressed()) {
|
||||||
|
@ -4,6 +4,7 @@ import com.google.gson.GsonBuilder;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.kasetoatz.tridenthacks.TridentHacks;
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.util.crash.CrashException;
|
import net.minecraft.util.crash.CrashException;
|
||||||
import net.minecraft.util.crash.CrashReport;
|
import net.minecraft.util.crash.CrashReport;
|
||||||
|
|
||||||
@ -19,8 +20,10 @@ public class Config {
|
|||||||
public static String riptideOnMessage = "Riptide §aON";
|
public static String riptideOnMessage = "Riptide §aON";
|
||||||
public static String riptideOffMessage = "Riptide §cOFF";
|
public static String riptideOffMessage = "Riptide §cOFF";
|
||||||
|
|
||||||
|
private static final File file = new File(MinecraftClient.getInstance().runDirectory, "config/tridenthacks.json");
|
||||||
|
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
File file = new File(TridentHacks.client.runDirectory, "config/tridenthacks.json");
|
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
{
|
{
|
||||||
save();
|
save();
|
||||||
@ -28,7 +31,6 @@ public class Config {
|
|||||||
}
|
}
|
||||||
try (FileReader reader = new FileReader(file))
|
try (FileReader reader = new FileReader(file))
|
||||||
{
|
{
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
|
||||||
JsonObject json = gson.fromJson(reader, JsonObject.class);
|
JsonObject json = gson.fromJson(reader, JsonObject.class);
|
||||||
if (json.has("toggleRiptide"))
|
if (json.has("toggleRiptide"))
|
||||||
{
|
{
|
||||||
@ -50,6 +52,7 @@ public class Config {
|
|||||||
{
|
{
|
||||||
riptideOffMessage = json.get("riptideOffMessage").getAsString();
|
riptideOffMessage = json.get("riptideOffMessage").getAsString();
|
||||||
}
|
}
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
catch (IOException exc)
|
catch (IOException exc)
|
||||||
{
|
{
|
||||||
@ -65,9 +68,9 @@ public class Config {
|
|||||||
json.addProperty("returnToSameSlot", returnToSameSlot);
|
json.addProperty("returnToSameSlot", returnToSameSlot);
|
||||||
json.addProperty("riptideOnMessage", riptideOnMessage);
|
json.addProperty("riptideOnMessage", riptideOnMessage);
|
||||||
json.addProperty("riptideOffMessage", riptideOffMessage);
|
json.addProperty("riptideOffMessage", riptideOffMessage);
|
||||||
try (FileWriter writer = new FileWriter(new File(TridentHacks.client.runDirectory, "config/tridenthacks.json")))
|
try (FileWriter writer = new FileWriter(file))
|
||||||
{
|
{
|
||||||
new GsonBuilder().setPrettyPrinting().create().toJson(json, writer);
|
gson.toJson(json, writer);
|
||||||
}
|
}
|
||||||
catch (IOException exc)
|
catch (IOException exc)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ package com.kasetoatz.tridenthacks.mixin;
|
|||||||
import com.kasetoatz.tridenthacks.config.Config;
|
import com.kasetoatz.tridenthacks.config.Config;
|
||||||
import com.kasetoatz.tridenthacks.TridentHacks;
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||||
@ -22,7 +23,7 @@ public abstract class ClientConnectionMixin {
|
|||||||
ClientPlayerEntity player = TridentHacks.client.player;
|
ClientPlayerEntity player = TridentHacks.client.player;
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
if (packet instanceof PlayerActionC2SPacket && TridentHacks.noNormalRiptide() && ((PlayerActionC2SPacket)packet).getAction() == PlayerActionC2SPacket.Action.RELEASE_USE_ITEM)
|
if (player.getActiveItem().getItem() == Items.TRIDENT && player.isUsingItem() && packet instanceof PlayerActionC2SPacket && TridentHacks.noNormalRiptide() && ((PlayerActionC2SPacket)packet).getAction() == PlayerActionC2SPacket.Action.RELEASE_USE_ITEM)
|
||||||
{
|
{
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,16 @@ public class TridentItemMixin {
|
|||||||
if (Config.toggleRiptide)
|
if (Config.toggleRiptide)
|
||||||
{
|
{
|
||||||
PlayerEntity player = TridentHacks.client.player;
|
PlayerEntity player = TridentHacks.client.player;
|
||||||
if (TridentHacks.noNormalRiptide() && user == player && user.getItemUseTime() > 10)
|
if (user == player && user.getItemUseTime() > 10)
|
||||||
|
{
|
||||||
|
if (TridentHacks.noNormalRiptide())
|
||||||
{
|
{
|
||||||
world.playSoundFromEntity(player, SoundEvents.ITEM_TRIDENT_RIPTIDE_3.value(), SoundCategory.PLAYERS, 1.F, 1.F);
|
world.playSoundFromEntity(player, SoundEvents.ITEM_TRIDENT_RIPTIDE_3.value(), SoundCategory.PLAYERS, 1.F, 1.F);
|
||||||
}
|
|
||||||
TridentHacks.lastTridentUse = System.currentTimeMillis();
|
TridentHacks.lastTridentUse = System.currentTimeMillis();
|
||||||
|
}
|
||||||
TridentHacks.onGround = false;
|
TridentHacks.onGround = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (Config.returnToSameSlot && !TridentHacks.hasRiptide)
|
else if (Config.returnToSameSlot && !TridentHacks.hasRiptide)
|
||||||
{
|
{
|
||||||
PlayerEntity player = TridentHacks.client.player;
|
PlayerEntity player = TridentHacks.client.player;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "tridenthacks",
|
"id": "tridenthacks",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "RiptideHacks",
|
"name": "TridentHacks",
|
||||||
"description": "",
|
"description": "",
|
||||||
"authors": [],
|
"authors": [],
|
||||||
"contact": {
|
"contact": {
|
||||||
|
Reference in New Issue
Block a user