From 23bc33333e1b80d371b46f7c28bbc4396865f99e Mon Sep 17 00:00:00 2001 From: xia__mc <108219418+xia-mc@users.noreply.github.com> Date: Fri, 20 Dec 2024 21:36:46 +0800 Subject: [PATCH 1/2] Release 2.14.1 (#874) --- .../keystrokesmod/event/ClientBrandEvent.java | 13 +++ .../impl/network/MixinClientSpoofer.java | 17 --- .../impl/network/MixinFMLCommonHandler.java | 21 ++++ .../module/impl/exploit/ClientSpoofer.java | 101 +++++++++--------- .../module/impl/render/Watermark.java | 2 +- .../java/keystrokesmod/utility/Commands.java | 10 ++ src/main/resources/mixins.raven.json | 2 +- 7 files changed, 97 insertions(+), 69 deletions(-) create mode 100644 src/main/java/keystrokesmod/event/ClientBrandEvent.java delete mode 100644 src/main/java/keystrokesmod/mixins/impl/network/MixinClientSpoofer.java create mode 100644 src/main/java/keystrokesmod/mixins/impl/network/MixinFMLCommonHandler.java diff --git a/src/main/java/keystrokesmod/event/ClientBrandEvent.java b/src/main/java/keystrokesmod/event/ClientBrandEvent.java new file mode 100644 index 00000000..7dbb2d69 --- /dev/null +++ b/src/main/java/keystrokesmod/event/ClientBrandEvent.java @@ -0,0 +1,13 @@ +package keystrokesmod.event; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import net.minecraftforge.fml.common.eventhandler.Event; + +@EqualsAndHashCode(callSuper = true) +@Data +@AllArgsConstructor +public class ClientBrandEvent extends Event { + private String brand; +} diff --git a/src/main/java/keystrokesmod/mixins/impl/network/MixinClientSpoofer.java b/src/main/java/keystrokesmod/mixins/impl/network/MixinClientSpoofer.java deleted file mode 100644 index e2a2b57c..00000000 --- a/src/main/java/keystrokesmod/mixins/impl/network/MixinClientSpoofer.java +++ /dev/null @@ -1,17 +0,0 @@ -package keystrokesmod.mixins.impl.network; - -import keystrokesmod.module.impl.exploit.ClientSpoofer; -import net.minecraftforge.fml.common.FMLCommonHandler; -import org.jetbrains.annotations.NotNull; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(FMLCommonHandler.class) -public abstract class MixinClientSpoofer { - @Inject(method = "getModName", at = @At("RETURN"), cancellable = true, remap = false) - private void getModName(@NotNull CallbackInfoReturnable cir) { - cir.setReturnValue(ClientSpoofer.getBrandName().brand); - } -} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/mixins/impl/network/MixinFMLCommonHandler.java b/src/main/java/keystrokesmod/mixins/impl/network/MixinFMLCommonHandler.java new file mode 100644 index 00000000..96dc00b5 --- /dev/null +++ b/src/main/java/keystrokesmod/mixins/impl/network/MixinFMLCommonHandler.java @@ -0,0 +1,21 @@ +package keystrokesmod.mixins.impl.network; + +import keystrokesmod.event.ClientBrandEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.FMLCommonHandler; +import org.jetbrains.annotations.NotNull; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(FMLCommonHandler.class) +public abstract class MixinFMLCommonHandler { + + @Inject(method = "getModName", at = @At("RETURN"), remap = false, cancellable = true) + private void getModName(@NotNull CallbackInfoReturnable cir) { + ClientBrandEvent event = new ClientBrandEvent(cir.getReturnValue()); + MinecraftForge.EVENT_BUS.post(event); + cir.setReturnValue(event.getBrand()); + } +} diff --git a/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java b/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java index 47396114..5775ea08 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java @@ -1,75 +1,76 @@ package keystrokesmod.module.impl.exploit; +import keystrokesmod.event.ClientBrandEvent; import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.module.setting.impl.ModeSetting; +import keystrokesmod.module.setting.impl.LiteralSubMode; +import keystrokesmod.module.setting.impl.ModeValue; +import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; import org.jetbrains.annotations.NotNull; -import java.util.Arrays; - public class ClientSpoofer extends Module { - private static SpoofMode currentSpoof = SpoofMode.FORGE; - public final ButtonSetting cancelForgePacket = new ButtonSetting("Cancel Forge packet", false); - private final ModeSetting mode = new ModeSetting("Mode", SpoofMode.getNames(), 0); + public static String customBrand = null; + + private final ModeValue mode; + private final ButtonSetting noForge; + private final ButtonSetting cancelForgePacket; public ClientSpoofer() { super("ClientSpoofer", category.exploit); - this.registerSetting(mode, cancelForgePacket); - } - - public static BrandInfo getBrandName() { - return new BrandInfo(currentSpoof.brand); - } - - public void onDisable() { - currentSpoof = SpoofMode.FORGE; - } - - @Override - public void onUpdate() { - currentSpoof = SpoofMode.values()[(int) mode.getInput()]; + this.registerSetting(mode = new ModeValue("Mode", this) + .add(new LiteralSubMode("Vanilla", this)) + .add(new LiteralSubMode("Forge", this)) + .add(new LiteralSubMode("Lunar", this)) + .add(new LiteralSubMode("Cancel", this)) + .add(new LiteralSubMode("null", this)) + .add(new LiteralSubMode("Custom", this)) + ); + this.registerSetting(noForge = new ButtonSetting("No forge", false)); + this.registerSetting(cancelForgePacket = new ButtonSetting("Cancel FMLProxyPacket", false)); } @SubscribeEvent public void onSendPacket(@NotNull SendPacketEvent event) { - if (event.getPacket() instanceof FMLProxyPacket && cancelForgePacket.isToggled()) { + if (event.getPacket() instanceof FMLProxyPacket + && cancelForgePacket.isToggled()) { event.setCanceled(true); } - } - - - enum SpoofMode { - FORGE("Forge", "FML,Forge"), - VANILLA("Vanilla", "vanilla"), - LUNAR("Lunar", "lunarclient:v2.16.0-2426"), - CHEATBREAKER("Cheatbreaker", "CB"), - GEYSER("Geyser", "Geyser"), - LABYMOD("LabyMod", "LMC"), - ; - - private static final String[] MODES = Arrays.stream(values()).map(spoofMode -> spoofMode.name).toArray(String[]::new); - public final String name; - public final String brand; - - SpoofMode(String name, String brand) { - this.name = name; - this.brand = brand; - } - - public static String @NotNull [] getNames() { - return MODES; + if (event.getPacket() instanceof C17PacketCustomPayload + && mode.getSelected().getPrettyName().equals("Cancel")) { + event.setCanceled(true); } } - public static class BrandInfo { - public final String brand; - - public BrandInfo(String brand) { - this.brand = brand; + @SubscribeEvent + public void onClientBrand(@NotNull ClientBrandEvent event) { + String brand = event.getBrand(); + + switch (mode.getSelected().getPrettyName()) { + case "Vanilla": + brand = "vanilla"; + break; + case "Forge": + if (noForge.isToggled()) { + brand = "fml"; + } else { + brand = "fml,forge"; + } + break; + case "Lunar": + brand = "lunarclient:v2.18.3-2451"; + break; + case "null": + brand = null; + break; + case "Custom": + brand = customBrand; + break; } + + event.setBrand(brand); } -} \ No newline at end of file +} diff --git a/src/main/java/keystrokesmod/module/impl/render/Watermark.java b/src/main/java/keystrokesmod/module/impl/render/Watermark.java index 62ac046e..348b43e5 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Watermark.java +++ b/src/main/java/keystrokesmod/module/impl/render/Watermark.java @@ -28,7 +28,7 @@ import java.util.Objects; public class Watermark extends Module { - public static final String VERSION = "2.14"; + public static final String VERSION = "2.14.1"; public static final Map WATERMARK = new Object2ObjectOpenHashMap<>(); public static String customName = "CustomClient"; diff --git a/src/main/java/keystrokesmod/utility/Commands.java b/src/main/java/keystrokesmod/utility/Commands.java index 82bcea0d..b4c7eca1 100644 --- a/src/main/java/keystrokesmod/utility/Commands.java +++ b/src/main/java/keystrokesmod/utility/Commands.java @@ -8,6 +8,7 @@ import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.client.Settings; +import keystrokesmod.module.impl.exploit.ClientSpoofer; import keystrokesmod.module.impl.fun.NoteBot; import keystrokesmod.module.impl.minigames.DuelsStats; import keystrokesmod.module.impl.other.ChatAI; @@ -275,6 +276,14 @@ public static void rCMD(@NotNull String c) { KillMessage.killMessage = c.substring(12); print("&aSet killmessage to " + KillMessage.killMessage, 1); + } else if (firstArg.equals("clientspoofer")) { + if (!hasArgs) { + print(invSyn, 1); + return; + } + + ClientSpoofer.customBrand = c.substring(14); + print("&aSet clientspoofer custom brand to " + ClientSpoofer.customBrand, 1); } else if (firstArg.equals("binds")) { for (Module module : Raven.getModuleManager().getModules()) { if (module.getKeycode() != 0) { @@ -541,6 +550,7 @@ public static void rCMD(@NotNull String c) { print("1 cname [name]", 0); print("2 " + FakeChat.command + " [msg]", 0); print("4 killmessage [message]", 0); + print("4 clientspoofer [brand]", 0); print(String.format("5 clientname [name (current is '%s')]", Watermark.customName), 0); print("6 chat ", 0); } diff --git a/src/main/resources/mixins.raven.json b/src/main/resources/mixins.raven.json index d925274e..5f17c43d 100644 --- a/src/main/resources/mixins.raven.json +++ b/src/main/resources/mixins.raven.json @@ -56,7 +56,7 @@ "gui.MixinGuiMultiplayer", "gui.MixinGuiScreen", "gui.MixinGuiSlot", - "network.MixinClientSpoofer", + "network.MixinFMLCommonHandler", "network.MixinNetHandlerPlayClient", "render.ItemRendererAccessor", "render.MixinBlockRendererDispatcher", From c9ff6c91aa0971ee12bbca29392ab471d5e13b58 Mon Sep 17 00:00:00 2001 From: xItsSunny Date: Sun, 29 Dec 2024 11:15:38 +0100 Subject: [PATCH 2/2] Update ClientSpoofer.java --- .../keystrokesmod/module/impl/exploit/ClientSpoofer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java b/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java index 5775ea08..7a254736 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java @@ -25,9 +25,11 @@ public ClientSpoofer() { .add(new LiteralSubMode("Vanilla", this)) .add(new LiteralSubMode("Forge", this)) .add(new LiteralSubMode("Lunar", this)) + .add(new LiteralSubMode("Badlion", this)) .add(new LiteralSubMode("Cancel", this)) .add(new LiteralSubMode("null", this)) .add(new LiteralSubMode("Custom", this)) + ); this.registerSetting(noForge = new ButtonSetting("No forge", false)); this.registerSetting(cancelForgePacket = new ButtonSetting("Cancel FMLProxyPacket", false)); @@ -63,6 +65,9 @@ public void onClientBrand(@NotNull ClientBrandEvent event) { case "Lunar": brand = "lunarclient:v2.18.3-2451"; break; + case "Badlion": + brand = "badlion"; + break; case "null": brand = null; break;