From 7340d2207b8d28c7fc73a417c032a4c6f5290ec7 Mon Sep 17 00:00:00 2001 From: jackh Date: Mon, 17 Feb 2025 18:20:42 -0700 Subject: [PATCH] t --- src/main/java/keystrokesmod/Raven.java | 47 +-- .../java/keystrokesmod/clickgui/ClickGui.java | 110 +++--- .../components/impl/BindComponent.java | 6 +- .../components/impl/ButtonComponent.java | 5 +- .../components/impl/CategoryComponent.java | 19 +- .../components/impl/ModuleComponent.java | 4 +- .../components/impl/SliderComponent.java | 4 +- .../event/PostSetSliderEvent.java | 13 + .../keystrokesmod/event/SlotUpdateEvent.java | 4 +- .../mixin/impl/client/MixinMinecraft.java | 6 +- .../mixin/impl/render/MixinRenderPlayer.java | 23 ++ .../module/impl/client/CommandLine.java | 20 +- .../module/impl/combat/KillAura.java | 78 ++-- .../module/impl/combat/Velocity.java | 16 +- .../module/impl/movement/Bhop.java | 10 +- .../module/impl/movement/LongJump.java | 65 +-- .../module/impl/movement/NoSlow.java | 5 +- .../module/impl/movement/Sprint.java | 10 +- .../module/impl/movement/TargetStrafe.java | 11 +- .../module/impl/player/BedAura.java | 27 +- .../module/impl/player/Blink.java | 13 +- .../module/impl/player/NoFall.java | 30 ++ .../module/impl/player/Safewalk.java | 15 +- .../module/impl/player/Scaffold.java | 372 ++++++++---------- .../module/impl/player/Tower.java | 50 ++- .../module/impl/render/BreakProgress.java | 2 +- .../module/impl/render/Nametags.java | 25 +- .../keystrokesmod/utility/ModuleUtils.java | 275 +++++++------ src/main/resources/mixins.raven.json | 1 + 29 files changed, 700 insertions(+), 566 deletions(-) create mode 100644 src/main/java/keystrokesmod/event/PostSetSliderEvent.java create mode 100644 src/main/java/keystrokesmod/mixin/impl/render/MixinRenderPlayer.java diff --git a/src/main/java/keystrokesmod/Raven.java b/src/main/java/keystrokesmod/Raven.java index 3633d11..8c813c5 100644 --- a/src/main/java/keystrokesmod/Raven.java +++ b/src/main/java/keystrokesmod/Raven.java @@ -5,16 +5,17 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import keystrokesmod.event.PostProfileLoadEvent; +import keystrokesmod.event.PostSetSliderEvent; import keystrokesmod.keystroke.KeySrokeRenderer; import keystrokesmod.keystroke.KeyStrokeConfigGui; import keystrokesmod.keystroke.keystrokeCommand; import keystrokesmod.module.Module; import keystrokesmod.clickgui.ClickGui; import keystrokesmod.module.ModuleManager; +import keystrokesmod.script.ScriptDefaults; +import keystrokesmod.script.ScriptManager; import keystrokesmod.script.classes.Entity; import keystrokesmod.script.classes.NetworkPlayer; -import keystrokesmod.utility.ModuleUtils; -import keystrokesmod.script.ScriptManager; import keystrokesmod.utility.*; import keystrokesmod.utility.command.CommandManager; import keystrokesmod.utility.profile.Profile; @@ -23,7 +24,6 @@ import net.minecraft.client.Minecraft; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -31,12 +31,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -@Mod( - modid = "keystrokes", - name = "KeystrokesMod", - version = "KMV5", - acceptedMinecraftVersions = "[1.8.9]" -) +@Mod(modid = "keystrokes", name = "KeystrokesMod", version = "KMV5", acceptedMinecraftVersions = "[1.8.9]") public class Raven { public static boolean debug = false; public static Minecraft mc = Minecraft.getMinecraft(); @@ -63,19 +58,20 @@ public class Raven { Runtime.getRuntime().addShutdownHook(new Thread(cachedExecutor::shutdown)); ClientCommandHandler.instance.registerCommand(new keystrokeCommand()); MinecraftForge.EVENT_BUS.register(this); - MinecraftForge.EVENT_BUS.register(new DebugInfoRenderer()); + MinecraftForge.EVENT_BUS.register(new Debugger()); MinecraftForge.EVENT_BUS.register(new CPSCalculator()); - MinecraftForge.EVENT_BUS.register(new MovementFix(mc)); + MinecraftForge.EVENT_BUS.register(new MovementFix(this.mc)); MinecraftForge.EVENT_BUS.register(new KeySrokeRenderer()); MinecraftForge.EVENT_BUS.register(new Ping()); MinecraftForge.EVENT_BUS.register(packetsHandler = new PacketsHandler()); - MinecraftForge.EVENT_BUS.register(new ModuleUtils(mc)); + MinecraftForge.EVENT_BUS.register(new ModuleUtils(this.mc)); Reflection.getFields(); moduleManager.register(); scriptManager = new ScriptManager(); keySrokeRenderer = new KeySrokeRenderer(); clickGui = new ClickGui(); profileManager = new ProfileManager(); + ScriptDefaults.reloadModules(); scriptManager.loadScripts(); profileManager.loadProfiles(); profileManager.loadProfile("default"); @@ -83,7 +79,6 @@ public class Raven { MinecraftForge.EVENT_BUS.register(ModuleManager.scaffold); MinecraftForge.EVENT_BUS.register(ModuleManager.tower); commandManager = new CommandManager(); - } @SubscribeEvent @@ -93,6 +88,9 @@ public class Raven { if (mc.thePlayer.ticksExisted % 6000 == 0) { // reset cache every 5 minutes Entity.clearCache(); NetworkPlayer.clearCache(); + if (Debugger.BACKGROUND) { + Utils.sendMessage("&aticks % 6000 == 0 &7reached, clearing script caches. (&dEntity&7, &dNetworkPlayer&7)"); + } } if (Reflection.sendMessage) { Utils.sendMessage("&cThere was an error, relaunch the game."); @@ -111,9 +109,6 @@ public class Raven { } } if (mc.currentScreen == null) { - for (Profile profile : Raven.profileManager.profiles) { - profile.getModule().onKeyBind(); - } for (Module module : Raven.scriptManager.scripts.values()) { module.onKeyBind(); } @@ -134,6 +129,16 @@ public class Raven { } } + @SubscribeEvent + public void onPostProfileLoad(PostProfileLoadEvent e) { + clickGui.onSliderChange(); + } + + @SubscribeEvent + public void onPostSetSlider(PostSetSliderEvent e) { + clickGui.onSliderChange(); + } + @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent e) { if (e.entity == mc.thePlayer) { @@ -143,14 +148,12 @@ public class Raven { } Entity.clearCache(); NetworkPlayer.clearCache(); + if (Debugger.BACKGROUND) { + Utils.sendMessage("&enew world&7, clearing script caches. (&dEntity&7, &dNetworkPlayer&7)"); + } } } - @SubscribeEvent - public void onPostProfileLoad(PostProfileLoadEvent e) { - clickGui.onProfileLoad(); - } - public static ModuleManager getModuleManager() { return moduleManager; } @@ -170,4 +173,4 @@ public class Raven { public static void toggleKeyStrokeConfigGui() { isKeyStrokeConfigGuiToggled = true; } -} +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/clickgui/ClickGui.java b/src/main/java/keystrokesmod/clickgui/ClickGui.java index 9f6fe90..5f9220d 100644 --- a/src/main/java/keystrokesmod/clickgui/ClickGui.java +++ b/src/main/java/keystrokesmod/clickgui/ClickGui.java @@ -89,7 +89,7 @@ public class ClickGui extends GuiScreen { } (this.commandLineInput = new GuiTextField(1, this.mc.fontRendererObj, 22, this.height - 100, 150, 20)).setMaxStringLength(256); this.buttonList.add(this.commandLineSend = new GuiButtonExt(2, 22, this.height - 70, 150, 20, "Send")); - this.commandLineSend.visible = CommandLine.a; + this.commandLineSend.visible = CommandLine.opened; this.previousScale = (int) Gui.guiScale.getInput(); } @@ -142,17 +142,17 @@ public class ClickGui extends GuiScreen { } - if (CommandLine.a) { + if (CommandLine.opened) { if (!this.commandLineSend.visible) { this.commandLineSend.visible = true; } - r = CommandLine.animate.isToggled() ? CommandLine.an.getValueInt(0, 200, 2) : 200; - if (CommandLine.b) { + r = CommandLine.animate.isToggled() ? CommandLine.animation.getValueInt(0, 200, 2) : 200; + if (CommandLine.closed) { r = 200 - r; if (r == 0) { - CommandLine.b = false; - CommandLine.a = false; + CommandLine.closed = false; + CommandLine.opened = false; this.commandLineSend.visible = false; } } @@ -167,62 +167,66 @@ public class ClickGui extends GuiScreen { this.commandLineInput.drawTextBox(); super.drawScreen(x, y, p); } - else if (CommandLine.b) { - CommandLine.b = false; + else if (CommandLine.closed) { + CommandLine.closed = false; } } - public void mouseClicked(int x, int y, int m) throws IOException { - Iterator var4 = categories.iterator(); - - while (true) { - CategoryComponent category; - do { - do { - if (!var4.hasNext()) { - if (CommandLine.a) { - this.commandLineInput.mouseClicked(x, y, m); - super.mouseClicked(x, y, m); - } - - return; - } - - category = (CategoryComponent) var4.next(); - if (category.v(x, y) && !category.i(x, y) && m == 0) { - category.overTitle(true); - category.xx = x - category.getX(); - category.yy = y - category.getY(); - } - - if (category.overTitle(x, y) && m == 1) { - category.mouseClicked(!category.isOpened()); - } - - if (category.i(x, y) && m == 0) { - category.cv(!category.p()); - } - } while (!category.isOpened()); - } while (category.getModules().isEmpty()); - - for (Component c : category.getModules()) { - if (c.onClick(x, y, m) && c instanceof ModuleComponent) { - category.openModule((ModuleComponent) c); + public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + if (mouseButton == 0) { + boolean draggingAssigned = false; + for (int i = categories.size() - 1; i >= 0; i--) { + CategoryComponent category = categories.get(i); + if (!draggingAssigned && category.draggable(mouseX, mouseY)) { + category.overTitle(true); + category.xx = mouseX - category.getX(); + category.yy = mouseY - category.getY(); + category.dragging = true; + draggingAssigned = true; + } + else { + category.overTitle(false); } } + } + if (mouseButton == 1) { + boolean toggled = false; + for (int i = categories.size() - 1; i >= 0; i--) { + CategoryComponent category = categories.get(i); + if (!toggled && category.overTitle(mouseX, mouseY)) { + category.mouseClicked(!category.isOpened()); + toggled = true; + } + } + } + + for (CategoryComponent category : categories) { + if (category.isOpened() && !category.getModules().isEmpty() && category.overRect(mouseX, mouseY)) { + for (ModuleComponent component : category.getModules()) { + if (component.onClick(mouseX, mouseY, mouseButton)) { + category.openModule(component); + } + } + } + } + + if (CommandLine.opened) { + this.commandLineInput.mouseClicked(mouseX, mouseY, mouseButton); + super.mouseClicked(mouseX, mouseY, mouseButton); } } - public void mouseReleased(int x, int y, int s) { - if (s == 0) { + + public void mouseReleased(int x, int y, int button) { + if (button == 0) { Iterator iterator = categories.iterator(); while (iterator.hasNext()) { CategoryComponent category = iterator.next(); category.overTitle(false); if (category.isOpened() && !category.getModules().isEmpty()) { for (Component module : category.getModules()) { - module.mouseReleased(x, y, s); + module.mouseReleased(x, y, button); } } } @@ -261,7 +265,8 @@ public class ClickGui extends GuiScreen { public void keyTyped(char t, int k) { if (k == Keyboard.KEY_ESCAPE && !binding()) { this.mc.displayGuiScreen(null); - } else { + } + else { Iterator iterator = categories.iterator(); while (iterator.hasNext()) { CategoryComponent category = iterator.next(); @@ -272,7 +277,7 @@ public class ClickGui extends GuiScreen { } } } - if (CommandLine.a) { + if (CommandLine.opened) { String cm = this.commandLineInput.getText(); if (k == 28 && !cm.isEmpty()) { Commands.rCMD(this.commandLineInput.getText()); @@ -307,6 +312,7 @@ public class ClickGui extends GuiScreen { this.mc.gameSettings.guiScale = originalScale; } + @Override public boolean doesGuiPauseGame() { return false; } @@ -324,11 +330,11 @@ public class ClickGui extends GuiScreen { return false; } - public void onProfileLoad() { + public void onSliderChange() { for (CategoryComponent c : categories) { for (ModuleComponent m : c.getModules()) { - m.onProfileLoad(); + m.onSliderChange(); } } } -} +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java index 31fefe2..db91012 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java @@ -46,7 +46,7 @@ public class BindComponent extends Component { this.drawString(!this.moduleComponent.mod.canBeEnabled() && this.moduleComponent.mod.script == null ? "Module cannot be bound." : this.isBinding ? "Press a key..." : "Current bind: '§e" + getKeyAsStr(false) + "§r'"); } else { - this.drawString(this.isBinding ? "Press a key..." : this.keySetting.getName() + ": '§e" + getKeyAsStr(true) + "§r'"); + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.isBinding ? "Press a key..." : this.keySetting.getName() + ": '§e" + getKeyAsStr(true) + "§r'", (float) ((this.moduleComponent.categoryComponent.getX() + 4) * 2) + xOffset, (float) ((this.moduleComponent.categoryComponent.getY() + this.o + (this.keySetting == null ? 3 : 4)) * 2), Theme.getGradient(Theme.descriptor[0], Theme.descriptor[1], 0)); } GL11.glPopMatrix(); } @@ -57,7 +57,7 @@ public class BindComponent extends Component { } public boolean onClick(int x, int y, int button) { - if (this.overSetting(x, y) && this.moduleComponent.isOpened && this.moduleComponent.mod.canBeEnabled()) { + if (this.overSetting(x, y) && this.moduleComponent.isOpened && this.moduleComponent.mod.canBeEnabled() && this.visible && (this.keySetting == null || this.keySetting.visible)) { if (button == 0) { this.isBinding = !this.isBinding; } @@ -139,7 +139,7 @@ public class BindComponent extends Component { } public String getKeyAsStr(boolean isKey) { - int key = isKey ? this.keySetting.getKey() : this.moduleComponent.mod.getKeycode();; + int key = isKey ? this.keySetting.getKey() : this.moduleComponent.mod.getKeycode(); return (key >= 1000 ? ((key == 1069 || key == 1070) ? getScroll(key) : "M" + (key - 1000)) : Keyboard.getKeyName(key)); } diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java index 0ccbce4..58e7a94 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java @@ -4,7 +4,6 @@ import keystrokesmod.Raven; import keystrokesmod.clickgui.components.Component; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.RenderUtils; import keystrokesmod.utility.profile.ProfileModule; import net.minecraft.client.Minecraft; import org.lwjgl.opengl.GL11; @@ -52,7 +51,7 @@ public class ButtonComponent extends Component { } public boolean onClick(int x, int y, int b) { - if (this.i(x, y) && b == 0 && this.p.isOpened) { + if (this.i(x, y) && b == 0 && this.p.isOpened && this.visible && this.buttonSetting.visible) { if (this.buttonSetting.isMethodButton) { this.buttonSetting.runMethod(); return false; @@ -69,4 +68,4 @@ public class ButtonComponent extends Component { public boolean i(int x, int y) { return x > this.x && x < this.x + this.p.categoryComponent.getWidth() && y > this.y && y < this.y + 11; } -} +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/CategoryComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/CategoryComponent.java index e6bfc57..e0a5100 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/CategoryComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/CategoryComponent.java @@ -38,7 +38,6 @@ public class CategoryComponent { public boolean dragging; public int xx; public int yy; - public boolean pin = false; public boolean hovering = false; public boolean hoveringOverCategory = false; public Timer smoothTimer; @@ -145,14 +144,6 @@ public class CategoryComponent { this.dragging = d; } - public boolean p() { - return this.pin; - } - - public void cv(boolean on) { - this.pin = on; - } - public boolean isOpened() { return this.opened; } @@ -326,10 +317,6 @@ public class CategoryComponent { hovering = overTitle(mouseX, mouseY); } - public boolean i(int x, int y) { - return x >= this.x + 92 - 13 && x <= this.x + this.width && (float) y >= (float) this.y + 2.0F && y <= this.y + this.titleHeight + 1; - } - public boolean overTitle(int x, int y) { return x >= this.x && x <= this.x + this.width && (float) y >= (float) this.y + 2.0F && y <= this.y + this.titleHeight + 1; } @@ -338,10 +325,14 @@ public class CategoryComponent { return x >= this.x - 2 && x <= this.x + this.width + 2 && (float) y >= (float) this.y + 2.0F && y <= this.y + this.titleHeight + big + 1; } - public boolean v(int x, int y) { + public boolean draggable(int x, int y) { return x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y + this.titleHeight; } + public boolean overRect(int x, int y) { + return x >= this.x - 2 && x <= this.x + this.width + 2 && y >= this.y && y <= lastHeight; + } + private void renderItemForCategory(Module.category category, int x, int y, boolean enchant) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); double scale = 0.55; diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java index d48c898..e2cb997 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java @@ -195,10 +195,10 @@ public class ModuleComponent extends Component { } } - public void onProfileLoad() { + public void onSliderChange() { for (Component c : this.settings) { if (c instanceof SliderComponent) { - ((SliderComponent) c).onProfileLoad(); + ((SliderComponent) c).onSliderChange(); } } } diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java index 8156257..88fb761 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java @@ -125,7 +125,7 @@ public class SliderComponent extends Component { } } - public void onProfileLoad() { + public void onSliderChange() { double initial = (sliderSetting.getInput() == -1 && sliderSetting.canBeDisabled) ? -1 : sliderSetting.getInput(); this.targetValue = initial; @@ -146,7 +146,7 @@ public class SliderComponent extends Component { @Override public boolean onClick(int mouseX, int mouseY, int button) { - if ((u(mouseX, mouseY) || i(mouseX, mouseY)) && button == 0 && this.moduleComponent.isOpened) { + if ((u(mouseX, mouseY) || i(mouseX, mouseY)) && button == 0 && this.moduleComponent.isOpened && this.visible && this.sliderSetting.visible) { this.heldDown = true; } return false; diff --git a/src/main/java/keystrokesmod/event/PostSetSliderEvent.java b/src/main/java/keystrokesmod/event/PostSetSliderEvent.java new file mode 100644 index 0000000..d598471 --- /dev/null +++ b/src/main/java/keystrokesmod/event/PostSetSliderEvent.java @@ -0,0 +1,13 @@ +package keystrokesmod.event; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class PostSetSliderEvent extends Event { + public double previousVal; + public double newVal; + + public PostSetSliderEvent(double previousVal, double newVal) { + this.previousVal = previousVal; + this.newVal = newVal; + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/event/SlotUpdateEvent.java b/src/main/java/keystrokesmod/event/SlotUpdateEvent.java index ee06938..9e38079 100644 --- a/src/main/java/keystrokesmod/event/SlotUpdateEvent.java +++ b/src/main/java/keystrokesmod/event/SlotUpdateEvent.java @@ -1,11 +1,13 @@ package keystrokesmod.event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; +@Cancelable public class SlotUpdateEvent extends Event { public int slot; public SlotUpdateEvent(int slot) { this.slot = slot; } -} +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java b/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java index 63bbcac..9be8fba 100644 --- a/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java +++ b/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java @@ -51,7 +51,11 @@ public class MixinMinecraft { @Redirect(method = "runTick", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/InventoryPlayer;currentItem:I", opcode = Opcodes.PUTFIELD)) private void onSetCurrentItem(InventoryPlayer inventoryPlayer, int slot) { - MinecraftForge.EVENT_BUS.post(new SlotUpdateEvent(slot)); + SlotUpdateEvent e = new SlotUpdateEvent(slot); + MinecraftForge.EVENT_BUS.post(e); + if (e.isCanceled()) { + return; + } inventoryPlayer.currentItem = slot; } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/mixin/impl/render/MixinRenderPlayer.java b/src/main/java/keystrokesmod/mixin/impl/render/MixinRenderPlayer.java new file mode 100644 index 0000000..9354706 --- /dev/null +++ b/src/main/java/keystrokesmod/mixin/impl/render/MixinRenderPlayer.java @@ -0,0 +1,23 @@ +package keystrokesmod.mixin.impl.render; + +import keystrokesmod.utility.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; +import net.minecraft.client.renderer.entity.RenderPlayer; + +@Mixin(RenderPlayer.class) +public class MixinRenderPlayer { + @Redirect(method = "setModelVisibilities(Lnet/minecraft/client/entity/AbstractClientPlayer;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/InventoryPlayer;getCurrentItem()Lnet/minecraft/item/ItemStack;")) + private ItemStack redirectGetCurrentItem(InventoryPlayer inventory) { + if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { + return Utils.getSpoofedItem(inventory.getCurrentItem()); + } + else { + return inventory.getCurrentItem(); + } + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/client/CommandLine.java b/src/main/java/keystrokesmod/module/impl/client/CommandLine.java index be257e7..6504239 100644 --- a/src/main/java/keystrokesmod/module/impl/client/CommandLine.java +++ b/src/main/java/keystrokesmod/module/impl/client/CommandLine.java @@ -6,27 +6,27 @@ import keystrokesmod.utility.Commands; import keystrokesmod.utility.Timer; public class CommandLine extends Module { - public static boolean a = false; - public static boolean b = false; - public static Timer an; + public static boolean opened = false; + public static boolean closed = false; + public static Timer animation; public static ButtonSetting animate; public CommandLine() { - super("Command line", Module.category.client, 0); + super("Command line", category.client); this.registerSetting(animate = new ButtonSetting("Animate", true)); } public void onEnable() { Commands.setccs(); - a = true; - b = false; - (an = new Timer(500.0F)).start(); + opened = true; + closed = false; + (animation = new Timer(500.0F)).start(); } public void onDisable() { - b = true; - if (an != null) { - an.start(); + closed = true; + if (animation != null) { + animation.start(); } Commands.od(); diff --git a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java index 87eea0f..63869f7 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java +++ b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java @@ -123,6 +123,8 @@ public class KillAura extends Module { private boolean disableCheckUsing; private int disableCTicks; + public boolean blocked; + public KillAura() { super("KillAura", category.combat); this.registerSetting(aps = new SliderSetting("APS", 16.0, 1.0, 20.0, 0.5)); @@ -226,9 +228,17 @@ public class KillAura extends Module { @SubscribeEvent public void onPreUpdate(PreUpdateEvent e) { - if (!Utils.nullCheck() || ModuleUtils.profileTicks <= 1) { + if (!Utils.nullCheck()) { return; } + if (target == null || !manualBlock() && manualBlock.isToggled()) { + if (ModuleUtils.swapTick == 0 && !ModuleUtils.isBlocked) { + interactTicks = 1; + } + else { + interactTicks = 0; + } + } if (target != null && Utils.holdingSword()) { if (Mouse.isButtonDown(0) && Utils.tabbedIn()) { mc.thePlayer.swingItem(); @@ -244,6 +254,7 @@ public class KillAura extends Module { if (checkUsing && !sendUnBlock && Mouse.isButtonDown(1) && !blinkAutoBlock()) { KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true); checkUsing = false; + blocked = true; } } if (!checkUsing) { @@ -263,13 +274,16 @@ public class KillAura extends Module { if (Mouse.isButtonDown(1) && Utils.tabbedIn()) { Reflection.setItemInUse(this.blockingClient = true); canBlockServerside = (target == null); + blocked = true; } else if (canBlockServerside) { Reflection.setItemInUse(this.blockingClient = false); canBlockServerside = false; + blocked = false; } if (g == null && !BlockUtils.isInteractable(mc.objectMouseOver) || target != null) { KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false); + blocked = false; } usedWhileTargeting = Mouse.isButtonDown(1); } @@ -594,7 +608,6 @@ public class KillAura extends Module { //Utils.print("2"); } partialTicks = 0; - interactTicks = 0; handleBlocking(false); target = null; attackingEntity = null; @@ -799,14 +812,13 @@ public class KillAura extends Module { case 1: // vanilla setKeyBindState(keyCode, blockState, false); this.blockingClient = blockState; + blocked = blockState; break; case 2: // partial Reflection.setItemInUse(this.blockingClient = ModuleUtils.isBlocked); break; case 3: // interact a case 4: // interact b - case 5: // hypixel a - case 6: // hypixel b Reflection.setItemInUse(this.blockingClient = blockState); break; } @@ -862,6 +874,7 @@ public class KillAura extends Module { blockingServer = false; return; } + lag = true; switch ((int) autoBlockMode.getInput()) { case 2: // partial if (interactTicks >= 3) { @@ -871,20 +884,12 @@ public class KillAura extends Module { switch (interactTicks) { case 1: if (ModuleUtils.isBlocked) { - mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); - } - else { - handleInteractAndAttack(distance, true, true, swung); - sendBlockPacket(); - lag = true; + sendUnBlockPacket(); } break; case 2: - if (!ModuleUtils.isBlocked) { - handleInteractAndAttack(distance, true, true, swung); - sendBlockPacket(); - lag = true; - } + handleInteractAndAttack(distance, true, true, swung); + sendBlockPacket(); break; } break; @@ -926,15 +931,13 @@ public class KillAura extends Module { case 1: blinking.set(true); if (ModuleUtils.isBlocked) { - mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); - lag = false; + sendUnBlockPacket(); } break; case 2: handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); releasePackets(); // release - lag = true; break; } } @@ -948,15 +951,13 @@ public class KillAura extends Module { case 1: blinking.set(true); if (ModuleUtils.isBlocked) { - mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); - lag = false; + sendUnBlockPacket(); } break; case 2: handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); releasePackets(); // release - lag = true; break; } } @@ -974,18 +975,16 @@ public class KillAura extends Module { case 1: blinking.set(true); if (ModuleUtils.isBlocked) { - mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); - lag = false; + sendUnBlockPacket(); } break; case 2: handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); releasePackets(); // release - lag = true; break; case 3: - if (firstEdge == 2 || firstEdge == 5) { + if (firstEdge == 2 || firstEdge == 6) { firstCycle = false; } interactTicks = 0; @@ -1001,14 +1000,12 @@ public class KillAura extends Module { case 1: blinking.set(true); if (ModuleUtils.isBlocked) { - mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); - lag = false; + sendUnBlockPacket(); } break; case 2: handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); - lag = true; releasePackets(); // release firstCycle = true; interactTicks = 0; @@ -1028,7 +1025,6 @@ public class KillAura extends Module { if (ModuleUtils.isBlocked) { setSwapSlot(); swapped = true; - lag = false; } break; case 2: @@ -1039,7 +1035,6 @@ public class KillAura extends Module { handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); releasePackets(); // release - lag = true; break; } } @@ -1055,7 +1050,6 @@ public class KillAura extends Module { if (ModuleUtils.isBlocked) { setSwapSlot(); swapped = true; - lag = false; } break; case 2: @@ -1066,7 +1060,6 @@ public class KillAura extends Module { handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); releasePackets(); // release - lag = true; break; } } @@ -1086,13 +1079,12 @@ public class KillAura extends Module { swapped = true; } else { - mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); + sendUnBlockPacket(); } firstGyatt++; if (firstGyatt > 4) { firstGyatt = 0; } - lag = false; } break; case 2: @@ -1103,7 +1095,6 @@ public class KillAura extends Module { handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); releasePackets(); // release - lag = true; break; case 3: firstCycle = false; @@ -1124,13 +1115,12 @@ public class KillAura extends Module { swapped = true; } else { - mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); + sendUnBlockPacket(); } firstEdge++; if (firstEdge > 4) { firstEdge = 0; } - lag = false; } break; case 2: @@ -1141,7 +1131,6 @@ public class KillAura extends Module { handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); releasePackets(); // release - lag = true; firstCycle = true; interactTicks = 0; break; @@ -1153,6 +1142,7 @@ public class KillAura extends Module { int bestSwapSlot = getBestSwapSlot(); mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(bestSwapSlot)); Raven.packetsHandler.playerSlot.set(bestSwapSlot); + blocked = false; } private void setCurrentSlot() { @@ -1218,7 +1208,13 @@ public class KillAura extends Module { } private void sendBlockPacket() { - mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); + mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); + blocked = true; + } + + private void sendUnBlockPacket() { + mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); + blocked = false; } private void setKeyBindState(int keycode, boolean state, boolean invokeTick) { @@ -1233,7 +1229,7 @@ public class KillAura extends Module { } private void swingItem() { - if (silentSwing.isToggled() && mc.thePlayer.isBlocking()) { + if ((silentSwing.isToggled() && mc.thePlayer.isBlocking()) || ModuleManager.bedAura.stopAutoblock) { mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); } else { @@ -1397,7 +1393,7 @@ public class KillAura extends Module { } swapped = false; lag = false; - firstEdge = firstGyatt = interactTicks = 0; + firstEdge = firstGyatt = 0; firstCycle = true; } diff --git a/src/main/java/keystrokesmod/module/impl/combat/Velocity.java b/src/main/java/keystrokesmod/module/impl/combat/Velocity.java index 8b2ec83..db9389e 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/Velocity.java +++ b/src/main/java/keystrokesmod/module/impl/combat/Velocity.java @@ -77,14 +77,14 @@ public class Velocity extends Module { - horizontal.setVisible(velocityModes.getInput() != 2, this); - vertical.setVisible(velocityModes.getInput() != 2, this); - chance.setVisible(velocityModes.getInput() != 2, this); - reverseHorizontal.setVisible(velocityModes.getInput() == 2, this); + this.horizontal.setVisible(velocityModes.getInput() != 2, this); + this.vertical.setVisible(velocityModes.getInput() != 2, this); + this.chance.setVisible(velocityModes.getInput() != 2, this); + this.reverseHorizontal.setVisible(velocityModes.getInput() == 2, this); - minExtraSpeed.setVisible(velocityModes.getInput() == 2, this); - extraSpeedBoost.setVisible(velocityModes.getInput() == 2, this); - reverseDebug.setVisible(velocityModes.getInput() == 2, this); + this.minExtraSpeed.setVisible(velocityModes.getInput() == 2, this); + this.extraSpeedBoost.setVisible(velocityModes.getInput() == 2, this); + this.reverseDebug.setVisible(velocityModes.getInput() == 2, this); } @SubscribeEvent @@ -110,7 +110,7 @@ public class Velocity extends Module { @SubscribeEvent public void onReceivePacket(ReceivePacketEvent e) { if (velocityModes.getInput() == 1) { - if (!Utils.nullCheck() || LongJump.stopVelocity || e.isCanceled() || ModuleManager.bedAura.cancelKnockback() || velocityModes.getInput() == 2 && ModuleUtils.firstDamage || ModuleManager.bhop.isEnabled() && ModuleManager.bhop.damageBoost.isToggled() && ModuleUtils.firstDamage && (!ModuleManager.bhop.damageBoostRequireKey.isToggled() || ModuleManager.bhop.damageBoostKey.isPressed())) { + if (!Utils.nullCheck() || LongJump.stopVelocity || e.isCanceled() || ModuleManager.bedAura.cancelKnockback() || ModuleManager.tower.cancelKnockback() || velocityModes.getInput() == 2 && ModuleUtils.firstDamage || ModuleManager.bhop.isEnabled() && ModuleManager.bhop.damageBoost.isToggled() && ModuleUtils.firstDamage && (!ModuleManager.bhop.damageBoostRequireKey.isToggled() || ModuleManager.bhop.damageBoostKey.isPressed())) { return; } if (e.getPacket() instanceof S27PacketExplosion) { diff --git a/src/main/java/keystrokesmod/module/impl/movement/Bhop.java b/src/main/java/keystrokesmod/module/impl/movement/Bhop.java index 0841939..7165f93 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Bhop.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Bhop.java @@ -3,6 +3,7 @@ package keystrokesmod.module.impl.movement; import keystrokesmod.event.PostMotionEvent; import keystrokesmod.event.PostPlayerInputEvent; import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.combat.Velocity; @@ -17,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class Bhop extends Module { public SliderSetting mode; + public static SliderSetting friction; public static SliderSetting speedSetting; private ButtonSetting liquidDisable; public ButtonSetting disablerOnly; @@ -30,11 +32,13 @@ public class Bhop extends Module { public boolean hopping, lowhop, didMove, setRotation; private int motionTick = 0; public boolean isNormalPos; + public boolean running; public Bhop() { super("Bhop", Module.category.movement); this.registerSetting(mode = new SliderSetting("Mode", 0, modes)); this.registerSetting(speedSetting = new SliderSetting("Speed", 2.0, 0.8, 1.2, 0.01)); + this.registerSetting(friction = new SliderSetting("Friction multiplier", 1, 1, 1.3, 0.01)); this.registerSetting(disablerOnly = new ButtonSetting("Lowhop only if disabler loaded", false)); this.registerSetting(liquidDisable = new ButtonSetting("Disable in liquid", true)); this.registerSetting(sneakDisable = new ButtonSetting("Disable while sneaking", true)); @@ -81,7 +85,7 @@ public class Bhop extends Module { if (ModuleManager.scaffold.moduleEnabled || ModuleManager.scaffold.lowhop) { return; } - if (ModuleManager.LongJump.function) { + if (LongJump.function) { return; } motionTick = 0; @@ -96,6 +100,7 @@ public class Bhop extends Module { else { mc.thePlayer.motionY = 0.41999998688698; } + running = true; if (mc.thePlayer.posY % 1 == 0) { isNormalPos = true; } @@ -119,7 +124,7 @@ public class Bhop extends Module { if (Utils.isMoving()) { if (!Utils.noSlowingBackWithBow() && !ModuleManager.sprint.disableBackwards()) { - Utils.setSpeed(speedModifier - Utils.randomizeDouble(0.0003, 0.0001)); + Utils.setSpeed((speedModifier - Utils.randomizeDouble(0.0003, 0.0001)) * ModuleUtils.applyFrictionMulti()); } didMove = true; } @@ -213,5 +218,6 @@ public class Bhop extends Module { public void onDisable() { hopping = false; + running = false; } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java index 8d0b0a3..9ce33bb 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java @@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; import net.minecraft.network.play.client.C09PacketHeldItemChange; +import net.minecraft.network.play.client.C0APacketAnimation; import net.minecraft.network.play.server.*; import net.minecraft.potion.PotionEffect; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -34,18 +35,20 @@ public class LongJump extends Module { private ButtonSetting manual; private ButtonSetting onlyWithVelocity; - private KeySetting disableKey; + private KeySetting disableKey, flatKey; private ButtonSetting allowStrafe; private ButtonSetting invertYaw; private ButtonSetting stopMovement; private ButtonSetting hideExplosion; public ButtonSetting spoofItem; + private ButtonSetting beginFlat; + private ButtonSetting silentSwing; - private KeySetting temporaryFlightKey; + private KeySetting verticalKey; private SliderSetting pitchVal; - public String[] modes = new String[]{"Floyd", "Boost"}; + public String[] modes = new String[]{"Float", "Boost"}; private boolean manualWasOn; @@ -53,7 +56,7 @@ public class LongJump extends Module { private float pitch; private boolean notMoving; - private boolean enabled; + private boolean enabled, swapped; public static boolean function; private int boostTicks; @@ -89,17 +92,23 @@ public class LongJump extends Module { this.registerSetting(stopMovement = new ButtonSetting("Stop movement", false)); this.registerSetting(hideExplosion = new ButtonSetting("Hide explosion", false)); this.registerSetting(spoofItem = new ButtonSetting("Spoof item", false)); + this.registerSetting(silentSwing = new ButtonSetting("Silent swing", false)); - this.registerSetting(temporaryFlightKey = new KeySetting("Vertical key", Keyboard.KEY_SPACE)); + this.registerSetting(beginFlat = new ButtonSetting("Begin flat", false)); + this.registerSetting(verticalKey = new KeySetting("Vertical key", Keyboard.KEY_SPACE)); + this.registerSetting(flatKey = new KeySetting("Flat key", Keyboard.KEY_SPACE)); } public void guiUpdate() { this.onlyWithVelocity.setVisible(manual.isToggled(), this); this.disableKey.setVisible(manual.isToggled(), this); + this.spoofItem.setVisible(!manual.isToggled(), this); + this.silentSwing.setVisible(!manual.isToggled(), this); this.verticalMotion.setVisible(mode.getInput() == 0, this); this.motionDecay.setVisible(mode.getInput() == 0, this); - this.temporaryFlightKey.setVisible(mode.getInput() == 0, this); + this.verticalKey.setVisible(mode.getInput() == 0 && beginFlat.isToggled(), this); + this.flatKey.setVisible(mode.getInput() == 0 && !beginFlat.isToggled(), this); } public void onEnable() { @@ -148,6 +157,16 @@ public class LongJump extends Module { disabled(); } + if (spoofItem.isToggled() && lastSlot != -1) { + ((IMixinItemRenderer) mc.getItemRenderer()).setCancelUpdate(true); + ((IMixinItemRenderer) mc.getItemRenderer()).setCancelReset(true); + } + + if (swapped) { + resetSlot(); + swapped = false; + } + if (!function) { if (manual.isToggled() && !enabled && (!onlyWithVelocity.isToggled() || onlyWithVelocity.isToggled() && ModuleManager.velocity.isEnabled())) { if (ModuleUtils.threwFireballLow) { @@ -158,11 +177,6 @@ public class LongJump extends Module { return; } - if (spoofItem.isToggled() && lastSlot != -1) { - ((IMixinItemRenderer) mc.getItemRenderer()).setCancelUpdate(true); - ((IMixinItemRenderer) mc.getItemRenderer()).setCancelReset(true); - } - if (enabled) { if (!Utils.isMoving()) notMoving = true; if (boostSetting.getInput() == 0 && verticalMotion.getInput() == 0) { @@ -176,6 +190,7 @@ public class LongJump extends Module { lastSlot = spoofSlot = mc.thePlayer.inventory.currentItem; if (mc.thePlayer.inventory.currentItem != fireballSlot) { mc.thePlayer.inventory.currentItem = fireballSlot; + swapped = true; } } @@ -193,7 +208,7 @@ public class LongJump extends Module { } else { motionDecayVal = (int) motionDecay.getInput(); } - if (stopTime == -1 && ++boostTicks > (!temporaryFlightKey() ? 33/*flat motion ticks*/ : (!notMoving ? 32/*normal motion ticks*/ : 33/*vertical motion ticks*/))) { + if (stopTime == -1 && ++boostTicks > (!verticalKey() ? 33/*flat motion ticks*/ : (!notMoving ? 32/*normal motion ticks*/ : 33/*vertical motion ticks*/))) { disabled(); return; } @@ -265,8 +280,15 @@ public class LongJump extends Module { mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); //((IAccessorMinecraft) mc).callRightClickMouse(); } - mc.thePlayer.swingItem(); - mc.getItemRenderer().resetEquippedProgress(); + if (silentSwing.isToggled()) { + mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); + } + else { + mc.thePlayer.swingItem(); + if (!spoofItem.isToggled()) { + mc.getItemRenderer().resetEquippedProgress(); + } + } stopVelocity = true; //Utils.print("Right click"); } @@ -360,7 +382,7 @@ public class LongJump extends Module { fireballTime = rotateTick = stopTime = 0; boostTicks = -1; resetSlot(); - enabled = function = notMoving = stopVelocity = stopModules = false; + enabled = function = notMoving = stopVelocity = stopModules = swapped = false; if (!manual.isToggled()) { disable(); } @@ -372,7 +394,7 @@ public class LongJump extends Module { if (fireballSlot == -1) { Utils.print("&cFireball not found."); disabled(); - } else if (ModuleManager.scaffold.isEnabled || (pre && Utils.distanceToGround(mc.thePlayer) > 3)/* || (!pre && !PacketUtil.canRightClickItem())*/) { //needs porting + } else if ((pre && Utils.distanceToGround(mc.thePlayer) > 3)/* || (!pre && !PacketUtil.canRightClickItem())*/) { //needs porting Utils.print("&cCan't throw fireball right now."); disabled(); fireballSlot = -1; @@ -392,6 +414,7 @@ public class LongJump extends Module { } } slotReset = true; + stopModules = false; } private int getSpeedLevel() { @@ -407,12 +430,10 @@ public class LongJump extends Module { // only apply horizontal boost once void modifyHorizontal() { if (boostSetting.getInput() != 0) { - //client.print("&7horizontal &b" + boostTicks + " " + client.getPlayer().getHurtTime()); - double speed = boostSetting.getInput() - Utils.randomizeDouble(0.0001, 0); + double speed = ((boostSetting.getInput() > 1.6 && ModuleManager.scaffold.isEnabled) ? 1.6 : boostSetting.getInput()) - Utils.randomizeDouble(0.0001, 0); if (Utils.isMoving()) { Utils.setSpeed(speed); - //Utils.print("og speed"); } } } @@ -421,7 +442,7 @@ public class LongJump extends Module { if (verticalMotion.getInput() != 0) { double ver = ((!notMoving ? verticalMotion.getInput() : 1.16 /*vertical*/) * (1.0 / (1.0 + (0.05 * getSpeedLevel())))) + Utils.randomizeDouble(0.0001, 0.1); double decay = motionDecay.getInput() / 1000; - if (boostTicks > 1 && !temporaryFlightKey()) { + if (boostTicks > 1 && !verticalKey()) { if (boostTicks > 1 || boostTicks <= (!notMoving ? 32/*horizontal motion ticks*/ : 33/*vertical motion ticks*/)) { mc.thePlayer.motionY = Utils.randomizeDouble(0.0101, 0.01); } @@ -436,9 +457,9 @@ public class LongJump extends Module { } } - private boolean temporaryFlightKey() { + private boolean verticalKey() { if (notMoving) return true; - return temporaryFlightKey.isPressed(); + return beginFlat.isToggled() ? verticalKey.isPressed() : !flatKey.isPressed(); } private int getKeyCode(String keyName) { diff --git a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java index 5147622..9f36044 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java @@ -232,6 +232,7 @@ public class NoSlow extends Module { } public static float getSlowed() { + float val = (100.0F - (float) slowed.getInput()) / 100.0F; if (mc.thePlayer.getHeldItem() == null || ModuleManager.noSlow == null || !ModuleManager.noSlow.isEnabled()) { return 0.2f; } @@ -248,8 +249,10 @@ public class NoSlow extends Module { else if (fix) { return 0.2f; } + else if (ModuleManager.killAura.blocked) { + return val; + } } - float val = (100.0F - (float) slowed.getInput()) / 100.0F; return val; } diff --git a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java index dc6ea05..094a8bd 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java @@ -34,6 +34,7 @@ public class Sprint extends Module { private ButtonSetting displayText; private ButtonSetting rainbow; public SliderSetting omniDirectional; + private SliderSetting floatSetting; public ButtonSetting disableBackwards; public String text = "[Sprint (Toggled)]"; public float posX = 5; @@ -52,10 +53,15 @@ public class Sprint extends Module { this.registerSetting(displayText = new ButtonSetting("Display text", false)); this.registerSetting(rainbow = new ButtonSetting("Rainbow", false)); this.registerSetting(omniDirectional = new SliderSetting("Omni-Directional", 0, omniDirectionalModes)); + this.registerSetting(floatSetting = new SliderSetting("Float speed", "%", 100, 0.0, 100.0, 1.0)); this.registerSetting(disableBackwards = new ButtonSetting("Disable backwards", false)); this.closetModule = true; } + public void guiUpdate() { + this.floatSetting.setVisible(omniDirectional.getInput() == 3, this); + } + @SubscribeEvent public void onPreMotion(PreMotionEvent e) { @@ -234,9 +240,9 @@ public class Sprint extends Module { double min = 0; if (mc.thePlayer.moveStrafing != 0 && mc.thePlayer.moveForward != 0) min = 0.003; if (speedLevel >= 0) { - return floatSpeedLevels[speedLevel] - min; + return ((floatSpeedLevels[speedLevel] - min) * (floatSetting.getInput() / 100)); } - return floatSpeedLevels[0] - min; + return ((floatSpeedLevels[0] - min) * (floatSetting.getInput() / 100)); } private int getSpeedLevel() { diff --git a/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java index 433b9b3..70c6fff 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java +++ b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java @@ -18,14 +18,16 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class TargetStrafe extends Module { - private ButtonSetting bhopOnly; + private ButtonSetting requireBhop; + private ButtonSetting requireJump; private double angle; private float radius = 0.6f; public TargetStrafe() { super("TargetStrafe", category.movement); - this.registerSetting(bhopOnly = new ButtonSetting("Require bhop", false)); + this.registerSetting(requireBhop = new ButtonSetting("Require bhop", false)); + this.registerSetting(requireJump = new ButtonSetting("Require jump key", false)); } public void guiUpdate() { @@ -39,7 +41,10 @@ public class TargetStrafe extends Module { @SubscribeEvent(priority = EventPriority.LOWEST) // called last in order to apply fix public void onMoveInput(PrePlayerInputEvent e) { - if (bhopOnly.isToggled() && !ModuleManager.bhop.isEnabled()) { + if (requireBhop.isToggled() && !ModuleManager.bhop.isEnabled()) { + return; + } + if (requireJump.isToggled() && !Utils.jumpDown()) { return; } if (ModuleManager.scaffold.isEnabled) { diff --git a/src/main/java/keystrokesmod/module/impl/player/BedAura.java b/src/main/java/keystrokesmod/module/impl/player/BedAura.java index d621fd2..5242c24 100644 --- a/src/main/java/keystrokesmod/module/impl/player/BedAura.java +++ b/src/main/java/keystrokesmod/module/impl/player/BedAura.java @@ -46,6 +46,7 @@ public class BedAura extends Module { private ButtonSetting sendAnimations; private ButtonSetting silentSwing; private String[] modes = new String[] { "Legit", "Instant", "Swap" }; + private BlockPos[] bedPos; public float breakProgress; private int lastSlot = -1; @@ -129,13 +130,16 @@ public class BedAura extends Module { } switch (noAutoBlockTicks) { case -1: - resetSlot(); noAutoBlockTicks = -2; - break; + return; case -2: + resetSlot(); + noAutoBlockTicks = -3; + return; + case -3: stopAutoblock = false; noAutoBlockTicks = 0; - break; + return; } if (breakNearBlock.isToggled() && isCovered(bedPos[0]) && isCovered(bedPos[1])) { if (nearestBlock == null) { @@ -151,7 +155,7 @@ public class BedAura extends Module { @SubscribeEvent public void onReceivePacket(ReceivePacketEvent e) { - if (!Utils.nullCheck() || !cancelKnockback()) { + if (!Utils.nullCheck() || !cancelKnockback.isToggled() || currentBlock == null) { return; } if (e.getPacket() instanceof S12PacketEntityVelocity) { @@ -186,7 +190,7 @@ public class BedAura extends Module { } @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onRenderWorld(RenderWorldLastEvent renderWorldLastEvent) { + public void onRenderWorld(RenderWorldLastEvent e) { if (!renderOutline.isToggled() || currentBlock == null || !Utils.nullCheck()) { return; } @@ -387,8 +391,17 @@ public class BedAura extends Module { if (breakProgress == 0 && !aiming) { return; } - if (!stopAutoblock && breakProgress <= 0 && mode.getInput() == 2 && ModuleManager.killAura.autoBlockOverride()) { - stopAutoblock = true; // if blocking then return and stop autoblocking + if ((!stopAutoblock || noAutoBlockTicks == 99) && breakProgress <= 0 && mode.getInput() == 2 && ModuleManager.killAura.autoBlockOverride()) { + stopAutoblock = true; + if (noAutoBlockTicks == 0) { + noAutoBlockTicks = 99; + } + else if (noAutoBlockTicks == 99) { + noAutoBlockTicks = 0; + } + if (Raven.debug) { + Utils.sendModuleMessage(this, "&7stopping autoblock on &3start &7(&b" + mc.thePlayer.ticksExisted + "&7)"); + } return; } if (mode.getInput() == 2 || mode.getInput() == 0) { diff --git a/src/main/java/keystrokesmod/module/impl/player/Blink.java b/src/main/java/keystrokesmod/module/impl/player/Blink.java index 8de38d9..c7d6ed4 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Blink.java +++ b/src/main/java/keystrokesmod/module/impl/player/Blink.java @@ -21,6 +21,7 @@ import net.minecraft.network.handshake.client.C00Handshake; import net.minecraft.network.login.client.C00PacketLoginStart; import net.minecraft.network.login.client.C01PacketEncryptionResponse; import net.minecraft.network.play.client.C00PacketKeepAlive; +import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.client.C0FPacketConfirmTransaction; import net.minecraft.network.status.client.C00PacketServerQuery; import net.minecraft.network.status.client.C01PacketPing; @@ -40,7 +41,7 @@ public class Blink extends Module { private static SliderSetting maximumBlinkTicks; private ButtonSetting initialPosition; private ButtonSetting renderTimer; - private ButtonSetting disableOnBreak; + private ButtonSetting disableOnBreak, disableOnAttack; private ConcurrentLinkedQueue blinkedPackets = new ConcurrentLinkedQueue<>(); private Vec3 pos; //final private int color = Theme.getGradient((int) theme.getInput(), 255); @@ -54,6 +55,7 @@ public class Blink extends Module { this.registerSetting(initialPosition = new ButtonSetting("Show initial position", true)); this.registerSetting(renderTimer = new ButtonSetting("Render Timer", false)); this.registerSetting(disableOnBreak = new ButtonSetting("Disable on Break", false)); + this.registerSetting(disableOnAttack = new ButtonSetting("Disable on Attack", false)); } @Override @@ -95,6 +97,10 @@ public class Blink extends Module { if (packet instanceof C00PacketLoginStart || packet instanceof C00Handshake) { return; } + if (disableOnAttack.isToggled() && packet instanceof C02PacketUseEntity || blinkTicks >= 99999) { + blinkTicks = 99999; + return; + } if (!e.isCanceled()) { started = true; blinkedPackets.add(packet); @@ -116,11 +122,14 @@ public class Blink extends Module { disable(); } } + if (blinkTicks >= 99999) { + disable(); + } } @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent ev) { - if (!Utils.nullCheck() || !renderTimer.isToggled() || blinkTicks == 0) { + if (!Utils.nullCheck() || !renderTimer.isToggled() || blinkTicks == 0 || blinkTicks >= 99999) { return; } if (ev.phase == TickEvent.Phase.END) { diff --git a/src/main/java/keystrokesmod/module/impl/player/NoFall.java b/src/main/java/keystrokesmod/module/impl/player/NoFall.java index 0eac8f3..1e368c3 100644 --- a/src/main/java/keystrokesmod/module/impl/player/NoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/NoFall.java @@ -2,6 +2,8 @@ package keystrokesmod.module.impl.player; import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.PreUpdateEvent; +import keystrokesmod.event.ReceivePacketEvent; +import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; @@ -12,17 +14,24 @@ import keystrokesmod.utility.Reflection; import keystrokesmod.utility.Utils; import net.minecraft.client.gui.GuiIngame; import net.minecraft.init.Blocks; +import net.minecraft.network.Packet; import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.server.*; import net.minecraft.util.BlockPos; import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.sound.SoundEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.Objects; + public class NoFall extends Module { public SliderSetting mode; private SliderSetting minFallDistance; private ButtonSetting disableAdventure; private ButtonSetting ignoreVoid; + private ButtonSetting hideSound; private String[] modes = new String[]{"Spoof", "NoGround", "Packet A", "Packet B", "CTW Packet"}; private double initialY; @@ -35,12 +44,33 @@ public class NoFall extends Module { this.registerSetting(disableAdventure = new ButtonSetting("Disable adventure", false)); this.registerSetting(minFallDistance = new SliderSetting("Minimum fall distance", 3, 0, 10, 0.1)); this.registerSetting(ignoreVoid = new ButtonSetting("Ignore void", true)); + //this.registerSetting(hideSound = new ButtonSetting("Hide fall damage sound", false)); } public void onDisable() { Utils.resetTimer(); } + /*@SubscribeEvent + public void onReceivePacket(ReceivePacketEvent e) { + if (e.getPacket() instanceof S29PacketSoundEffect) { + S29PacketSoundEffect s29 = (S29PacketSoundEffect) e.getPacket(); + /*if (!Objects.equals(String.valueOf(s29.getSoundName()), "random.explode")) { + + }*/ + /*Utils.print("" + s29.getSoundName()); + } + }*/ + + /*@SubscribeEvent + public void onSoundEvent(SoundEvent.SoundSourceEvent e) { + if (e.name.startsWith("game.player.hurt.fall")) { + Utils.print("Fall dmg sound"); + + } + }*/ + + @SubscribeEvent public void onPreUpdate(PreUpdateEvent e) { if (reset()) { diff --git a/src/main/java/keystrokesmod/module/impl/player/Safewalk.java b/src/main/java/keystrokesmod/module/impl/player/Safewalk.java index 502bda5..65d0459 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Safewalk.java +++ b/src/main/java/keystrokesmod/module/impl/player/Safewalk.java @@ -23,8 +23,7 @@ public class Safewalk extends Module { private int unsneakDelayTicks = 0; private boolean isSneaking; - private boolean hasSneaked; - private Vec3 pos; + private boolean canSneak; public Safewalk() { super("Safewalk", Module.category.player, 0); @@ -55,7 +54,6 @@ public class Safewalk extends Module { @SubscribeEvent public void onPostPlayerInput(PostPlayerInputEvent e) { - Vec3 current = new Vec3((int) mc.thePlayer.posX, (int) mc.thePlayer.posY, (int) mc.thePlayer.posZ); if (!sneak.isToggled() || !Utils.nullCheck()) { return; } @@ -64,10 +62,9 @@ public class Safewalk extends Module { return; } boolean edge = mc.thePlayer.onGround && Utils.isEdgeOfBlock(); - if (edge && !hasSneaked) { + if (edge) { if (!this.isSneaking) { - hasSneaked = true; - pos = new Vec3((int) mc.thePlayer.posX, (int) mc.thePlayer.posY, (int) mc.thePlayer.posZ); + canSneak = true; } } else { @@ -75,13 +72,13 @@ public class Safewalk extends Module { if (unsneakDelayTicks > 0) { unsneakDelayTicks--; } - else if (!current.equals(pos)) { + else { this.setSneakState(false); return; } } } - if (hasSneaked) { + if (canSneak) { this.setSneakState(true); unsneakDelayTicks = (int) sneakDelay.getInput(); } @@ -104,7 +101,7 @@ public class Safewalk extends Module { if (!sneakState && Utils.isBindDown(mc.gameSettings.keyBindSneak)) { return; } - hasSneaked = sneakState; + canSneak = sneakState; mc.thePlayer.movementInput.sneak = sneakState; this.isSneaking = sneakState; //Utils.print("Edge " + mc.thePlayer.movementInput.sneak + " " + sneakState + " " + mc.thePlayer.ticksExisted); diff --git a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java index ef723c5..0cd07a5 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java @@ -5,6 +5,7 @@ import keystrokesmod.event.*; import keystrokesmod.mixin.interfaces.IMixinItemRenderer; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.impl.movement.Bhop; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; @@ -38,10 +39,10 @@ public class Scaffold extends Module { private final SliderSetting motion; public SliderSetting rotation, fakeRotation; private SliderSetting sprint; + private SliderSetting floatFirstJump; private SliderSetting fastScaffold; private SliderSetting multiPlace; public ButtonSetting autoSwap; - private ButtonSetting cancelKnockBack; private ButtonSetting fastOnRMB; public ButtonSetting highlightBlocks; private ButtonSetting jumpFacingForward; @@ -52,18 +53,32 @@ public class Scaffold extends Module { private String[] rotationModes = new String[] { "§cDisabled", "Simple", "Offset", "Precise" }; private String[] fakeRotationModes = new String[] { "§cDisabled", "Strict", "Smooth", "Spin" }; private String[] sprintModes = new String[] { "§cDisabled", "Vanilla", "Float" }; - private String[] fastScaffoldModes = new String[] { "§cDisabled", "Jump B", "Jump B Low", "Jump E", "Keep-Y", "Keep-Y Low", "Jump Nigger" }; + private String[] fastScaffoldModes = new String[] { "§cDisabled", "Jump A", "Jump B", "Jump B Low", "Jump E", "Keep-Y", "Keep-Y Low" }; private String[] multiPlaceModes = new String[] { "§cDisabled", "1 extra", "2 extra" }; + //Highlight blocks public Map highlight = new HashMap<>(); + public boolean canBlockFade; + //Block count private ScaffoldBlockCount scaffoldBlockCount; + //swapping related public AtomicInteger lastSlot = new AtomicInteger(-1); - + private int spoofSlot; public boolean hasSwapped; - private boolean hasPlaced; + private int blockSlot = -1; + //placements related + private boolean hasPlaced, finishProcedure, canPlace; + private PlaceData lastPlacement; + private EnumFacing[] facings = { EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP }; + private BlockPos[] offsets = { new BlockPos(-1, 0, 0), new BlockPos(1, 0, 0), new BlockPos(0, 0, 1), new BlockPos(0, 0, -1), new BlockPos(0, -1, 0) }; + private Vec3 targetBlock; + private PlaceData blockInfo; + private Vec3 blockPos, hitVec, lookVec; + + //bypass related private boolean rotateForward; private double startYPos = -1; public boolean fastScaffoldKeepY; @@ -72,27 +87,12 @@ public class Scaffold extends Module { private int keepYTicks; public boolean lowhop; private int rotationDelay; - private int blockSlot = -1; - - private float fakeYaw1, fakeYaw2; - - public boolean canBlockFade; - private boolean floatJumped; private boolean floatStarted; private boolean floatWasEnabled; private boolean floatKeepY; - private Vec3 targetBlock; - private PlaceData blockInfo; - private Vec3 blockPos, hitVec, lookVec; - private float[] blockRotations; - private long lastPlaceTime, rotationTimeout = 250L; - private float lastYaw = 0.0f; - private float lastPitch = 0.0f; - public float scaffoldYaw, scaffoldPitch, blockYaw, groundYaw, yawOffset, lastYawOffset; - private boolean set2; - + //disable checks public boolean moduleEnabled; public boolean isEnabled; private boolean disabledModule; @@ -100,32 +100,21 @@ public class Scaffold extends Module { private int disableTicks; private int scaffoldTicks; + //rotation related private boolean was451, was452; - private float minOffset, pOffset; private float minPitch = 80F; - private float edge; - private long firstStroke; - private float lastEdge, lastEdge2, yawAngle, theYaw; - private boolean lastAir; - private double thisX, thisY, thisZ; - - private float finalYaw, finalPitch, lastFY, lastFP; - private boolean set3; - - private float fakeYaw, fakePitch; - - private int speedEdge; - - private int currentFace; + private float lastEdge2, yawAngle, theYaw; private boolean enabledOffGround = false; + private float[] blockRotations; + public float scaffoldYaw, scaffoldPitch, blockYaw, yawOffset; + private boolean set2; + //fake rotations + private float fakeYaw, fakePitch; + private float fakeYaw1, fakeYaw2; - private EnumFacing[] facings = { EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP }; - private BlockPos[] offsets = { new BlockPos(-1, 0, 0), new BlockPos(1, 0, 0), new BlockPos(0, 0, 1), new BlockPos(0, 0, -1), new BlockPos(0, -1, 0) }; - - //private final SliderSetting offsetAmount; public Scaffold() { super("Scaffold", category.player); @@ -133,10 +122,10 @@ public class Scaffold extends Module { this.registerSetting(rotation = new SliderSetting("Rotation", 1, rotationModes)); this.registerSetting(fakeRotation = new SliderSetting("Rotation (fake)", 0, fakeRotationModes)); this.registerSetting(sprint = new SliderSetting("Sprint mode", 0, sprintModes)); + this.registerSetting(floatFirstJump = new SliderSetting("§eFloat §rfirst jump speed", "%", 100, 50, 100, 1)); this.registerSetting(fastScaffold = new SliderSetting("Fast scaffold", 0, fastScaffoldModes)); this.registerSetting(multiPlace = new SliderSetting("Multi-place", 0, multiPlaceModes)); this.registerSetting(autoSwap = new ButtonSetting("Auto swap", true)); - this.registerSetting(cancelKnockBack = new ButtonSetting("Cancel knockback", false)); this.registerSetting(fastOnRMB = new ButtonSetting("Fast on RMB", true)); this.registerSetting(highlightBlocks = new ButtonSetting("Highlight blocks", true)); this.registerSetting(jumpFacingForward = new ButtonSetting("Jump facing forward", false)); @@ -150,6 +139,10 @@ public class Scaffold extends Module { this.alwaysOn = true; } + public void guiUpdate() { + this.floatFirstJump.setVisible(sprint.getInput() == 2, this); + } + public void onDisable() { if (ModuleManager.tower.canTower() && (ModuleManager.tower.dCount == 0 || !Utils.isMoving())) { towerEdge = true; @@ -205,9 +198,8 @@ public class Scaffold extends Module { if (scaffoldTicks > 1) { rotateForward(); mc.thePlayer.jump(); - Utils.setSpeed(getSpeed(getSpeedLevel()) - Utils.randomizeDouble(0.0003, 0.0001)); - speedEdge++; - if (fastScaffold.getInput() == 5 || fastScaffold.getInput() == 2 && firstKeepYPlace) { + Utils.setSpeed((getSpeed(getSpeedLevel()) - Utils.randomizeDouble(0.0003, 0.0001) * ModuleUtils.applyFrictionMulti())); + if (fastScaffold.getInput() == 6 || fastScaffold.getInput() == 3 && firstKeepYPlace) { lowhop = true; } //Utils.print("Keepy"); @@ -221,11 +213,11 @@ public class Scaffold extends Module { else if (fastScaffoldKeepY) { fastScaffoldKeepY = firstKeepYPlace = false; startYPos = -1; - keepYTicks = speedEdge = 0; + keepYTicks = 0; } //Float - if (sprint.getInput() == 2 && !usingFastScaffold() && !ModuleManager.bhop.isEnabled() && !ModuleManager.tower.canTower() && !ModuleManager.LongJump.function) { + if (sprint.getInput() == 2 && !usingFastScaffold() && !fastScaffoldKeepY && !ModuleManager.bhop.isEnabled() && !ModuleManager.tower.canTower() && !ModuleManager.LongJump.function) { floatWasEnabled = true; if (!floatStarted) { if (ModuleUtils.groundTicks > 8 && mc.thePlayer.onGround) { @@ -233,7 +225,8 @@ public class Scaffold extends Module { startYPos = e.posY; mc.thePlayer.jump(); if (Utils.isMoving()) { - Utils.setSpeed(getSpeed(getSpeedLevel()) - Utils.randomizeDouble(0.0003, 0.0001)); + double fvl = (getSpeed(getSpeedLevel()) - Utils.randomizeDouble(0.0003, 0.0001)) * (floatFirstJump.getInput() / 100); + Utils.setSpeed(fvl); } floatJumped = true; } else if (ModuleUtils.groundTicks <= 8 && mc.thePlayer.onGround) { @@ -272,10 +265,7 @@ public class Scaffold extends Module { switch ((int) rotation.getInput()) { case 1: scaffoldYaw = mc.thePlayer.rotationYaw - hardcodedYaw(); - scaffoldPitch = 79F; - if (currentFace == 1) { - scaffoldPitch = 87F; - } + scaffoldPitch = 78F; e.setRotations(scaffoldYaw, scaffoldPitch); break; case 2: @@ -291,39 +281,39 @@ public class Scaffold extends Module { long strokeDelay = 250; if (quad <= 5 || quad >= 85) { - yawAngle = 127.40F; + yawAngle = 126.50F; minOffset = 13; - minPitch = 75.48F; + minPitch = 77.08F; } if (quad > 5 && quad <= 15 || quad >= 75 && quad < 85) { - yawAngle = 128.55F; - minOffset = 11; - minPitch = 75.74F; + yawAngle = 127.50F; + minOffset = 10; + minPitch = 77.34F; } if (quad > 15 && quad <= 25 || quad >= 65 && quad < 75) { - yawAngle = 129.70F; - minOffset = 8; - minPitch = 75.95F; + yawAngle = 128.50F; + minOffset = 7; + minPitch = 77.65F; } if (quad > 25 && quad <= 32 || quad >= 58 && quad < 65) { - yawAngle = 130.85F; + yawAngle = 130F; minOffset = 6; - minPitch = 76.13F; + minPitch = 78.13F; } if (quad > 32 && quad <= 38 || quad >= 52 && quad < 58) { - yawAngle = 131.80F; - minOffset = 5; - minPitch = 76.41F; + yawAngle = 131.50F; + minOffset = 4; + minPitch = 78.41F; } if (quad > 38 && quad <= 42 || quad >= 48 && quad < 52) { - yawAngle = 134.30F; - minOffset = 4; - minPitch = 77.54F; + yawAngle = 133.50F; + minOffset = 2; + minPitch = 79.54F; } if (quad > 42 && quad <= 45 || quad >= 45 && quad < 48) { - yawAngle = 137.85F; - minOffset = 3; - minPitch = 77.93F; + yawAngle = 137F; + minOffset = 1; + minPitch = 79.93F; } //Utils.print("" + minOffset); //float offsetAmountD = ((((float) offsetAmount.getInput() / 10) - 10) * -2) - (((float) offsetAmount.getInput() / 10) - 10); @@ -343,7 +333,7 @@ public class Scaffold extends Module { } else { scaffoldYaw = mc.thePlayer.rotationYaw - hardcodedYaw(); - scaffoldPitch = 78f; + scaffoldPitch = 77f; } e.setRotations(scaffoldYaw, scaffoldPitch); break; @@ -363,9 +353,6 @@ public class Scaffold extends Module { } yawOffset = 0; } - //minOffset = 0;//turning this off for now - Block blockBelow = BlockUtils.getBlock(new BlockPos(Utils.getPosDirectionX(2), mc.thePlayer.posY - 1, Utils.getPosDirectionZ(2))); - lastAir = blockBelow instanceof BlockAir; if (!Utils.isMoving() || Utils.getHorizontalSpeed() == 0.0D) { e.setRotations(theYaw, scaffoldPitch); @@ -537,13 +524,8 @@ public class Scaffold extends Module { e.setPitch(89.9F); } - lastYaw = mc.thePlayer.rotationYaw; - if (lastPlaceTime > 0 && (System.currentTimeMillis() - lastPlaceTime) > rotationTimeout) blockRotations = null; if (rotationDelay > 0) --rotationDelay; - finalYaw = e.getYaw(); - finalPitch = e.getPitch(); - //Fake rotations if (fakeRotation.getInput() > 0) { if (fakeRotation.getInput() == 1) { @@ -551,7 +533,7 @@ public class Scaffold extends Module { if (blockRotations != null) { fakePitch = blockRotations[1] + 5; } else { - fakePitch = scaffoldPitch; + fakePitch = 80f; } } else if (fakeRotation.getInput() == 2) { @@ -565,7 +547,7 @@ public class Scaffold extends Module { if (blockRotations != null) { fakePitch = blockRotations[1] + 5; } else { - fakePitch = scaffoldPitch; + fakePitch = 80f; } } else if (fakeRotation.getInput() == 3) { @@ -577,23 +559,18 @@ public class Scaffold extends Module { } @SubscribeEvent - public void onSendPacket(SendPacketEvent e) { - if (!Utils.nullCheck()) { + public void onPostPlayerInput(PostPlayerInputEvent e) { + if (!ModuleManager.scaffold.isEnabled) { return; } - if (!isEnabled) { - return; - } - if (e.getPacket() instanceof C08PacketPlayerBlockPlacement) { - currentFace = ((C08PacketPlayerBlockPlacement) e.getPacket()).getPlacedBlockDirection(); - } + mc.thePlayer.movementInput.jump = false; } @SubscribeEvent public void onSlotUpdate(SlotUpdateEvent e) { if (isEnabled) { lastSlot.set(e.slot); - //Utils.print("Switched slot | " + e.slot); + e.setCanceled(true); } } @@ -605,15 +582,27 @@ public class Scaffold extends Module { if (LongJump.function) { startYPos = -1; } + if (LongJump.stopModules) { + return; + } + if (ModuleManager.killAura.isTargeting || ModuleManager.killAura.justUnTargeted) { + return; + } if (holdingBlocks() && setSlot()) { - - if (LongJump.stopModules) { - //Utils.print("Stopped scaffold due to longjump swapping"); - return; - } - if (ModuleManager.killAura.isTargeting || ModuleManager.killAura.justUnTargeted) { - //Utils.print("Stopped scaffold due to ka untargeting"); - return; + if (moduleEnabled && !finishProcedure) { + if (Utils.distanceToGround(mc.thePlayer) <= 3) { + canPlace = true; + finishProcedure = true; + } + if (Utils.distanceToGround(mc.thePlayer) > 6) { + canPlace = true; + if (hasPlaced) { + finishProcedure = true; + } + } + else if (!finishProcedure) { + return; + } } hasSwapped = true; @@ -629,25 +618,25 @@ public class Scaffold extends Module { if ((int) mc.thePlayer.posY > (int) startYPos) { switch (mode) { case 1: - if (!firstKeepYPlace && keepYTicks == 8 || keepYTicks == 11) { + if (!firstKeepYPlace && keepYTicks == 3) { placeBlock(1, 0); firstKeepYPlace = true; } break; case 2: - if (!firstKeepYPlace && keepYTicks == 8 || firstKeepYPlace && keepYTicks == 7) { + if (!firstKeepYPlace && keepYTicks == 8 || keepYTicks == 11) { placeBlock(1, 0); firstKeepYPlace = true; } break; case 3: - if (!firstKeepYPlace && keepYTicks == 7) { + if (!firstKeepYPlace && keepYTicks == 8 || firstKeepYPlace && keepYTicks == 7) { placeBlock(1, 0); firstKeepYPlace = true; } break; - case 6: - if (!firstKeepYPlace && keepYTicks == 3) { + case 4: + if (!firstKeepYPlace && keepYTicks == 7) { placeBlock(1, 0); firstKeepYPlace = true; } @@ -698,34 +687,16 @@ public class Scaffold extends Module { blockInfo = null; blockRotations = null; fastScaffoldKeepY = firstKeepYPlace = rotateForward = rotatingForward = floatStarted = floatJumped = floatWasEnabled = towerEdge = - was451 = was452 = lastAir = enabledOffGround = false; - rotationDelay = keepYTicks = scaffoldTicks = speedEdge = 0; + was451 = was452 = enabledOffGround = finishProcedure = canPlace = false; + rotationDelay = keepYTicks = scaffoldTicks = 0; firstStroke = 0; startYPos = -1; lookVec = null; - set3 = false; + lastPlacement = null; } } } - @SubscribeEvent - public void onReceivePacket(ReceivePacketEvent e) { - if (!isEnabled) { - return; - } - if (!Utils.nullCheck() || !cancelKnockBack.isToggled()) { - return; - } - if (e.getPacket() instanceof S12PacketEntityVelocity) { - if (((S12PacketEntityVelocity) e.getPacket()).getEntityID() == mc.thePlayer.getEntityId()) { - e.setCanceled(true); - } - } - else if (e.getPacket() instanceof S27PacketExplosion) { - e.setCanceled(true); - } - } - @Override public String getInfo() { String info; @@ -781,7 +752,7 @@ public class Scaffold extends Module { return sprint.getInput() == 2 && Utils.isMoving() && !usingFastScaffold(); } - private boolean usingFastScaffold() { + public boolean usingFastScaffold() { return fastScaffold.getInput() > 0 && (!fastOnRMB.isToggled() || (Mouse.isButtonDown(1) || ModuleManager.bhop.isEnabled()) && Utils.tabbedIn()); } @@ -814,6 +785,9 @@ public class Scaffold extends Module { } public boolean canSafewalk() { + if (!safeWalk.isToggled()) { + return false; + } if (usingFastScaffold()) { return false; } @@ -859,6 +833,7 @@ public class Scaffold extends Module { if (blockInfo == null) { return; } + lastPlacement = blockInfo; place(blockInfo); blockInfo = null; } @@ -914,98 +889,60 @@ public class Scaffold extends Module { return 0; } - /*private List findBlocks(int yOffset, int xOffset) { - List possibleBlocks = new ArrayList<>(); - int x = (int) Math.floor(mc.thePlayer.posX + xOffset); - int y = (int) Math.floor(((startYPos != -1) ? startYPos : (mc.thePlayer.posY)) + yOffset); - int z = (int) Math.floor(mc.thePlayer.posZ); - - BlockPos pos = new BlockPos(x, y - 1, z); - - for (int lastCheck = 0; lastCheck < 2; lastCheck++) { - for (int i = 0; i < offsets.length; i++) { - BlockPos newPos = pos.add(offsets[i]); - Block block = BlockUtils.getBlock(newPos); - if (lastCheck == 0) { - continue; - } - if (!block.getMaterial().isReplaceable() && !BlockUtils.isInteractable(block)) { - possibleBlocks.add(new PlaceData(facings[i], newPos)); - } - } - } - BlockPos[] additionalOffsets = { // adjust these for perfect placement - pos.add(-1, 0, 0), - pos.add(1, 0, 0), - pos.add(0, 0, 1), - pos.add(0, 0, -1), - pos.add(0, -1, 0), - - pos.add(-2, 0, 0), - pos.add(2, 0, 0), - pos.add(0, 0, 2), - pos.add(0, 0, -2), - pos.add(0, -2, 0), - - pos.add(-3, 0, 0), - pos.add(3, 0, 0), - pos.add(0, 0, 3), - pos.add(0, 0, -3), - pos.add(0, -3, 0), - }; - for (int lastCheck = 0; lastCheck < 2; lastCheck++) { - for (BlockPos additionalPos : additionalOffsets) { - for (int i = 0; i < offsets.length; i++) { - BlockPos newPos = additionalPos.add(offsets[i]); - Block block = BlockUtils.getBlock(newPos); - if (lastCheck == 0) { - continue; - } - if (!block.getMaterial().isReplaceable() && !BlockUtils.isInteractable(block)) { - possibleBlocks.add(new PlaceData(facings[i], newPos)); - } - } - } - } - BlockPos[] additionalOffsets2 = { // adjust these for perfect placement - new BlockPos(-1, 0, 0), - new BlockPos(1, 0, 0), - new BlockPos(0, 0, 1), - new BlockPos(0, 0, -1), - new BlockPos(0, -1, 0), - - new BlockPos(-2, 0, 0), - new BlockPos(2, 0, 0), - new BlockPos(0, 0, 2), - new BlockPos(0, 0, -2), - new BlockPos(0, -2, 0), - - new BlockPos(-3, 0, 0), - new BlockPos(3, 0, 0), - new BlockPos(0, 0, 3), - new BlockPos(0, 0, -3), - new BlockPos(0, -3, 0), - }; - for (int lastCheck = 0; lastCheck < 2; lastCheck++) { - for (BlockPos additionalPos2 : additionalOffsets2) { - for (BlockPos additionalPos : additionalOffsets) { - for (int i = 0; i < offsets.length; i++) { - BlockPos newPos = additionalPos2.add(additionalPos.add(offsets[i])); - Block block = BlockUtils.getBlock(newPos); - if (lastCheck == 0) { - continue; - } - if (!block.getMaterial().isReplaceable() && !BlockUtils.isInteractable(block)) { - possibleBlocks.add(new PlaceData(facings[i], newPos)); - } - } - } - } - } - return possibleBlocks.isEmpty() ? null : possibleBlocks; - }*/ - private List findBlocks(int yOffset, int xOffset) { + int x = (int) Math.floor(mc.thePlayer.posX + xOffset); + int y = (int) Math.floor(((startYPos != -1) ? startYPos : mc.thePlayer.posY) + yOffset); + int z = (int) Math.floor(mc.thePlayer.posZ); + BlockPos base = new BlockPos(x, y - 1, z); + if (!BlockUtils.replaceable(base)) { + return null; + } + EnumFacing[] allFacings = EnumFacing.values(); + List validFacings = new ArrayList<>(5); + for (EnumFacing facing : allFacings) { + if (facing != EnumFacing.UP && placeConditions(facing, yOffset, xOffset)) { + validFacings.add(facing); + } + } + int maxLayer = 4; + List possibleBlocks = new ArrayList<>(); + + main: + for (int dy = 1; dy <= maxLayer; dy++) { + BlockPos layerBase = new BlockPos(x, y - dy, z); + if (dy == 1) { + for (EnumFacing facing : validFacings) { + BlockPos neighbor = layerBase.offset(facing); + if (!BlockUtils.replaceable(neighbor) && !BlockUtils.isInteractable(BlockUtils.getBlock(neighbor))) { + if (lastPlacement != null && neighbor.equals(lastPlacement.blockPos)) { + possibleBlocks.add(new PlaceData(neighbor, facing.getOpposite())); + break main; + } + possibleBlocks.add(new PlaceData(neighbor, facing.getOpposite())); + } + } + } + for (EnumFacing facing : validFacings) { + BlockPos adjacent = layerBase.offset(facing); + if (BlockUtils.replaceable(adjacent)) { + for (EnumFacing nestedFacing : validFacings) { + BlockPos nestedNeighbor = adjacent.offset(nestedFacing); + if (!BlockUtils.replaceable(nestedNeighbor) && !BlockUtils.isInteractable(BlockUtils.getBlock(nestedNeighbor))) { + if (lastPlacement != null && nestedNeighbor.equals(lastPlacement.blockPos)) { + possibleBlocks.add(new PlaceData(nestedNeighbor, facing.getOpposite())); + break main; + } + possibleBlocks.add(new PlaceData(nestedNeighbor, nestedFacing.getOpposite())); + } + } + } + } + } + + return possibleBlocks.isEmpty() ? null : possibleBlocks; + } + + /*private List findBlocks(int yOffset, int xOffset) { List possibleBlocks = new ArrayList<>(); int x = (int) Math.floor(mc.thePlayer.posX + xOffset); int y = (int) Math.floor(((startYPos != -1) ? startYPos : (mc.thePlayer.posY)) + yOffset); @@ -1072,7 +1009,7 @@ public class Scaffold extends Module { return null; } return possibleBlocks.isEmpty() ? null : possibleBlocks; - } + }*/ private boolean placeConditions(EnumFacing enumFacing, int yCondition, int xCondition) { if (xCondition == -1) { @@ -1246,11 +1183,12 @@ public class Scaffold extends Module { if (autoSwap.isToggled() && blockSlot != -1) { if (ModuleManager.autoSwap.swapToGreaterStack.isToggled()) { mc.thePlayer.inventory.currentItem = slot; + spoofSlot = slot; } else { mc.thePlayer.inventory.currentItem = blockSlot; + spoofSlot = blockSlot; } - //Utils.print("set slot?"); } ItemStack heldItem = mc.thePlayer.getHeldItem(); diff --git a/src/main/java/keystrokesmod/module/impl/player/Tower.java b/src/main/java/keystrokesmod/module/impl/player/Tower.java index 0b4870e..1422cdc 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Tower.java +++ b/src/main/java/keystrokesmod/module/impl/player/Tower.java @@ -1,18 +1,18 @@ package keystrokesmod.module.impl.player; -import keystrokesmod.event.PostPlayerInputEvent; -import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.PreUpdateEvent; -import keystrokesmod.event.SendPacketEvent; +import keystrokesmod.event.*; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.GroupSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.ModuleUtils; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; import net.minecraft.client.settings.KeyBinding; import net.minecraft.network.play.client.*; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S27PacketExplosion; import net.minecraft.potion.PotionEffect; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -23,8 +23,11 @@ public class Tower extends Module { final private SliderSetting slowedSpeed; final private SliderSetting slowedTicks; final private ButtonSetting disableWhileHurt; + private GroupSetting cancelKnockbackGroup; + private final ButtonSetting cancelKnockback; + private ButtonSetting cancelVelocityRequired; - final private String[] towerMoveModes = new String[]{"None", "Vanilla", "Low", "Edge", "2.5 tick", "1.5 tick", "Test"}; + final private String[] towerMoveModes = new String[]{"None", "Vanilla", "Low", "Edge", "2.5 tick", "1.5 tick", "1 tick"}; final private String[] verticalTowerModes = new String[]{"None", "Vanilla", "Extra block"}; private int slowTicks; private boolean wasTowering; @@ -55,10 +58,28 @@ public class Tower extends Module { this.registerSetting(slowedSpeed = new SliderSetting("Slowed speed", "%", 0, 0, 100, 1)); this.registerSetting(slowedTicks = new SliderSetting("Slowed ticks", 1, 0, 20, 1)); this.registerSetting(disableWhileHurt = new ButtonSetting("Disable while hurt", false)); + this.registerSetting(cancelKnockbackGroup = new GroupSetting("Cancel knockback")); + this.registerSetting(cancelKnockback = new ButtonSetting(cancelKnockbackGroup, "Enable Cancel knockback", false)); + this.registerSetting(cancelVelocityRequired = new ButtonSetting(cancelKnockbackGroup, "Require velocity enabled", false)); this.canBeEnabled = false; } + @SubscribeEvent + public void onReceivePacket(ReceivePacketEvent e) { + if (!Utils.nullCheck() || !cancelKnockback()) { + return; + } + if (e.getPacket() instanceof S12PacketEntityVelocity) { + if (((S12PacketEntityVelocity) e.getPacket()).getEntityID() == mc.thePlayer.getEntityId()) { + e.setCanceled(true); + } + } + else if (e.getPacket() instanceof S27PacketExplosion) { + e.setCanceled(true); + } + } + @SubscribeEvent public void onPreMotion(PreMotionEvent e) { if (canTower() && Utils.keysDown()) { @@ -263,10 +284,10 @@ public class Tower extends Module { Utils.setSpeed(Utils.getHorizontalSpeed()); // Strafe tick break; case 2: - mc.thePlayer.motionY = 1 - mc.thePlayer.posY % 1f + 0.0000001; + mc.thePlayer.motionY = 1 - mc.thePlayer.posY % 1f; break; case 3: - mc.thePlayer.motionY = -0.01; + mc.thePlayer.motionY = 0.005; break; } } @@ -294,7 +315,7 @@ public class Tower extends Module { slowTicks = 0; } if (speed) { - Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer) / 1.6); + Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer) / 2); } hasTowered = tower = firstJump = startedTowerInAir = setLowMotion = speed = false; cMotionTicks = placeTicks = towerTicks = grounds = 0; @@ -412,6 +433,19 @@ public class Tower extends Module { setLowMotion = false; } + public boolean cancelKnockback() { + if (!canTower()) { + return false; + } + if (cancelVelocityRequired.isToggled() && !ModuleManager.velocity.isEnabled()) { + return false; + } + if (cancelKnockback.isToggled()) { + return true; + } + return false; + } + public boolean canTower() { if (!Utils.nullCheck() || !Utils.jumpDown() || !Utils.tabbedIn()) { return false; diff --git a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java index 0d8c9bc..9cbcbb6 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java +++ b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java @@ -113,4 +113,4 @@ public class BreakProgress extends Module { this.block = null; this.progressStr = ""; } -} \ No newline at end of file +} diff --git a/src/main/java/keystrokesmod/module/impl/render/Nametags.java b/src/main/java/keystrokesmod/module/impl/render/Nametags.java index e764f27..4f51cbb 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Nametags.java +++ b/src/main/java/keystrokesmod/module/impl/render/Nametags.java @@ -8,6 +8,7 @@ import keystrokesmod.module.impl.minigames.SkyWars; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.module.setting.impl.GroupSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.RenderUtils; import keystrokesmod.utility.Utils; @@ -36,10 +37,12 @@ public class Nametags extends Module { private ButtonSetting showInvis; private ButtonSetting removeTags; private ButtonSetting renderSelf; + private GroupSetting armorSettings; private ButtonSetting showArmor; private ButtonSetting showEnchants; private ButtonSetting showDurability; private ButtonSetting showStackSize; + private ButtonSetting outlineFSE; private int backGroundColor = new Color(0, 0, 0, 100).getRGB(); private int friendColor = new Color(0, 255, 0, 255).getRGB(); @@ -60,11 +63,12 @@ public class Nametags extends Module { this.registerSetting(showHitsToKill = new ButtonSetting("Show hits to kill", false)); this.registerSetting(showInvis = new ButtonSetting("Show invis", true)); this.registerSetting(removeTags = new ButtonSetting("Remove tags", false)); - this.registerSetting(new DescriptionSetting("Armor settings")); - this.registerSetting(showArmor = new ButtonSetting("Show armor", false)); - this.registerSetting(showEnchants = new ButtonSetting("Show enchants", true)); - this.registerSetting(showDurability = new ButtonSetting("Show durability", true)); - this.registerSetting(showStackSize = new ButtonSetting("Show stack size", true)); + this.registerSetting(armorSettings = new GroupSetting("Armor settings")); + this.registerSetting(showArmor = new ButtonSetting(armorSettings, "Show armor", false)); + this.registerSetting(showEnchants = new ButtonSetting(armorSettings, "Show enchants", true)); + this.registerSetting(showDurability = new ButtonSetting(armorSettings, "Show durability", true)); + this.registerSetting(showStackSize = new ButtonSetting(armorSettings, "Show stack size", true)); + this.registerSetting(outlineFSE = new ButtonSetting("Outline friends/enemies", true)); } @SubscribeEvent(priority = EventPriority.LOWEST) @@ -205,11 +209,12 @@ public class Nametags extends Module { if (drawBackground.isToggled()) { RenderUtils.drawRect(x1, y1, x2, y2, backGroundColor); } - if (Utils.isFriended(en)) { - RenderUtils.drawOutline(x1, y1, x2, y2, 2, friendColor); - } - else if (Utils.isEnemy(en)) { - RenderUtils.drawOutline(x1, y1, x2, y2, 2, enemyColor); + if (outlineFSE.isToggled()) { + if (Utils.isFriended(en)) { + RenderUtils.drawOutline(x1, y1, x2, y2, 2, friendColor); + } else if (Utils.isEnemy(en)) { + RenderUtils.drawOutline(x1, y1, x2, y2, 2, enemyColor); + } } mc.fontRendererObj.drawString(name, -strWidth, -9, -1, dropShadow.isToggled()); if (showArmor.isToggled()) { diff --git a/src/main/java/keystrokesmod/utility/ModuleUtils.java b/src/main/java/keystrokesmod/utility/ModuleUtils.java index 907d925..6149152 100644 --- a/src/main/java/keystrokesmod/utility/ModuleUtils.java +++ b/src/main/java/keystrokesmod/utility/ModuleUtils.java @@ -2,6 +2,7 @@ package keystrokesmod.utility; import keystrokesmod.event.*; import keystrokesmod.module.impl.combat.Velocity; +import keystrokesmod.module.impl.movement.Bhop; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.impl.render.HUD; import keystrokesmod.utility.command.CommandManager; @@ -46,7 +47,7 @@ public class ModuleUtils { public static boolean isAttacking; private int attackingTicks; private int unTargetTicks; - public static int profileTicks = -1; + public static int profileTicks = -1, swapTick; public static boolean lastTickOnGround, lastTickPos1; private boolean thisTickOnGround, thisTickPos1; public static boolean firstDamage; @@ -60,6 +61,7 @@ public class ModuleUtils { private int edgeTick; public static boolean canSlow, didSlow, setSlow; + private static boolean allowFriction; @SubscribeEvent public void onWorldJoin(EntityJoinWorldEvent e) { @@ -74,6 +76,10 @@ public class ModuleUtils { return; } + if (e.getPacket() instanceof C09PacketHeldItemChange) { + swapTick = 2; + } + // isBlocked EntityLivingBase g = Utils.raytrace(3); @@ -138,6 +144,10 @@ public class ModuleUtils { // + if (e.getPacket() instanceof C09PacketHeldItemChange) { + swapTick = 2; + } + @@ -159,111 +169,6 @@ public class ModuleUtils { } - @SubscribeEvent - public void onPreUpdate(PreUpdateEvent e) { - - if (damage && ++damageTicks >= 8) { - damage = firstDamage = false; - damageTicks = 0; - } - - profileTicks++; - - if (isAttacking) { - if (attackingTicks <= 0) { - isAttacking = false; - } - else { - --attackingTicks; - } - } - - if (LongJump.slotReset && ++LongJump.slotResetTicks >= 2) { - LongJump.stopModules = false; - LongJump.slotResetTicks = 0; - LongJump.slotReset = false; - } - - if (fireballTime > 0 && (System.currentTimeMillis() - fireballTime) > FIREBALL_TIMEOUT / 3) { - threwFireballLow = false; - ModuleManager.velocity.disableVelo = false; - } - - if (fireballTime > 0 && (System.currentTimeMillis() - fireballTime) > FIREBALL_TIMEOUT) { - threwFireball = threwFireballLow = false; - fireballTime = 0; - ModuleManager.velocity.disableVelo = false; - } - - if (isBreaking && ++isBreakingTick >= 1) { - isBreaking = false; - isBreakingTick = 0; - } - - if (ModuleManager.killAura.justUnTargeted) { - if (++unTargetTicks >= 2) { - unTargetTicks = 0; - ModuleManager.killAura.justUnTargeted = false; - } - } - - if (CommandManager.status.cooldown != 0) { - if (mc.thePlayer.ticksExisted % 20 == 0) { - CommandManager.status.cooldown--; - } - } - } - - @SubscribeEvent - public void onChat(ClientChatReceivedEvent e) { - if (!Utils.nullCheck()) { - return; - } - String stripped = Utils.stripColor(e.message.getUnformattedText()); - - //online - if (stripped.contains("You tipped ") && stripped.contains(" in") && stripped.contains("!") && CommandManager.status.start) { - CommandManager.status.start = false; - Utils.print("§a " + CommandManager.status.ign + " is online"); - e.setCanceled(true); - } - if ((stripped.contains("You've already tipped someone in the past hour in") && stripped.contains("! Wait a bit and try again!") || stripped.contains("You've already tipped that person today in ")) && CommandManager.status.start) { - CommandManager.status.start = false; - Utils.print("§a " + CommandManager.status.ign + " is online"); - //client.print(util.colorSymbol + "7^ if player recently left the server this may be innacurate (rate limited)"); - e.setCanceled(true); - } - //offline - if (stripped.contains("That player is not online, try another user!") && CommandManager.status.start) { - CommandManager.status.start = false; - Utils.print("§7 " + CommandManager.status.ign + " is offline"); - e.setCanceled(true); - } - //invalid name - if (stripped.contains("Can't find a player by the name of '") && CommandManager.status.start) { - CommandManager.status.cooldown = 0; - CommandManager.status.start = false; - CommandManager.status.currentMode = CommandManager.status.lastMode; - Utils.print("§7 " + CommandManager.status.ign + " doesn't exist"); - e.setCanceled(true); - } - if (stripped.contains("That's not a valid username!") && CommandManager.status.start) { - CommandManager.status.cooldown = 0; - CommandManager.status.start = false; - CommandManager.status.currentMode = CommandManager.status.lastMode; - Utils.print("§binvalid username"); - e.setCanceled(true); - } - //checking urself - if (stripped.contains("You cannot give yourself tips!") && CommandManager.status.start) { - CommandManager.status.cooldown = 0; - CommandManager.status.start = false; - CommandManager.status.currentMode = CommandManager.status.lastMode; - Utils.print("§a " + CommandManager.status.ign + " is online"); - e.setCanceled(true); - } - } - @SubscribeEvent public void onReceivePacket(ReceivePacketEvent e) { if (!Utils.nullCheck()) { @@ -316,6 +221,89 @@ public class ModuleUtils { return false; } + @SubscribeEvent + public void onPreUpdate(PreUpdateEvent e) { + + if (swapTick > 0) { + --swapTick; + } + + if ((canSlow || ModuleManager.scaffold.moduleEnabled && !ModuleManager.tower.canTower()) && !mc.thePlayer.onGround) { + double motionVal = 0.9507832 - ((double) inAirTicks / 10000) - Utils.randomizeDouble(0.00001, 0.00006); + if (mc.thePlayer.hurtTime == 0 && inAirTicks >= 4 && !setSlow) { + mc.thePlayer.motionX *= motionVal; + mc.thePlayer.motionZ *= motionVal; + setSlow = true; + //Utils.print("Slow " + motionVal); + } + didSlow = true; + } + else if (didSlow) { + canSlow = didSlow = false; + } + if (mc.thePlayer.onGround || mc.thePlayer.hurtTime != 0) { + setSlow = false; + } + + if (!ModuleManager.bhop.running && !ModuleManager.scaffold.fastScaffoldKeepY) { + allowFriction = false; + } + else if (!mc.thePlayer.onGround) { + allowFriction = true; + } + + if (damage && ++damageTicks >= 8) { + damage = firstDamage = false; + damageTicks = 0; + } + + profileTicks++; + + if (isAttacking) { + if (attackingTicks <= 0) { + isAttacking = false; + } + else { + --attackingTicks; + } + } + + if (LongJump.slotReset && ++LongJump.slotResetTicks >= 2) { + LongJump.stopModules = false; + LongJump.slotResetTicks = 0; + LongJump.slotReset = false; + } + + if (fireballTime > 0 && (System.currentTimeMillis() - fireballTime) > FIREBALL_TIMEOUT / 3) { + threwFireballLow = false; + ModuleManager.velocity.disableVelo = false; + } + + if (fireballTime > 0 && (System.currentTimeMillis() - fireballTime) > FIREBALL_TIMEOUT) { + threwFireball = threwFireballLow = false; + fireballTime = 0; + ModuleManager.velocity.disableVelo = false; + } + + if (isBreaking && ++isBreakingTick >= 1) { + isBreaking = false; + isBreakingTick = 0; + } + + if (ModuleManager.killAura.justUnTargeted) { + if (++unTargetTicks >= 2) { + unTargetTicks = 0; + ModuleManager.killAura.justUnTargeted = false; + } + } + + if (CommandManager.status.cooldown != 0) { + if (mc.thePlayer.ticksExisted % 20 == 0) { + CommandManager.status.cooldown--; + } + } + } + @SubscribeEvent public void onPreMotion(PreMotionEvent e) { int simpleY = (int) Math.round((e.posY % 1) * 10000); @@ -458,23 +446,6 @@ public class ModuleUtils { fadeEdge = 0; ModuleManager.scaffold.highlight.clear(); } - - if ((canSlow || ModuleManager.scaffold.moduleEnabled && !ModuleManager.tower.canTower()) && !mc.thePlayer.onGround) { - double motionVal = 0.92 - ((double) inAirTicks / 10000) - Utils.randomizeDouble(0.00001, 0.00006); - if (mc.thePlayer.hurtTime == 0 && inAirTicks > 4 && !setSlow) { - mc.thePlayer.motionX *= motionVal; - mc.thePlayer.motionZ *= motionVal; - setSlow = true; - //Utils.print("Slow " + motionVal); - } - didSlow = true; - } - else if (didSlow) { - canSlow = didSlow = false; - } - if (mc.thePlayer.onGround) { - setSlow = false; - } } private void resetLowhop() { @@ -489,6 +460,14 @@ public class ModuleUtils { canSlow = true; } + public static double applyFrictionMulti() { + final int speedAmplifier = Utils.getSpeedAmplifier(); + if (speedAmplifier > 1 && allowFriction) { + return Bhop.friction.getInput(); + } + return 1; + } + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderWorld(RenderWorldLastEvent e) { if (!ModuleManager.scaffold.canBlockFade) { @@ -512,4 +491,54 @@ public class ModuleUtils { RenderUtils.renderBlock(entry.getKey(), Utils.mergeAlpha(Theme.getGradient((int) HUD.theme.getInput(), 0), alpha), true, false); } } + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent e) { + if (!Utils.nullCheck()) { + return; + } + String stripped = Utils.stripColor(e.message.getUnformattedText()); + + //online + if (stripped.contains("You tipped ") && stripped.contains(" in") && stripped.contains("!") && CommandManager.status.start) { + CommandManager.status.start = false; + Utils.print("§a " + CommandManager.status.ign + " is online"); + e.setCanceled(true); + } + if ((stripped.contains("You've already tipped someone in the past hour in") && stripped.contains("! Wait a bit and try again!") || stripped.contains("You've already tipped that person today in ")) && CommandManager.status.start) { + CommandManager.status.start = false; + Utils.print("§a " + CommandManager.status.ign + " is online"); + //client.print(util.colorSymbol + "7^ if player recently left the server this may be innacurate (rate limited)"); + e.setCanceled(true); + } + //offline + if (stripped.contains("That player is not online, try another user!") && CommandManager.status.start) { + CommandManager.status.start = false; + Utils.print("§7 " + CommandManager.status.ign + " is offline"); + e.setCanceled(true); + } + //invalid name + if (stripped.contains("Can't find a player by the name of '") && CommandManager.status.start) { + CommandManager.status.cooldown = 0; + CommandManager.status.start = false; + CommandManager.status.currentMode = CommandManager.status.lastMode; + Utils.print("§7 " + CommandManager.status.ign + " doesn't exist"); + e.setCanceled(true); + } + if (stripped.contains("That's not a valid username!") && CommandManager.status.start) { + CommandManager.status.cooldown = 0; + CommandManager.status.start = false; + CommandManager.status.currentMode = CommandManager.status.lastMode; + Utils.print("§binvalid username"); + e.setCanceled(true); + } + //checking urself + if (stripped.contains("You cannot give yourself tips!") && CommandManager.status.start) { + CommandManager.status.cooldown = 0; + CommandManager.status.start = false; + CommandManager.status.currentMode = CommandManager.status.lastMode; + Utils.print("§a " + CommandManager.status.ign + " is online"); + e.setCanceled(true); + } + } } \ No newline at end of file diff --git a/src/main/resources/mixins.raven.json b/src/main/resources/mixins.raven.json index 458089a..d40f54c 100644 --- a/src/main/resources/mixins.raven.json +++ b/src/main/resources/mixins.raven.json @@ -25,6 +25,7 @@ "network.MixinNetHandlerPlayClient", "render.MixinRenderManager", "render.MixinCustomSky", + "render.MixinRenderPlayer", "client.MixinPlayerControllerMP", "accessor.IAccessorEntityPlayerSP",