From 81f835f08ddc2d5c69d3199ccb93e52f5719c4ae Mon Sep 17 00:00:00 2001 From: jackh Date: Sun, 16 Feb 2025 10:02:13 -0700 Subject: [PATCH] t --- .../keystrokesmod/module/ModuleManager.java | 2 + .../module/impl/combat/KillAura.java | 4 +- .../module/impl/movement/Bhop.java | 57 ++++++++++----- .../module/impl/movement/LongJump.java | 4 +- .../module/impl/movement/Sprint.java | 2 +- .../module/impl/movement/TargetStrafe.java | 73 +++++++++++++++++++ .../module/impl/player/Disabler.java | 2 - .../module/impl/player/Safewalk.java | 52 ++++++------- .../module/impl/player/Scaffold.java | 28 ++++--- .../module/impl/player/Tower.java | 44 ++++++++++- .../module/impl/render/TargetHUD.java | 4 +- .../keystrokesmod/utility/ModuleUtils.java | 53 ++++++++++---- .../java/keystrokesmod/utility/Utils.java | 18 ++++- 13 files changed, 257 insertions(+), 86 deletions(-) create mode 100644 src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java diff --git a/src/main/java/keystrokesmod/module/ModuleManager.java b/src/main/java/keystrokesmod/module/ModuleManager.java index 82fbdbd..c3b91b7 100644 --- a/src/main/java/keystrokesmod/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/module/ModuleManager.java @@ -73,6 +73,7 @@ public class ModuleManager { public static CTWFly ctwFly; public static Blink blink; public static Velocity velocity; + public static TargetStrafe targetStrafe; public void register() { this.addModule(autoClicker = new AutoClicker()); @@ -171,6 +172,7 @@ public class ModuleManager { this.addModule(new Gui()); this.addModule(new Shaders()); this.addModule(ctwFly = new CTWFly()); + this.addModule(targetStrafe = new TargetStrafe()); antiBot.enable(); Collections.sort(this.modules, Comparator.comparing(Module::getName)); } diff --git a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java index 5804768..87eea0f 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java +++ b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java @@ -965,7 +965,7 @@ public class KillAura extends Module { if (interactTicks == 0) { firstEdge++; } - if (firstEdge > 10) { + if (firstEdge > 6) { firstEdge = 0; } interactTicks++; @@ -985,7 +985,7 @@ public class KillAura extends Module { lag = true; break; case 3: - if (firstEdge == 3 || firstEdge == 6) { + if (firstEdge == 2 || firstEdge == 5) { firstCycle = false; } interactTicks = 0; diff --git a/src/main/java/keystrokesmod/module/impl/movement/Bhop.java b/src/main/java/keystrokesmod/module/impl/movement/Bhop.java index 0e9c314..0841939 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Bhop.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Bhop.java @@ -22,12 +22,14 @@ public class Bhop extends Module { public ButtonSetting disablerOnly; private ButtonSetting sneakDisable; private ButtonSetting jumpMoving; - public ButtonSetting rotateYawOption, damageBoost, airStrafe, damageBoostRequireKey; - public GroupSetting damageBoostGroup; + public ButtonSetting rotateYawOption, damageBoost, strafe, damageBoostRequireKey; + public GroupSetting damageBoostGroup, strafeGroup; + private SliderSetting strafeDegrees; public KeySetting damageBoostKey; public String[] modes = new String[]{"Strafe", "Ground", "9 tick", "8 tick", "7 tick"}; public boolean hopping, lowhop, didMove, setRotation; private int motionTick = 0; + public boolean isNormalPos; public Bhop() { super("Bhop", Module.category.movement); @@ -38,10 +40,15 @@ public class Bhop extends Module { this.registerSetting(sneakDisable = new ButtonSetting("Disable while sneaking", true)); this.registerSetting(jumpMoving = new ButtonSetting("Only jump when moving", true)); this.registerSetting(rotateYawOption = new ButtonSetting("Rotate yaw", false)); + this.registerSetting(damageBoostGroup = new GroupSetting("Damage boost")); - this.registerSetting(damageBoost = new ButtonSetting(damageBoostGroup, "Enable", false)); + this.registerSetting(damageBoost = new ButtonSetting(damageBoostGroup, "Enable Damage boost", false)); this.registerSetting(damageBoostRequireKey = new ButtonSetting(damageBoostGroup,"Require key", false)); this.registerSetting(damageBoostKey = new KeySetting(damageBoostGroup,"Enable key", 51)); + + this.registerSetting(strafeGroup = new GroupSetting("Direction strafe")); + this.registerSetting(strafe = new ButtonSetting(strafeGroup, "Enable Direction strafe", false)); + this.registerSetting(strafeDegrees = new SliderSetting(strafeGroup, "Degrees", 80, 50, 90, 5)); } public void guiUpdate() { @@ -83,7 +90,18 @@ public class Bhop extends Module { if (mc.thePlayer.moveForward <= -0.5 && mc.thePlayer.moveStrafing == 0 && !ModuleManager.killAura.isTargeting && !Utils.noSlowingBackWithBow() && !ModuleManager.scaffold.isEnabled && !mc.thePlayer.isCollidedHorizontally) { setRotation = true; } - mc.thePlayer.jump(); + if (mode.getInput() != 3) { + mc.thePlayer.jump(); + } + else { + mc.thePlayer.motionY = 0.41999998688698; + } + if (mc.thePlayer.posY % 1 == 0) { + isNormalPos = true; + } + else { + isNormalPos = false; + } double speed = (speedSetting.getInput() - 0.52); double speedModifier = speed; final int speedAmplifier = Utils.getSpeedAmplifier(); @@ -99,8 +117,10 @@ public class Bhop extends Module { break; } - if (Utils.isMoving() && !Utils.noSlowingBackWithBow() && !ModuleManager.sprint.disableBackwards()) { - Utils.setSpeed(speedModifier - Utils.randomizeDouble(0.0003, 0.0001)); + if (Utils.isMoving()) { + if (!Utils.noSlowingBackWithBow() && !ModuleManager.sprint.disableBackwards()) { + Utils.setSpeed(speedModifier - Utils.randomizeDouble(0.0003, 0.0001)); + } didMove = true; } hopping = true; @@ -135,9 +155,9 @@ public class Bhop extends Module { } }*/ - //if (airStrafe.isToggled()) { - //airStrafe(); - //} + if (strafe.isToggled()) { + airStrafe(); + } } @@ -157,20 +177,21 @@ public class Bhop extends Module { return simpleYaw; } - void airStrafe() { - if (!mc.thePlayer.onGround && mc.thePlayer.hurtTime < 3 && Utils.isMoving()) { - float moveDirection = moveDirection(Utils.getLastReportedYaw()); - float strafeDirection = strafeDirection(); - float diff = Math.abs(moveDirection - strafeDirection); - int range = 70; + private void airStrafe() { + if (!mc.thePlayer.onGround && mc.thePlayer.hurtTime < 3 && (mc.thePlayer.motionX != 0 || mc.thePlayer.motionZ != 0)) { + float moveDir = moveDirection(mc.thePlayer.rotationYaw); + float currentMotionDir = strafeDirection(); + float diff = Math.abs(moveDir - currentMotionDir); + int range = (int) strafeDegrees.getInput(); if (diff > 180 - range && diff < 180 + range) { - Utils.setSpeed(Utils.getHorizontalSpeed() * Utils.randomizeDouble(0.831, 0.8405)); + mc.thePlayer.motionX = -(mc.thePlayer.motionX * 0.85); + mc.thePlayer.motionZ = -(mc.thePlayer.motionZ * 0.85); } } } - float moveDirection(float rawYaw) { + private float moveDirection(float rawYaw) { float yaw = ((rawYaw % 360) + 360) % 360 > 180 ? ((rawYaw % 360) + 360) % 360 - 360 : ((rawYaw % 360) + 360) % 360; float forward = 1; @@ -184,7 +205,7 @@ public class Bhop extends Module { return (float) (yaw); } - float strafeDirection() { + private float strafeDirection() { float yaw = (float) Math.toDegrees(Math.atan2(-mc.thePlayer.motionX, mc.thePlayer.motionZ)); if (yaw < 0) yaw += 360; return yaw; diff --git a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java index 82d30ae..8d0b0a3 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java @@ -107,8 +107,8 @@ public class LongJump extends Module { return; } if (!manual.isToggled()) { - if (mc.thePlayer.getHealth() <= 3) { - Utils.print("&7[&dR&7] &cPrevented throwing fireball due to low health"); + if (Utils.getTotalHealth(mc.thePlayer) <= 3) { + Utils.sendMessage("&cPrevented throwing fireball due to low health"); disable(); return; } diff --git a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java index 64e60dd..dc6ea05 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java @@ -177,7 +177,7 @@ public class Sprint extends Module { if ((limit <= -limitVal || limit >= limitVal)) { return true; } - if ((omniSprint() || ModuleManager.bhop.isEnabled()) && ModuleManager.killAura.isTargeting && mc.thePlayer.moveForward <= 0.5) { + if (omniSprint() && ModuleManager.killAura.isTargeting && mc.thePlayer.moveForward <= 0.5) { return true; } return false; diff --git a/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java new file mode 100644 index 0000000..433b9b3 --- /dev/null +++ b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java @@ -0,0 +1,73 @@ +package keystrokesmod.module.impl.movement; + +import keystrokesmod.event.PostPlayerInputEvent; +import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.event.PrePlayerInputEvent; +import keystrokesmod.module.Module; +import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.impl.combat.KillAura; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.GroupSetting; +import keystrokesmod.module.setting.impl.KeySetting; +import keystrokesmod.module.setting.impl.SliderSetting; +import keystrokesmod.utility.ModuleUtils; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Utils; +import net.minecraft.entity.EntityLivingBase; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class TargetStrafe extends Module { + private ButtonSetting bhopOnly; + + private double angle; + private float radius = 0.6f; + + public TargetStrafe() { + super("TargetStrafe", category.movement); + this.registerSetting(bhopOnly = new ButtonSetting("Require bhop", false)); + } + + public void guiUpdate() { + + } + + /*@Override + public String getInfo() { + return modes[(int) mode.getInput()]; + }*/ + + @SubscribeEvent(priority = EventPriority.LOWEST) // called last in order to apply fix + public void onMoveInput(PrePlayerInputEvent e) { + if (bhopOnly.isToggled() && !ModuleManager.bhop.isEnabled()) { + return; + } + if (ModuleManager.scaffold.isEnabled) { + return; + } + if (KillAura.target == null) { + return; + } + EntityLivingBase targetPosition = KillAura.target; + angle += 1; + + double offsetX = radius * Math.cos(angle); + double offsetZ = radius * Math.sin(angle); + double directionX = targetPosition.getPosition().getX() + offsetX - mc.thePlayer.posX; + double directionZ = targetPosition.getPosition().getZ() + offsetZ - mc.thePlayer.posZ; + double magnitude = Math.sqrt(directionX * directionX + directionZ * directionZ); + if (magnitude > 0.01) { + directionX /= magnitude; + directionZ /= magnitude; + double yawRadians = Math.toRadians(-mc.thePlayer.rotationYaw); + double rotatedX = directionX * Math.cos(yawRadians) - directionZ * Math.sin(yawRadians); + double rotatedZ = directionX * Math.sin(yawRadians) + directionZ * Math.cos(yawRadians); + e.setStrafe((float) rotatedX); + e.setForward((float) rotatedZ); + } + } + + public void onDisable() { + + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/player/Disabler.java b/src/main/java/keystrokesmod/module/impl/player/Disabler.java index 55a0de5..df61db4 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Disabler.java +++ b/src/main/java/keystrokesmod/module/impl/player/Disabler.java @@ -122,8 +122,6 @@ public class Disabler extends Module { } airTicks = mc.thePlayer.onGround ? 0 : airTicks + 1; - int simpleY = (int) Math.round((e.posY % 1) * 10000); - //Utils.print("" + simpleY); if (airTicks >= 10) { if (!applyingMotion) { applyingMotion = true; diff --git a/src/main/java/keystrokesmod/module/impl/player/Safewalk.java b/src/main/java/keystrokesmod/module/impl/player/Safewalk.java index c61cc13..502bda5 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Safewalk.java +++ b/src/main/java/keystrokesmod/module/impl/player/Safewalk.java @@ -1,5 +1,7 @@ package keystrokesmod.module.impl.player; +import keystrokesmod.event.PostPlayerInputEvent; +import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -8,9 +10,9 @@ import keystrokesmod.utility.Utils; import net.minecraft.client.settings.KeyBinding; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.Vec3; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; public class Safewalk extends Module { @@ -21,6 +23,8 @@ public class Safewalk extends Module { private int unsneakDelayTicks = 0; private boolean isSneaking; + private boolean hasSneaked; + private Vec3 pos; public Safewalk() { super("Safewalk", Module.category.player, 0); @@ -50,37 +54,37 @@ public class Safewalk extends Module { } @SubscribeEvent - public void onTick(TickEvent.PlayerTickEvent e) { - if (e.phase != TickEvent.Phase.END) { - return; - } + 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; } + if (!settingsMet()) { + this.setSneakState(false); + return; + } boolean edge = mc.thePlayer.onGround && Utils.isEdgeOfBlock(); - if (edge) { - if (!settingsMet()) { - this.setSneakState(false); - return; - } + if (edge && !hasSneaked) { if (!this.isSneaking) { - this.setSneakState(true); - unsneakDelayTicks = (int) sneakDelay.getInput(); + hasSneaked = true; + pos = new Vec3((int) mc.thePlayer.posX, (int) mc.thePlayer.posY, (int) mc.thePlayer.posZ); } } else { if (this.isSneaking) { - if (!settingsMet()) { + if (unsneakDelayTicks > 0) { + unsneakDelayTicks--; + } + else if (!current.equals(pos)) { this.setSneakState(false); return; } - if (unsneakDelayTicks > 0) { - unsneakDelayTicks--; - return; - } - this.setSneakState(false); } } + if (hasSneaked) { + this.setSneakState(true); + unsneakDelayTicks = (int) sneakDelay.getInput(); + } if (this.isSneaking && (mc.thePlayer.capabilities.isFlying || !settingsMet())) { this.setSneakState(false); } @@ -97,16 +101,14 @@ public class Safewalk extends Module { if (!sneakState) { unsneakDelayTicks = 0; } - if (this.isSneaking == sneakState) { + if (!sneakState && Utils.isBindDown(mc.gameSettings.keyBindSneak)) { return; } - - if (!sneakState && Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { - return; - } - - KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), sneakState); + hasSneaked = sneakState; + mc.thePlayer.movementInput.sneak = sneakState; this.isSneaking = sneakState; + //Utils.print("Edge " + mc.thePlayer.movementInput.sneak + " " + sneakState + " " + mc.thePlayer.ticksExisted); + } public static boolean canSafeWalk() { diff --git a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java index 4d54f75..b0ae61f 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java @@ -181,9 +181,7 @@ public class Scaffold extends Module { } KeyBinding.setKeyBindState(mc.gameSettings.keyBindAttack.getKeyCode(), false); KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false); - if (e.button >= 0) { - e.setCanceled(true); - } + e.setCanceled(true); } @SubscribeEvent @@ -293,38 +291,38 @@ public class Scaffold extends Module { long strokeDelay = 250; if (quad <= 5 || quad >= 85) { - yawAngle = 128F; + yawAngle = 127.40F; minOffset = 13; - minPitch = 74.08F; + minPitch = 75.48F; } if (quad > 5 && quad <= 15 || quad >= 75 && quad < 85) { - yawAngle = 129F; + yawAngle = 128.55F; minOffset = 11; - minPitch = 74.84F; + minPitch = 75.74F; } if (quad > 15 && quad <= 25 || quad >= 65 && quad < 75) { - yawAngle = 131.50F; + yawAngle = 129.70F; minOffset = 8; - minPitch = 75.35F; + minPitch = 75.95F; } if (quad > 25 && quad <= 32 || quad >= 58 && quad < 65) { - yawAngle = 132.50F; + yawAngle = 130.85F; minOffset = 6; - minPitch = 75.73F; + minPitch = 76.13F; } if (quad > 32 && quad <= 38 || quad >= 52 && quad < 58) { - yawAngle = 133.50F; + yawAngle = 131.80F; minOffset = 5; minPitch = 76.41F; } if (quad > 38 && quad <= 42 || quad >= 48 && quad < 52) { - yawAngle = 135.50F; + yawAngle = 134.30F; minOffset = 4; minPitch = 77.54F; } if (quad > 42 && quad <= 45 || quad >= 45 && quad < 48) { - yawAngle = 137.50F; - minOffset = 4; + yawAngle = 137.85F; + minOffset = 3; minPitch = 77.93F; } //Utils.print("" + minOffset); diff --git a/src/main/java/keystrokesmod/module/impl/player/Tower.java b/src/main/java/keystrokesmod/module/impl/player/Tower.java index 440b679..0b4870e 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Tower.java +++ b/src/main/java/keystrokesmod/module/impl/player/Tower.java @@ -24,7 +24,7 @@ public class Tower extends Module { final private SliderSetting slowedTicks; final private ButtonSetting disableWhileHurt; - final private String[] towerMoveModes = new String[]{"None", "Vanilla", "Low", "Edge", "2.5 tick", "1.5 tick"}; + final private String[] towerMoveModes = new String[]{"None", "Vanilla", "Low", "Edge", "2.5 tick", "1.5 tick", "Test"}; final private String[] verticalTowerModes = new String[]{"None", "Vanilla", "Extra block"}; private int slowTicks; private boolean wasTowering; @@ -45,6 +45,8 @@ public class Tower extends Module { public boolean speed; + private int grounds; + public Tower() { super("Tower", category.player); this.registerSetting(towerMove = new SliderSetting("Tower Move", 0, towerMoveModes)); @@ -83,6 +85,9 @@ public class Tower extends Module { break; case 5: + break; + case 6: + break; } } @@ -237,6 +242,35 @@ public class Tower extends Module { } } break; + case 6: + speed = false; + if (mc.thePlayer.onGround) { + grounds++; + } + if (mc.thePlayer.posY % 1 == 0) { + tower = true; + } + if (tower) { + towerTicks = mc.thePlayer.onGround ? 0 : ++towerTicks; + switch (towerTicks) { + case 0: + mc.thePlayer.motionY = 0.42f; + Utils.setSpeed(get15tickspeed(getSpeedLevel())); // Speed + Strafe tick + speed = true; + break; + case 1: + mc.thePlayer.motionY = 0.33f; + Utils.setSpeed(Utils.getHorizontalSpeed()); // Strafe tick + break; + case 2: + mc.thePlayer.motionY = 1 - mc.thePlayer.posY % 1f + 0.0000001; + break; + case 3: + mc.thePlayer.motionY = -0.01; + break; + } + } + break; } } else { @@ -259,8 +293,11 @@ public class Tower extends Module { } slowTicks = 0; } + if (speed) { + Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer) / 1.6); + } hasTowered = tower = firstJump = startedTowerInAir = setLowMotion = speed = false; - cMotionTicks = placeTicks = towerTicks = 0; + cMotionTicks = placeTicks = towerTicks = grounds = 0; reset(); } if (canTower() && !Utils.keysDown()) { @@ -318,6 +355,9 @@ public class Tower extends Module { @SubscribeEvent public void onPostPlayerInput(PostPlayerInputEvent e) { + if (!ModuleManager.scaffold.isEnabled) { + return; + } if (canTower() && Utils.keysDown() && towerMove.getInput() > 0) { mc.thePlayer.movementInput.jump = false; if (!firstJump) { diff --git a/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java index 54f6bf5..01c3682 100644 --- a/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java @@ -111,7 +111,7 @@ public class TargetHUD extends Module { private void drawTargetHUD(Timer cd, String string, double health) { if (showStatus.isToggled()) { - string = string + " " + ((health <= Utils.getCompleteHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth()) ? "§aW" : "§cL"); + string = string + " " + ((health <= Utils.getTotalHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth()) ? "§aW" : "§cL"); } final ScaledResolution scaledResolution = new ScaledResolution(mc); final int padding = 8; @@ -235,7 +235,7 @@ public class TargetHUD extends Module { playerInfo += " " + Utils.getHealthStr(mc.thePlayer, true); drawTargetHUD(null, playerInfo, health); if (showStatus.isToggled()) { - playerInfo = playerInfo + " " + ((health <= Utils.getCompleteHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth()) ? "§aW" : "§cL"); + playerInfo = playerInfo + " " + ((health <= Utils.getTotalHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth()) ? "§aW" : "§cL"); } int stringWidth = mc.fontRendererObj.getStringWidth(playerInfo) + 8; int maX = (res.getScaledWidth() / 2 - stringWidth / 2) + miX + mc.fontRendererObj.getStringWidth(playerInfo) + 8; diff --git a/src/main/java/keystrokesmod/utility/ModuleUtils.java b/src/main/java/keystrokesmod/utility/ModuleUtils.java index 2a918f9..907d925 100644 --- a/src/main/java/keystrokesmod/utility/ModuleUtils.java +++ b/src/main/java/keystrokesmod/utility/ModuleUtils.java @@ -337,10 +337,9 @@ public class ModuleUtils { if ((ModuleManager.bhop.didMove || ModuleManager.scaffold.lowhop) && (!ModuleManager.bhop.disablerOnly.isToggled() || ModuleManager.bhop.disablerOnly.isToggled() && ModuleManager.disabler.disablerLoaded)) { + if (!ModuleUtils.damage || Velocity.vertical.getInput() == 0) { - if ((!ModuleUtils.damage || Velocity.vertical.getInput() == 0) && !mc.thePlayer.isCollidedHorizontally) { - - if (ModuleManager.scaffold.lowhop && !ModuleManager.bhop.didMove) { + if (ModuleManager.scaffold.lowhop) { switch (simpleY) { case 4200: mc.thePlayer.motionY = 0.39; @@ -354,8 +353,8 @@ public class ModuleUtils { break; } } - else { - if (!ModuleManager.bhop.lowhop && (!(block instanceof BlockAir) || !(blockAbove instanceof BlockAir) || blockBelow instanceof BlockSlab || (blockBelow instanceof BlockAir && blockBelow2 instanceof BlockAir))) { + else if (ModuleManager.bhop.didMove) { + if (mc.thePlayer.isCollidedHorizontally || mc.thePlayer.isCollidedVertically || ModuleUtils.damage || !ModuleManager.bhop.lowhop && (!(block instanceof BlockAir) || !(blockAbove instanceof BlockAir) || blockBelow instanceof BlockSlab || (blockBelow instanceof BlockAir && blockBelow2 instanceof BlockAir))) { resetLowhop(); } switch ((int) ModuleManager.bhop.mode.getInput()) { @@ -380,14 +379,39 @@ public class ModuleUtils { } break; case 3: // 8 tick - switch (simpleY) { - case 13: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.02483; - break; - case 2000: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.1913; - resetLowhop(); - break; + if (!ModuleManager.bhop.isNormalPos) { + resetLowhop(); + break; + } + if (inAirTicks == 1) { + mc.thePlayer.motionY = 0.38999998569488; + ModuleManager.bhop.lowhop = true; + } + if (inAirTicks == 2) { + mc.thePlayer.motionY = 0.30379999189377; + } + if (inAirTicks == 3) { + mc.thePlayer.motionY = 0.08842400075912; + } + if (inAirTicks == 4) { + mc.thePlayer.motionY = -0.19174457909538; + } + if (inAirTicks == 5) { + mc.thePlayer.motionY = -0.26630949469659; + } + if (inAirTicks == 6) { + mc.thePlayer.motionY = -0.26438340940798; + } + if (inAirTicks == 7) { + mc.thePlayer.motionY = -0.33749574778843; + } + //strafe + if (inAirTicks >= 6) { + Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer)); + } + //disable + if (inAirTicks >= 8) { + resetLowhop(); } break; case 4: // 7 tick @@ -414,6 +438,9 @@ public class ModuleUtils { } else if (lowhopAir) { resetLowhop(); + if (!ModuleManager.bhop.isEnabled()) { + ModuleManager.bhop.isNormalPos = false; + } } if (ModuleManager.bhop.setRotation) { diff --git a/src/main/java/keystrokesmod/utility/Utils.java b/src/main/java/keystrokesmod/utility/Utils.java index e215b50..0e804d6 100644 --- a/src/main/java/keystrokesmod/utility/Utils.java +++ b/src/main/java/keystrokesmod/utility/Utils.java @@ -20,6 +20,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -350,12 +351,12 @@ public class Utils { } } - public static float getCompleteHealth(EntityLivingBase entity) { + public static float getTotalHealth(EntityLivingBase entity) { return entity.getHealth() + entity.getAbsorptionAmount(); } public static String getHealthStr(EntityLivingBase entity, boolean accountDead) { - float completeHealth = getCompleteHealth(entity); + float completeHealth = getTotalHealth(entity); if (accountDead && entity.isDead) { completeHealth = 0; } @@ -521,10 +522,19 @@ public class Utils { totalEPF = 0.04 * Math.min(Math.ceil(Math.min(totalEPF, 25.0) * 0.75), 20.0); final double armorReduction = armorProtPercentage + totalEPF * (1.0 - armorProtPercentage); final double damage = heldItemDamageLevel * (1.0 - armorReduction); - final double hitsToKill = getCompleteHealth(target) / damage; + final double hitsToKill = getTotalHealth(target) / damage; return round(hitsToKill, 1); } + public static boolean isBindDown(KeyBinding keyBinding) { + try { + return Keyboard.isKeyDown(keyBinding.getKeyCode()); + } + catch (IndexOutOfBoundsException e) { + return Mouse.isButtonDown(100 + keyBinding.getKeyCode()); + } + } + public static double ap(final EntityPlayer entityPlayer, final ItemStack itemStack) { double n = 1.0; if (itemStack != null && (itemStack.getItem() instanceof ItemSword || itemStack.getItem() instanceof ItemAxe)) { @@ -544,7 +554,7 @@ public class Utils { } } } - return round((double)getCompleteHealth(entityPlayer) / (n * (1.0 - (n2 + 0.04 * Math.min(Math.ceil(Math.min(n3, 25.0) * 0.75), 20.0) * (1.0 - n2)))), 1); + return round((double)getTotalHealth(entityPlayer) / (n * (1.0 - (n2 + 0.04 * Math.min(Math.ceil(Math.min(n3, 25.0) * 0.75), 20.0) * (1.0 - n2)))), 1); } public static float n() {