6 Commits
V1.2 ... V1.3

Author SHA1 Message Date
8b87defba8 update to 1.21.1 2024-09-03 15:12:55 +02:00
f5e9479079 Fix server sync issues
Cancel the PlayerInteractItemC2SPacket instead of the PlayerActionC2SPacket so the trident charge state is properly synced to the server.
2024-08-02 16:08:20 +02:00
d9e2b00679 properly rename mod 2024-07-15 23:42:31 +02:00
677a82142f fix some bugs 2024-07-15 23:28:53 +02:00
4a84587f71 dumbass didnt test his mod 2024-07-15 23:11:12 +02:00
f8dabec863 better config handling 2024-07-15 23:05:31 +02:00
6 changed files with 24 additions and 20 deletions

View File

@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.16.0
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.3
# Mod Properties
mod_version = 1.2
mod_version = 1.3
maven_group = com.kasetoatz
archives_base_name = TridentHacks
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.100.6+1.21
fabric_version=0.103.0+1.21.1

View File

@ -7,13 +7,10 @@ import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import org.lwjgl.glfw.GLFW;
import java.util.HashMap;
public class TridentHacks implements ClientModInitializer {
public static MinecraftClient client;
public static boolean onGround = true;
@ -25,8 +22,8 @@ public class TridentHacks implements ClientModInitializer {
@Override
public void onInitializeClient() {
client = MinecraftClient.getInstance();
Config.load();
client = MinecraftClient.getInstance();
keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("Toggle Riptide", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_RIGHT_ALT, "RiptideHacks"));
ClientTickEvents.END_CLIENT_TICK.register(client -> {
while (keyBinding.wasPressed()) {

View File

@ -4,6 +4,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.Gson;
import com.kasetoatz.tridenthacks.TridentHacks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.crash.CrashException;
import net.minecraft.util.crash.CrashReport;
@ -19,8 +20,10 @@ public class Config {
public static String riptideOnMessage = "Riptide §aON";
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() {
File file = new File(TridentHacks.client.runDirectory, "config/tridenthacks.json");
if (!file.exists())
{
save();
@ -28,7 +31,6 @@ public class Config {
}
try (FileReader reader = new FileReader(file))
{
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonObject json = gson.fromJson(reader, JsonObject.class);
if (json.has("toggleRiptide"))
{
@ -50,6 +52,7 @@ public class Config {
{
riptideOffMessage = json.get("riptideOffMessage").getAsString();
}
save();
}
catch (IOException exc)
{
@ -65,9 +68,9 @@ public class Config {
json.addProperty("returnToSameSlot", returnToSameSlot);
json.addProperty("riptideOnMessage", riptideOnMessage);
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)
{

View File

@ -3,9 +3,10 @@ package com.kasetoatz.tridenthacks.mixin;
import com.kasetoatz.tridenthacks.config.Config;
import com.kasetoatz.tridenthacks.TridentHacks;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -22,7 +23,7 @@ public abstract class ClientConnectionMixin {
ClientPlayerEntity player = TridentHacks.client.player;
if (player != null)
{
if (packet instanceof PlayerActionC2SPacket && TridentHacks.noNormalRiptide() && ((PlayerActionC2SPacket)packet).getAction() == PlayerActionC2SPacket.Action.RELEASE_USE_ITEM)
if (packet instanceof PlayerInteractItemC2SPacket && player.getStackInHand(((PlayerInteractItemC2SPacket)packet).getHand()).getItem() == Items.TRIDENT && TridentHacks.noNormalRiptide())
{
ci.cancel();
}

View File

@ -25,13 +25,16 @@ public class TridentItemMixin {
if (Config.toggleRiptide)
{
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);
}
TridentHacks.lastTridentUse = System.currentTimeMillis();
}
TridentHacks.onGround = false;
}
}
else if (Config.returnToSameSlot && !TridentHacks.hasRiptide)
{
PlayerEntity player = TridentHacks.client.player;

View File

@ -2,7 +2,7 @@
"schemaVersion": 1,
"id": "tridenthacks",
"version": "${version}",
"name": "RiptideHacks",
"name": "TridentHacks",
"description": "",
"authors": [],
"contact": {