From a8bf3a67a67c6e9e931d8cf5d7491429f15df707 Mon Sep 17 00:00:00 2001 From: Tejas Lamba <73745640+TejasLamba2006@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:04:44 +0530 Subject: [PATCH 1/2] Fixed people not able to join Hypixel (#59) --- .gitignore | 2 +- .../module/impl/other/ClientSpoofer.java | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index e3ea3025..7802cb73 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ .vscode # BlueJ files *.ctxt -.bin +bin # Mobile Tools for Java (J2ME) .mtj.tmp/ diff --git a/src/main/java/keystrokesmod/module/impl/other/ClientSpoofer.java b/src/main/java/keystrokesmod/module/impl/other/ClientSpoofer.java index f5e66d52..220b643e 100644 --- a/src/main/java/keystrokesmod/module/impl/other/ClientSpoofer.java +++ b/src/main/java/keystrokesmod/module/impl/other/ClientSpoofer.java @@ -3,19 +3,15 @@ import io.netty.buffer.Unpooled; import keystrokesmod.Raven; import keystrokesmod.event.SendPacketEvent; -import keystrokesmod.mixins.impl.network.C17PacketCustomPayloadAccessor; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeSetting; import net.minecraft.network.PacketBuffer; -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.Contract; import org.jetbrains.annotations.NotNull; -import java.util.Objects; - public class ClientSpoofer extends Module { private final ModeSetting mode = new ModeSetting("Mode", SpoofMode.getNames(), 0); @@ -26,7 +22,9 @@ public ClientSpoofer() { super("ClientSpoofer", category.other); this.registerSetting(mode, cancelForgePacket); } - + public void onDisable() { + currentSpoof = SpoofMode.FORGE; + } @Override public void onUpdate() { currentSpoof = SpoofMode.values()[(int) mode.getInput()]; @@ -34,7 +32,6 @@ public void onUpdate() { cancelForgePacket.disable(); } else { Raven.getModuleManager().getModule("ModSpoofer").enable(); - cancelForgePacket.disable(); } } @@ -62,7 +59,7 @@ public BrandInfo(String brand, String channel) { } enum SpoofMode { - FORGE("Forge", "FML", "MC|Brand"), + FORGE("Forge", "FML,Forge", "MC|Brand"), VANILLA("Vanilla", "vanilla", "MC|Brand"), LUNAR("Lunar", "lunarclient:v2.16.0-2426", "MC|Brand"), CHEATBREAKER("Cheatbreaker", "CB", "MC|Brand"), @@ -83,10 +80,4 @@ enum SpoofMode { return java.util.Arrays.stream(values()).map(spoofMode -> spoofMode.name).toArray(String[]::new); } } - - @Contract("_ -> new") - @SuppressWarnings("All") - private @NotNull PacketBuffer createPacketBuffer(final @NotNull String data) { - return new PacketBuffer(Unpooled.buffer()).writeString(data); - } } \ No newline at end of file From 679297f4a702ba355455396a7946a69257fa7d6e Mon Sep 17 00:00:00 2001 From: xia-mc <2052472631@qq.com> Date: Wed, 10 Jul 2024 01:36:27 +0800 Subject: [PATCH 2/2] fix AutoWeapon. --- .../keystrokesmod/module/ModuleManager.java | 2 +- .../module/impl/movement/Fly.java | 2 +- .../module/impl/world/AutoWeapon.java | 24 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/java/keystrokesmod/module/ModuleManager.java b/src/main/java/keystrokesmod/module/ModuleManager.java index 446309da..2e9fdfdc 100644 --- a/src/main/java/keystrokesmod/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/module/ModuleManager.java @@ -211,7 +211,7 @@ public void register() { this.addModule(panic = new Panic()); this.addModule(slotHandler = new SlotHandler()); this.addModule(staffDetector = new StaffDetector()); - this.addModule(new AutoWeapon()); + this.addModule(new AutoWeapon()); this.addModule(autoRespawn = new AutoRespawn()); antiBot.enable(); diff --git a/src/main/java/keystrokesmod/module/impl/movement/Fly.java b/src/main/java/keystrokesmod/module/impl/movement/Fly.java index 319459e1..d096aa97 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Fly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Fly.java @@ -53,7 +53,7 @@ public Fly() { this.registerSetting(verticalSpeed = new SliderSetting("Vertical speed", 2.0, 0.0, 9.0, 0.1, canChangeSpeed)); this.registerSetting(maxBalance = new SliderSetting("Max balance", 6000, 3000, 30000, 1000, "ms", balanceMode)); this.registerSetting(autoDisable = new ButtonSetting("Auto disable", true, balanceMode)); - this.registerSetting(motionMultiplier = new SliderSetting("Motion multiplier", 1.0, 0.8, 1.1, 0.05, new ModeOnly(mode, 6))); + this.registerSetting(motionMultiplier = new SliderSetting("Motion multiplier", 1.0, 0.8, 1.2, 0.05, new ModeOnly(mode, 6))); this.registerSetting(showBPS = new ButtonSetting("Show BPS", false)); this.registerSetting(stopMotion = new ButtonSetting("Stop motion", false)); } diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java index 0da423e8..b36b7be8 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java @@ -1,5 +1,7 @@ package keystrokesmod.module.impl.world; +import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -16,6 +18,7 @@ public class AutoWeapon extends Module { private final SliderSetting hoverDelay; private final ButtonSetting swap; + private final ButtonSetting ignoreTeammates; private int previousSlot = -1; private int ticksHovered; private Entity currentEntity; @@ -23,8 +26,9 @@ public AutoWeapon() { super("AutoWeapon", category.world); this.registerSetting(hoverDelay = new SliderSetting("Hover delay", 0.0, 0.0, 20.0, 1.0)); this.registerSetting(swap = new ButtonSetting("Swap to previous slot", true)); + this.registerSetting(ignoreTeammates = new ButtonSetting("Ignore teammates", true)); this.registerSetting(new DescriptionSetting("Configure your weapons in the Settings tab.")); - } + } public void onDisable() { resetVariables(); @@ -38,26 +42,24 @@ public void setSlot(final int currentItem) { } @SubscribeEvent - public void onTick(TickEvent.RenderTickEvent e) { - if (Utils.nullCheck() || !mc.inGameHasFocus || mc.currentScreen != null) { + public void onPreMotion(PreMotionEvent e) { + if (!Utils.nullCheck() || !mc.inGameHasFocus || mc.currentScreen != null) { resetSlot(); resetVariables(); return; } Entity hoveredEntity = mc.objectMouseOver != null ? mc.objectMouseOver.entityHit : null; - if (!(hoveredEntity instanceof Entity)) { + if (!(hoveredEntity instanceof EntityLivingBase) + || (hoveredEntity instanceof EntityPlayer && AntiBot.isBot(hoveredEntity)) + || (hoveredEntity instanceof EntityPlayer && Utils.isFriended((EntityPlayer) hoveredEntity)) + || (ignoreTeammates.isToggled() && Utils.isTeamMate(hoveredEntity)) + ) { resetSlot(); resetVariables(); return; } ticksHovered = hoveredEntity.equals(currentEntity) ? ticksHovered + 1 : 0; - if (hoveredEntity instanceof EntityLivingBase - && !AntiBot.isBot(hoveredEntity) - && (!(hoveredEntity instanceof EntityPlayer) || Utils.isFriended((EntityPlayer) hoveredEntity)) - && !Utils.isTeamMate(hoveredEntity) - ) { - currentEntity = hoveredEntity; - } + currentEntity = hoveredEntity; if (hoverDelay.getInput() == 0 || ticksHovered > hoverDelay.getInput()) { int slot = Utils.getWeapon();