diff --git a/src/main/java/keystrokesmod/event/PreSlotScrollEvent.java b/src/main/java/keystrokesmod/event/PreSlotScrollEvent.java new file mode 100644 index 0000000..e704b4c --- /dev/null +++ b/src/main/java/keystrokesmod/event/PreSlotScrollEvent.java @@ -0,0 +1,15 @@ +package keystrokesmod.event; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class PreSlotScrollEvent extends Event { + public int slot; + public int previousSlot; + + public PreSlotScrollEvent(int slot, int previousSlot) { + this.slot = slot; + this.previousSlot = previousSlot; + } +} diff --git a/src/main/java/keystrokesmod/event/SlotUpdateEvent.java b/src/main/java/keystrokesmod/event/SlotUpdateEvent.java new file mode 100644 index 0000000..ee06938 --- /dev/null +++ b/src/main/java/keystrokesmod/event/SlotUpdateEvent.java @@ -0,0 +1,11 @@ +package keystrokesmod.event; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class SlotUpdateEvent extends Event { + public int slot; + + public SlotUpdateEvent(int slot) { + this.slot = slot; + } +} diff --git a/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java b/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java index 3d6da81..63bbcac 100644 --- a/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java +++ b/src/main/java/keystrokesmod/mixin/impl/client/MixinMinecraft.java @@ -1,15 +1,23 @@ package keystrokesmod.mixin.impl.client; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.objectweb.asm.Opcodes; import keystrokesmod.event.GuiUpdateEvent; import keystrokesmod.event.PreInputEvent; +import keystrokesmod.event.PreSlotScrollEvent; +import keystrokesmod.event.SlotUpdateEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.common.MinecraftForge; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +@SideOnly(Side.CLIENT) @Mixin(Minecraft.class) public class MixinMinecraft { @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V", ordinal = 2)) @@ -30,4 +38,20 @@ public class MixinMinecraft { GuiUpdateEvent event = new GuiUpdateEvent(setGui, opened); MinecraftForge.EVENT_BUS.post(event); } -} + + @Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/InventoryPlayer;changeCurrentItem(I)V")) + public void changeCurrentItem(InventoryPlayer inventoryPlayer, int slot) { + PreSlotScrollEvent event = new PreSlotScrollEvent(slot, inventoryPlayer.currentItem); + MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { + return; + } + inventoryPlayer.changeCurrentItem(slot); + } + + @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)); + inventoryPlayer.currentItem = slot; + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/mixin/impl/entity/MixinEntityPlayerSP.java b/src/main/java/keystrokesmod/mixin/impl/entity/MixinEntityPlayerSP.java index 6635f98..e2fa96e 100644 --- a/src/main/java/keystrokesmod/mixin/impl/entity/MixinEntityPlayerSP.java +++ b/src/main/java/keystrokesmod/mixin/impl/entity/MixinEntityPlayerSP.java @@ -8,6 +8,7 @@ import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.combat.WTap; import keystrokesmod.module.impl.movement.NoSlow; +import keystrokesmod.utility.ModuleUtils; import keystrokesmod.utility.RotationUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; @@ -286,7 +287,7 @@ public abstract class MixinEntityPlayerSP extends AbstractClientPlayer { this.setSprinting(true); } - if (this.isSprinting() && (!ModuleManager.sprint.omniSprint() && !NoSlow.groundSpeed() && !ModuleManager.scaffold.sprint() && (this.movementInput.moveForward < f || !flag3)) || this.isCollidedHorizontally || ModuleManager.sprint.disableBackwards() || (this.movementInput.moveForward == 0 && this.movementInput.moveStrafe == 0) || this.mc.gameSettings.keyBindSneak.isKeyDown() || (ModuleManager.scaffold != null && ModuleManager.scaffold.isEnabled && (!ModuleManager.scaffold.sprint() || ModuleManager.tower.canTower())) || (ModuleManager.wTap.isEnabled() && WTap.stopSprint)) { + if (this.isSprinting() && (!ModuleManager.sprint.omniSprint() && !NoSlow.groundSpeed() && !ModuleManager.scaffold.sprint() && (this.movementInput.moveForward < f || !flag3)) || this.isCollidedHorizontally || ModuleManager.sprint.disableBackwards() || ModuleUtils.setSlow || (this.movementInput.moveForward == 0 && this.movementInput.moveStrafe == 0) || this.mc.gameSettings.keyBindSneak.isKeyDown() || (ModuleManager.scaffold != null && ModuleManager.scaffold.isEnabled && (!ModuleManager.scaffold.sprint() || ModuleManager.tower.canTower())) || (ModuleManager.wTap.isEnabled() && WTap.stopSprint) || ModuleManager.sprint.isEnabled() && ModuleManager.sprint.omniDirectional.getInput() > 0 && !ModuleManager.sprint.omniSprint()) { this.setSprinting(false); WTap.stopSprint = false; } diff --git a/src/main/java/keystrokesmod/module/ModuleManager.java b/src/main/java/keystrokesmod/module/ModuleManager.java index 76ea83d..82fbdbd 100644 --- a/src/main/java/keystrokesmod/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/module/ModuleManager.java @@ -44,7 +44,7 @@ public class ModuleManager { public static Chams chams; public static HUD hud; public static Module timer; - public static Module fly; + public static Fly fly; public static Module wTap; public static Potions potions; public static TargetHUD targetHUD; diff --git a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java index 13a75f1..9873237 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java +++ b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java @@ -1,6 +1,7 @@ package keystrokesmod.module.impl.combat; import keystrokesmod.Raven; +import keystrokesmod.clickgui.ClickGui; import keystrokesmod.event.*; import keystrokesmod.mixin.impl.accessor.IAccessorMinecraft; import keystrokesmod.module.Module; @@ -12,6 +13,7 @@ import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.*; +import net.minecraft.client.gui.GuiChat; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCreature; @@ -69,8 +71,8 @@ public class KillAura extends Module { private ButtonSetting weaponOnly; private String[] autoBlockModes = new String[] { "Manual", "Vanilla", "Partial", "Interact A", "Interact B" }; - private String[] interactAModes = new String[] { "10", "7" }; - private String[] interactBModes = new String[] { "10", "8.5" }; + private String[] interactAModes = new String[] { "10", "7", "8.5" }; + private String[] interactBModes = new String[] { "10", "7", "8.5" }; private String[] rotationModes = new String[] { "Silent", "Lock view", "None" }; private String[] sortModes = new String[] { "Distance", "Health", "Hurttime", "Yaw" }; @@ -90,7 +92,7 @@ public class KillAura extends Module { public boolean blockingClient; public boolean blockingServer; private int interactTicks; - private boolean firstCycle; + private boolean firstCycle = true; private boolean partialDown; private int partialTicks; private int firstEdge, firstGyatt; @@ -224,7 +226,7 @@ public class KillAura extends Module { @SubscribeEvent public void onPreUpdate(PreUpdateEvent e) { - if (!Utils.nullCheck()) { + if (!Utils.nullCheck() || ModuleUtils.profileTicks <= 1) { return; } if (target != null && Utils.holdingSword()) { @@ -239,7 +241,7 @@ public class KillAura extends Module { checkUsing = false; } if (target == null && Utils.tabbedIn()) { - if (checkUsing && !sendUnBlock && Mouse.isButtonDown(1) && !blinkAutoBlock() && Utils.holdingSword()) { + if (checkUsing && !sendUnBlock && Mouse.isButtonDown(1) && !blinkAutoBlock()) { KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true); checkUsing = false; } @@ -249,7 +251,7 @@ public class KillAura extends Module { disableCTicks = 0; } if (blinkAutoBlock()) { - EntityLivingBase g = Utils.raytrace(3); + EntityLivingBase g = Utils.raytrace(4); /*if ((g != null || BlockUtils.isInteractable(mc.objectMouseOver)) && Utils.holdingSword()) { canUse = Mouse.isButtonDown(1); } @@ -324,6 +326,13 @@ public class KillAura extends Module { return; } + if (ModuleManager.fly.isEnabled() && ModuleManager.fly.mode.getInput() == 3) { + if (blinking.get() || lag) { + resetBlinkState(true); + } + setTarget(null); + return; + } if (ModuleManager.blink.isEnabled()) { if (blinking.get() || lag) { @@ -403,7 +412,7 @@ public class KillAura extends Module { } return; } - if (!basicCondition() || !settingCondition()) { + if (!basicCondition() || !settingCondition() || ModuleManager.fly.isEnabled() && ModuleManager.fly.mode.getInput() == 3) { setTarget(null); if (rotated) { resetYaw(e); @@ -491,12 +500,16 @@ public class KillAura extends Module { } if (e.button == 0 || e.button == 1) { if (e.button == 1) { - EntityLivingBase g = Utils.raytrace(3); + EntityLivingBase g = Utils.raytrace(4); if (blinkAutoBlock() && Utils.holdingSword() && g == null && !BlockUtils.isInteractable(mc.objectMouseOver)) { e.setCanceled(true); } } - if (!Utils.holdingWeapon() || target == null) { + if (target == null) { + return; + } + boolean inAttackDistance = inRange(target, attackRange.getInput() - 0.006); + if (!Utils.holdingWeapon() || manualBlock() && target != null && !inAttackDistance) { return; } e.setCanceled(true); @@ -570,7 +583,7 @@ public class KillAura extends Module { } } - private void setTarget(Entity entity) { + public void setTarget(Entity entity) { if (entity == null || !(entity instanceof EntityLivingBase)) { if (blockingClient) { //Reflection.setItemInUse(blockingClient = false); @@ -883,6 +896,9 @@ public class KillAura extends Module { case 1: getInteractA1(distance, swung); break; + case 2: + getInteractA2(distance, swung); + break; } break; case 4: // interact b @@ -893,6 +909,9 @@ public class KillAura extends Module { case 1: getInteractB1(distance, swung); break; + case 2: + getInteractB2(distance, swung); + break; } break; } @@ -958,6 +977,78 @@ public class KillAura extends Module { } } + private void getInteractA2(double distance, boolean swung) { + if (interactTicks == 0) { + firstEdge++; + } + interactTicks++; + if (firstCycle) { + switch (interactTicks) { + case 1: + blinking.set(true); + if (ModuleUtils.isBlocked) { + mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); + lag = false; + } + else { + handleInteractAndAttack(distance, true, true, swung); + sendBlockPacket(); + lag = true; + } + break; + case 2: + if (!lag) { + handleInteractAndAttack(distance, true, true, swung); + sendBlockPacket(); + } + releasePackets(); // release + lag = true; + break; + case 3: + if (firstEdge >= 4) { + firstEdge = 0; + firstCycle = false; + } + interactTicks = 0; + break; + } + } + + + + + else { + switch (interactTicks) { + case 1: + blinking.set(true); + if (ModuleUtils.isBlocked) { + mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN)); + lag = false; + } + else { + handleInteractAndAttack(distance, true, true, swung); + sendBlockPacket(); + releasePackets(); // release + lag = true; + } + break; + case 2: + if (!lag) { + handleInteractAndAttack(distance, true, true, swung); + sendBlockPacket(); + lag = true; + } + releasePackets(); // release + if (firstEdge >= 2) { + firstEdge = 0; + firstCycle = true; + } + interactTicks = 0; + break; + } + } + } + private void getInteractB0(double distance, boolean swung) { if (interactTicks >= 2) { interactTicks = 0; @@ -994,6 +1085,41 @@ public class KillAura extends Module { } private void getInteractB1(double distance, boolean swung) { + if (interactTicks >= 3) { + interactTicks = 0; + } + interactTicks++; + switch (interactTicks) { + case 1: + blinking.set(true); + if (ModuleUtils.isBlocked) { + setSwapSlot(); + swapped = true; + lag = false; + } + else { + handleInteractAndAttack(distance, true, true, swung); + sendBlockPacket(); + releasePackets(); // release + lag = true; + } + break; + case 2: + if (swapped) { + setCurrentSlot(); + swapped = false; + } + if (!lag) { + handleInteractAndAttack(distance, true, true, swung); + sendBlockPacket(); + releasePackets(); // release + lag = true; + } + break; + } + } + + private void getInteractB2(double distance, boolean swung) { if (interactTicks >= 3) { interactTicks = 0; } @@ -1003,7 +1129,7 @@ public class KillAura extends Module { case 1: blinking.set(true); if (ModuleUtils.isBlocked) { - if (firstGyatt == 1) { + if (firstGyatt == 3) { setSwapSlot(); swapped = true; } @@ -1024,6 +1150,10 @@ public class KillAura extends Module { } break; case 2: + if (swapped) { + setCurrentSlot(); + swapped = false; + } if (!lag) { handleInteractAndAttack(distance, true, true, swung); sendBlockPacket(); @@ -1045,7 +1175,7 @@ public class KillAura extends Module { case 1: blinking.set(true); if (ModuleUtils.isBlocked) { - if (firstEdge == 3) { + if (firstEdge == 1) { setSwapSlot(); swapped = true; } @@ -1113,13 +1243,16 @@ public class KillAura extends Module { } private boolean settingCondition() { + if (getOtherGUIs() && Mouse.isButtonDown(0)) { + return false; + } if (requireMouseDown.isToggled() && !Mouse.isButtonDown(0)) { return false; } else if (weaponOnly.isToggled() && !Utils.holdingWeapon()) { return false; } - else if (disableWhileMining.isToggled() && isMining()) { + else if (disableWhileMining.isToggled() && isMining() && Utils.tabbedIn()) { return false; } else if (disableInInventory.isToggled() && Settings.inInventory()) { @@ -1131,6 +1264,19 @@ public class KillAura extends Module { return true; } + private boolean getOtherGUIs() { + if (mc.currentScreen == null) { + return false; + } + if (mc.currentScreen instanceof ClickGui) { + return false; + } + if (mc.currentScreen instanceof GuiChat) { + return false; + } + return true; + } + private boolean isMining() { return Mouse.isButtonDown(0) && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mc.objectMouseOver.getBlockPos() != null; } @@ -1316,7 +1462,7 @@ public class KillAura extends Module { swapped = false; lag = false; firstEdge = firstGyatt = interactTicks = 0; - firstCycle = false; + firstCycle = true; } public void sendDigPacket() { diff --git a/src/main/java/keystrokesmod/module/impl/combat/Velocity.java b/src/main/java/keystrokesmod/module/impl/combat/Velocity.java index 47c7340..8b2ec83 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/Velocity.java +++ b/src/main/java/keystrokesmod/module/impl/combat/Velocity.java @@ -1,11 +1,13 @@ package keystrokesmod.module.impl.combat; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.ReceivePacketEvent; import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.KeySetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Utils; import keystrokesmod.utility.ModuleUtils; @@ -18,20 +20,23 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import org.lwjgl.input.Keyboard; public class Velocity extends Module { - private SliderSetting velocityModes; - public static SliderSetting horizontal; - public static SliderSetting vertical; + public SliderSetting velocityModes; + public static SliderSetting vertical, horizontal, reverseHorizontal; + public static SliderSetting minExtraSpeed, extraSpeedBoost; private SliderSetting chance; private ButtonSetting onlyWhileAttacking; private ButtonSetting onlyWhileTargeting; private ButtonSetting disableS; private ButtonSetting zzWhileNotTargeting; private ButtonSetting disableExplosions; - private ButtonSetting allowSelfFireball; + public ButtonSetting allowSelfFireball; + public static ButtonSetting reverseDebug; + private KeySetting switchToReverse, switchToHypixel; private boolean stopFBvelo; public boolean disableVelo; + private long delay; - private String[] velocityModesString = new String[] { "Normal", "Hypixel" }; + private String[] velocityModesString = new String[] { "Normal", "Hypixel", "Reverse" }; public Velocity() { @@ -39,6 +44,11 @@ public class Velocity extends Module { this.registerSetting(velocityModes = new SliderSetting("Mode", 0, velocityModesString)); this.registerSetting(horizontal = new SliderSetting("Horizontal", 0.0, 0.0, 100.0, 1.0)); this.registerSetting(vertical = new SliderSetting("Vertical", 0.0, 0.0, 100.0, 1.0)); + + this.registerSetting(reverseHorizontal = new SliderSetting("-Horizontal", 0.0, 0.0, 100.0, 1.0)); + this.registerSetting(minExtraSpeed = new SliderSetting("Maximum speed for extra boost", 0, 0, 0.7, 0.01)); + this.registerSetting(extraSpeedBoost = new SliderSetting("Extra speed boost multiplier", "%", 0, 0, 100, 1)); + this.registerSetting(chance = new SliderSetting("Chance", "%", 100.0D, 0.0D, 100.0D, 1.0D)); this.registerSetting(onlyWhileAttacking = new ButtonSetting("Only while attacking", false)); this.registerSetting(onlyWhileTargeting = new ButtonSetting("Only while targeting", false)); @@ -46,6 +56,11 @@ public class Velocity extends Module { this.registerSetting(zzWhileNotTargeting = new ButtonSetting("00 while not targeting", false)); this.registerSetting(disableExplosions = new ButtonSetting("Disable explosions", false)); this.registerSetting(allowSelfFireball = new ButtonSetting("Allow self fireball", false)); + + this.registerSetting(switchToReverse = new KeySetting("Switch to reverse", Keyboard.KEY_SPACE)); + this.registerSetting(switchToHypixel = new KeySetting("Switch to hypixel", Keyboard.KEY_SPACE)); + + this.registerSetting(reverseDebug = new ButtonSetting("Show reverse debug messages", false)); } public void guiUpdate() { @@ -56,12 +71,46 @@ public class Velocity extends Module { this.allowSelfFireball.setVisible(velocityModes.getInput() == 1, this); this.disableExplosions.setVisible(velocityModes.getInput() == 1, this); this.zzWhileNotTargeting.setVisible(velocityModes.getInput() == 1, this); + + this.switchToReverse.setVisible(velocityModes.getInput() == 1, this); + this.switchToHypixel.setVisible(velocityModes.getInput() == 2, this); + + + + horizontal.setVisible(velocityModes.getInput() != 2, this); + vertical.setVisible(velocityModes.getInput() != 2, this); + chance.setVisible(velocityModes.getInput() != 2, 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); + } + + @SubscribeEvent + public void onPreUpdate(PreUpdateEvent e) { + if (Utils.tabbedIn()) { + if (switchToReverse.isPressed() && velocityModes.getInput() == 1 && delay == 0) { + velocityModes.setValue(2); + delay = Utils.time(); + Utils.print(Utils.formatColor("&7[&dR&7]&7 Switched to &bReverse&7 Velocity mode")); + } + if (switchToHypixel.isPressed() && velocityModes.getInput() == 2 && delay == 0) { + velocityModes.setValue(1); + delay = Utils.time(); + Utils.print(Utils.formatColor("&7[&dR&7]&7 Switched to &bHypixel&7 Velocity mode")); + } + } + if (delay > 0 && (Utils.time() - delay) > 100) { + delay = 0; + } + } @SubscribeEvent public void onReceivePacket(ReceivePacketEvent e) { if (velocityModes.getInput() == 1) { - if (!Utils.nullCheck() || LongJump.stopVelocity || e.isCanceled() || ModuleManager.bedAura.cancelKnockback()) { + 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())) { 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 542ade8..ae3dcbc 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Bhop.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Bhop.java @@ -1,34 +1,48 @@ package keystrokesmod.module.impl.movement; +import keystrokesmod.event.PostMotionEvent; import keystrokesmod.event.PostPlayerInputEvent; import keystrokesmod.event.PreMotionEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; -import keystrokesmod.module.impl.client.Settings; +import keystrokesmod.module.impl.combat.Velocity; 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.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.input.Keyboard; public class Bhop extends Module { public SliderSetting mode; public static SliderSetting speedSetting; private ButtonSetting liquidDisable; - private ButtonSetting sneakDisable; - public ButtonSetting rotateYawOption; - public String[] modes = new String[]{"Strafe", "Ground", "8 tick", "7 tick"}; - public boolean hopping, lowhop, didMove, collided, setRotation; + private ButtonSetting sneakDisable, jumpMoving; + public ButtonSetting rotateYawOption, damageBoost, airStrafe, damageBoostRequireKey; + public GroupSetting damageBoostGroup; + 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 Bhop() { super("Bhop", Module.category.movement); this.registerSetting(mode = new SliderSetting("Mode", 0, modes)); - this.registerSetting(speedSetting = new SliderSetting("Speed", 2.0, 0.5, 8.0, 0.1)); + this.registerSetting(speedSetting = new SliderSetting("Speed", 2.0, 0.8, 1.2, 0.01)); this.registerSetting(liquidDisable = new ButtonSetting("Disable in liquid", true)); 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(damageBoostRequireKey = new ButtonSetting(damageBoostGroup,"Require key", false)); + this.registerSetting(damageBoostKey = new KeySetting(damageBoostGroup,"Enable key", 51)); + } + + public void guiUpdate() { + this.damageBoostKey.setVisible(damageBoostRequireKey.isToggled(), this); } @Override @@ -54,44 +68,46 @@ public class Bhop extends Module { if (ModuleManager.bedAura.isEnabled() && ModuleManager.bedAura.disableBHop.isToggled() && ModuleManager.bedAura.currentBlock != null && RotationUtils.inRange(ModuleManager.bedAura.currentBlock, ModuleManager.bedAura.range.getInput())) { return; } - if (ModuleManager.scaffold.moduleEnabled && (ModuleManager.tower.canTower() || ModuleManager.scaffold.fastScaffoldKeepY)) { + if (ModuleManager.scaffold.moduleEnabled || ModuleManager.scaffold.lowhop) { return; } + if (ModuleManager.LongJump.function) { + return; + } + motionTick = 0; if (mode.getInput() >= 1) { - if (mc.thePlayer.isCollidedHorizontally) { - collided = true; - } else if (mc.thePlayer.onGround) { - collided = false; - } - if (mc.thePlayer.onGround) { + if (mc.thePlayer.onGround && (!jumpMoving.isToggled() || Utils.isMoving())) { 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(); - double horizontalSpeed = Utils.getHorizontalSpeed(); - double speedModifier = 0.48; + double speed = (speedSetting.getInput() - 0.52); + double speedModifier = speed; final int speedAmplifier = Utils.getSpeedAmplifier(); switch (speedAmplifier) { case 1: - speedModifier = 0.5; + speedModifier = speed + 0.02; break; case 2: - speedModifier = 0.52; + speedModifier = speed + 0.04; break; case 3: - speedModifier = 0.58; + speedModifier = speed + 0.1; break; } - double additionalSpeed = speedModifier * ((speedSetting.getInput() - 1.0) / 3.0 + 1.0); - if (horizontalSpeed < additionalSpeed) { - horizontalSpeed = additionalSpeed; - } + if (Utils.isMoving() && !Utils.noSlowingBackWithBow() && !ModuleManager.sprint.disableBackwards()) { - Utils.setSpeed(horizontalSpeed); + Utils.setSpeed(speedModifier - Utils.randomizeDouble(0.0003, 0.0001)); didMove = true; } hopping = true; } + if (mc.thePlayer.moveForward <= 0.5 && hopping) { + ModuleUtils.handleSlow(); + } + if (!mc.thePlayer.onGround) { + hopping = false; + } } switch ((int) mode.getInput()) { case 0: @@ -107,45 +123,7 @@ public class Bhop extends Module { break; case 1: break; - case 2: - if (mode.getInput() == 2 && didMove) { - int simpleY = (int) Math.round((e.posY % 1) * 10000); - - if (mc.thePlayer.hurtTime == 0 && !collided) { - switch (simpleY) { - case 13: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.02483; - break; - case 2000: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.1913; - didMove = false; - break; - } - } - } - break; - case 3: - if (mode.getInput() == 3 && didMove) { - int simpleY = (int) Math.round((e.posY % 1) * 10000); - - if (mc.thePlayer.hurtTime == 0 && !collided) { - switch (simpleY) { - case 4200: - mc.thePlayer.motionY = 0.39; - lowhop = true; - break; - case 1138: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.13; - lowhop = false; - break; - case 2031: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.2; - didMove = false; - break; - } - } - } - break; + //lowhops } /*if (rotateYawOption.isToggled()) { if (!ModuleManager.killAura.isTargeting && !Utils.noSlowingBackWithBow() && !ModuleManager.scaffold.isEnabled && !mc.thePlayer.isCollidedHorizontally && mc.thePlayer.onGround) { @@ -153,6 +131,11 @@ public class Bhop extends Module { e.setYaw(yaw - hardcodedYaw()); } }*/ + + //if (airStrafe.isToggled()) { + //airStrafe(); + //} + } public float hardcodedYaw() { @@ -171,6 +154,39 @@ 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; + + if (diff > 180 - range && diff < 180 + range) { + Utils.setSpeed(Utils.getHorizontalSpeed() * Utils.randomizeDouble(0.831, 0.8405)); + } + } + } + + float moveDirection(float rawYaw) { + float yaw = ((rawYaw % 360) + 360) % 360 > 180 ? ((rawYaw % 360) + 360) % 360 - 360 : ((rawYaw % 360) + 360) % 360; + float forward = 1; + + if (mc.thePlayer.moveForward < 0) yaw += 180; + if (mc.thePlayer.moveForward < 0) forward = -0.5F; + if (mc.thePlayer.moveForward > 0) forward = 0.5F; + + if (mc.thePlayer.moveStrafing > 0) yaw -= 90 * forward; + if (mc.thePlayer.moveStrafing < 0) yaw += 90 * forward; + + return (float) (yaw); + } + + float strafeDirection() { + float yaw = (float) Math.toDegrees(Math.atan2(-mc.thePlayer.motionX, mc.thePlayer.motionZ)); + if (yaw < 0) yaw += 360; + return yaw; + } + public void onDisable() { hopping = false; } diff --git a/src/main/java/keystrokesmod/module/impl/movement/Fly.java b/src/main/java/keystrokesmod/module/impl/movement/Fly.java index 67dca84..af8ff18 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Fly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Fly.java @@ -1,35 +1,48 @@ package keystrokesmod.module.impl.movement; +import keystrokesmod.event.PostMotionEvent; +import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.module.Module; +import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.RenderUtils; import keystrokesmod.utility.Utils; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.RandomUtils; public class Fly extends Module { - private SliderSetting mode; + public SliderSetting mode; public static SliderSetting horizontalSpeed; private SliderSetting verticalSpeed; private ButtonSetting showBPS; private ButtonSetting stopMotion; private boolean d; private boolean a = false; - private String[] modes = new String[]{"Vanilla", "Fast", "Fast 2"}; + private float firstYaw, firstPitch; + private String[] modes = new String[]{"Vanilla", "Fast", "Fast 2", "Freeze"}; public Fly() { super("Fly", category.movement); this.registerSetting(mode = new SliderSetting("Fly", 0, modes)); - this.registerSetting(horizontalSpeed = new SliderSetting("Horizontal speed", 2.0, 1.0, 9.0, 0.1)); - this.registerSetting(verticalSpeed = new SliderSetting("Vertical speed", 2.0, 1.0, 9.0, 0.1)); + this.registerSetting(horizontalSpeed = new SliderSetting("Horizontal speed", 2.0, 0.0, 9.0, 0.1)); + this.registerSetting(verticalSpeed = new SliderSetting("Vertical speed", 2.0, 0.0, 9.0, 0.1)); this.registerSetting(showBPS = new ButtonSetting("Show BPS", false)); this.registerSetting(stopMotion = new ButtonSetting("Stop motion", false)); } + public void guiUpdate() { + horizontalSpeed.setVisible(mode.getInput() < 3, this); + this.verticalSpeed.setVisible(mode.getInput() < 3, this); + } + public void onEnable() { this.d = mc.thePlayer.capabilities.isFlying; + firstYaw = mc.thePlayer.rotationYaw; + firstPitch = mc.thePlayer.rotationPitch; } public void onUpdate() { @@ -70,10 +83,32 @@ public class Fly extends Module { mc.thePlayer.motionY = 0.0; setSpeed(0.4 * horizontalSpeed.getInput()); break; + case 3: + mc.thePlayer.motionX = 0; + mc.thePlayer.motionY = 0; + mc.thePlayer.motionZ = 0; + Utils.setSpeed(0); + break; } } + @SubscribeEvent(priority = EventPriority.LOWEST) // called last in order to apply fix + public void onMoveInput(PrePlayerInputEvent e) { + if (mode.getInput() == 3) { + e.setForward(0); + e.setStrafe(0); + } + } + + @SubscribeEvent + public void onPreMotion(PreMotionEvent e) { + if (mode.getInput() == 3) { + e.setYaw(firstYaw); + e.setPitch(firstPitch); + } + } + public void onDisable() { if (mc.thePlayer.capabilities.allowFlying) { mc.thePlayer.capabilities.isFlying = this.d; diff --git a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java index c4a758a..89e8846 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java @@ -1,18 +1,23 @@ package keystrokesmod.module.impl.movement; +import keystrokesmod.Raven; import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.event.*; import keystrokesmod.mixin.impl.accessor.IAccessorMinecraft; +import keystrokesmod.mixin.interfaces.IMixinItemRenderer; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.KeySetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.ModuleUtils; +import keystrokesmod.utility.PacketUtils; import keystrokesmod.utility.Utils; import net.minecraft.init.Items; 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.server.*; import net.minecraft.potion.PotionEffect; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -35,6 +40,7 @@ public class LongJump extends Module { private ButtonSetting invertYaw; private ButtonSetting stopMovement; private ButtonSetting hideExplosion; + public ButtonSetting spoofItem; private KeySetting temporaryFlightKey; private SliderSetting pitchVal; @@ -48,10 +54,10 @@ public class LongJump extends Module { private boolean notMoving; private boolean enabled; - public boolean function; + public static boolean function; private int boostTicks; - private int lastSlot = -1; + public int lastSlot = -1; private int stopTime; private int rotateTick; private int motionDecayVal; @@ -65,6 +71,8 @@ public class LongJump extends Module { public static boolean slotReset; public static int slotResetTicks; + private int firstSlot = -1; + public LongJump() { super("Long Jump", category.movement); this.registerSetting(mode = new SliderSetting("Mode", 0, modes)); @@ -80,6 +88,7 @@ public class LongJump extends Module { this.registerSetting(invertYaw = new ButtonSetting("Invert yaw", true)); 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(temporaryFlightKey = new KeySetting("Vertical key", Keyboard.KEY_SPACE)); } @@ -98,6 +107,11 @@ 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"); + disable(); + return; + } enabled(); } } @@ -144,6 +158,11 @@ public class LongJump extends Module { return; } + if (spoofItem.isToggled()) { + ((IMixinItemRenderer) mc.getItemRenderer()).setCancelUpdate(true); + ((IMixinItemRenderer) mc.getItemRenderer()).setCancelReset(true); + } + if (enabled) { if (!Utils.isMoving()) notMoving = true; if (boostSetting.getInput() == 0 && verticalMotion.getInput() == 0) { @@ -155,7 +174,10 @@ public class LongJump extends Module { if (fireballSlot != -1) { if (!manual.isToggled()) { lastSlot = mc.thePlayer.inventory.currentItem; - mc.thePlayer.inventory.currentItem = fireballSlot; + if (mc.thePlayer.inventory.currentItem != fireballSlot) { + mc.thePlayer.inventory.currentItem = fireballSlot; + } + } //("Set fireball slot"); rotateTick = 1; @@ -201,6 +223,10 @@ public class LongJump extends Module { if (mc.thePlayer.onGround && boostTicks > 2) { disabled(); } + + if (firstSlot != -1) { + mc.thePlayer.inventory.currentItem = firstSlot; + } } @SubscribeEvent(priority = EventPriority.LOWEST) @@ -227,10 +253,10 @@ public class LongJump extends Module { rotateTick = 0; int fireballSlot = setupFireballSlot(false); if (fireballSlot != -1) { + fireballTime = System.currentTimeMillis(); if (!manual.isToggled()) { - mc.thePlayer.inventory.currentItem = fireballSlot; // we are probably already on the slot but make sure - fireballTime = System.currentTimeMillis(); - ((IAccessorMinecraft) mc).callRightClickMouse(); + mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); + //((IAccessorMinecraft) mc).callRightClickMouse(); } mc.thePlayer.swingItem(); mc.getItemRenderer().resetEquippedProgress(); @@ -319,7 +345,6 @@ public class LongJump extends Module { slotReset = false; slotResetTicks = 0; enabled = function = true; - ModuleManager.bhop.disable(); stopModules = true; } @@ -350,8 +375,13 @@ public class LongJump extends Module { private void resetSlot() { if (lastSlot != -1 && !manual.isToggled()) { + if (spoofItem.isToggled()) { + ((IMixinItemRenderer) mc.getItemRenderer()).setCancelUpdate(false); + ((IMixinItemRenderer) mc.getItemRenderer()).setCancelReset(false); + } mc.thePlayer.inventory.currentItem = lastSlot; lastSlot = -1; + firstSlot = -1; } slotReset = true; } diff --git a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java index 53a198a..1fff3db 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java @@ -5,13 +5,12 @@ import keystrokesmod.event.*; import keystrokesmod.mixin.impl.accessor.IAccessorItemFood; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.impl.player.Safewalk; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.*; -import net.minecraft.block.Block; -import net.minecraft.block.BlockSlab; -import net.minecraft.block.BlockStairs; +import net.minecraft.block.*; import net.minecraft.client.settings.KeyBinding; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -22,6 +21,7 @@ import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; import net.minecraft.network.play.client.C09PacketHeldItemChange; +import net.minecraft.potion.PotionEffect; import net.minecraft.util.BlockPos; import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -39,10 +39,11 @@ public class NoSlow extends Module { private String[] modes = new String[]{"Vanilla", "Pre", "Post", "Alpha", "Float"}; private boolean postPlace; public static boolean canFloat; - private boolean reSendConsume; - public static boolean noSlowing, offset; + private boolean reSendConsume, requireJump; + public static boolean noSlowing, offset, fix; private int ticksOffStairs = 30; - private boolean setCancelled; + private boolean setCancelled, didC; + private int grounded; public NoSlow() { super("NoSlow", category.movement, 0); @@ -107,7 +108,7 @@ public class NoSlow extends Module { public void onPostPlayerInput(PostPlayerInputEvent e) { if (canFloat && noSlowing && offset && mc.thePlayer.onGround) { if (groundSpeedOption.isToggled() && !Utils.jumpDown() && !ModuleManager.bhop.isEnabled() && Utils.keysDown() && !Utils.bowBackwards()) { - Utils.setSpeed(getSpeedModifier()); + Utils.setSpeed(getFloatSpeed(getSpeedLevel())); //Utils.print("ground speed"); } } @@ -126,7 +127,7 @@ public class NoSlow extends Module { } private void handleFloatSetup() { - if (mode.getInput() != 4 || canFloat || reSendConsume || getSlowed() == 0.2f) { + if (mode.getInput() != 4 || canFloat || reSendConsume || requireJump || getSlowed() == 0.2f || BlockUtils.isInteractable(mc.objectMouseOver) || !Utils.tabbedIn()) { return; } if (!Mouse.isButtonDown(1) || (mc.thePlayer.getHeldItem() == null || !holdingConsumable(mc.thePlayer.getHeldItem()))) { @@ -153,7 +154,7 @@ public class NoSlow extends Module { } if (e.getPacket() instanceof C08PacketPlayerBlockPlacement) { - if (mode.getInput() != 4 || canFloat || reSendConsume || !mc.thePlayer.onGround || getSlowed() == 0.2f) { + if (mode.getInput() != 4 || canFloat || reSendConsume || requireJump || getSlowed() == 0.2f || BlockUtils.isInteractable(mc.objectMouseOver) || !Utils.tabbedIn()) { return; } if (!Mouse.isButtonDown(1) || (mc.thePlayer.getHeldItem() == null || !holdingConsumable(mc.thePlayer.getHeldItem()))) { @@ -173,20 +174,34 @@ public class NoSlow extends Module { else { ticksOffStairs++; }*/ + + if (ModuleUtils.inAirTicks > 1) { + requireJump = false; + } if (ModuleManager.bedAura.stopAutoblock || mode.getInput() != 4) { resetFloat(); return; } postPlace = false; if (!Mouse.isButtonDown(1) || (mc.thePlayer.getHeldItem() == null || !holdingConsumable(mc.thePlayer.getHeldItem()))) { + if (mc.thePlayer.getHeldItem() != null && holdingConsumable(mc.thePlayer.getHeldItem())) { + KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false); + } resetFloat(); return; } - if (mc.thePlayer.getHeldItem() != null && holdingConsumable(mc.thePlayer.getHeldItem()) && !Mouse.isButtonDown(1)) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false); + if (!floatConditions()) { + grounded = 0; + didC = true; + } + else if (didC) { + grounded++; + if (grounded > 30) { + fix = true; + } } if (reSendConsume) { - if (ModuleUtils.inAirTicks > 0) { + if (ModuleUtils.inAirTicks > 1) { KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true); reSendConsume = false; canFloat = true; @@ -194,7 +209,8 @@ public class NoSlow extends Module { } noSlowing = true; - if (ticksOffStairs < 30) { + if (!floatConditions() || requireJump) { + requireJump = true; offset = false; return; } @@ -229,13 +245,40 @@ public class NoSlow extends Module { else if (mc.thePlayer.getHeldItem().getItem() instanceof ItemPotion && !ItemPotion.isSplash(mc.thePlayer.getHeldItem().getItemDamage()) && disablePotions.isToggled()) { return 0.2f; } + else if (fix) { + return 0.2f; + } } float val = (100.0F - (float) slowed.getInput()) / 100.0F; return val; } + private boolean floatConditions() { + Block block = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)); + int edgeY = (int) Math.round((mc.thePlayer.posY % 1.0D) * 100.0D); + if (mc.thePlayer.posY % 1 == 0) { + return true; + } + if (edgeY < 10) { + return true; + } + if (!mc.thePlayer.onGround) { + return true; + } + if (block instanceof BlockSnow) { + return true; + } + if (block instanceof BlockCarpet) { + return true; + } + if (block instanceof BlockSlab) { + return true; + } + return false; + } + public static boolean groundSpeed() { - return groundSpeedOption.isToggled() && noSlowing && canFloat && offset && Utils.isMoving() && !Utils.jumpDown(); + return groundSpeedOption.isToggled() && noSlowing && canFloat && offset && Utils.isMoving() && !Utils.jumpDown() && !Utils.noSlowingBackWithBow(); } @Override @@ -244,7 +287,8 @@ public class NoSlow extends Module { } private void resetFloat() { - reSendConsume = canFloat = noSlowing = offset = false; + reSendConsume = canFloat = noSlowing = offset = didC = fix = requireJump = false; + grounded = 0; } public static boolean hasArrows(ItemStack stack) { @@ -252,27 +296,25 @@ public class NoSlow extends Module { return flag || mc.thePlayer.inventory.hasItem(Items.arrow); } - private double getSpeedModifier() { - double speedModifier = 0.2; - final int speedAmplifier = Utils.getSpeedAmplifier(); - switch (speedAmplifier) { - case 0: - speedModifier = 0.2; - break; - case 1: - speedModifier = 0.23; - break; - case 2: - speedModifier = 0.28; - break; - case 3: - speedModifier = 0.32; - break; - case 4: - speedModifier = 0.37; - break; + double[] floatSpeedLevels = {0.2, 0.23, 0.28, 0.32, 0.37}; + + double getFloatSpeed(int speedLevel) { + double min = 0; + if (mc.thePlayer.moveStrafing != 0 && mc.thePlayer.moveForward != 0) min = 0.003; + if (speedLevel >= 0) { + return floatSpeedLevels[speedLevel] - min; } - return speedModifier - 0.005; + return floatSpeedLevels[0] - min; + } + + private int getSpeedLevel() { + for (PotionEffect potionEffect : mc.thePlayer.getActivePotionEffects()) { + if (potionEffect.getEffectName().equals("potion.moveSpeed")) { + return potionEffect.getAmplifier() + 1; + } + return 0; + } + return 0; } private boolean holdingConsumable(ItemStack itemStack) { diff --git a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java index 7d8fe66..64e60dd 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java @@ -5,20 +5,28 @@ import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.mixin.impl.accessor.IAccessorEntityPlayerSP; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.impl.player.Safewalk; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; +import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.ModuleUtils; import keystrokesmod.utility.RenderUtils; import keystrokesmod.utility.Utils; +import net.minecraft.block.*; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.item.ItemBlock; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.client.config.GuiButtonExt; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; import java.io.IOException; @@ -31,8 +39,9 @@ public class Sprint extends Module { public float posX = 5; public float posY = 5; private float limit; + private boolean canFloat, requireJump; - private String[] omniDirectionalModes = new String[] { "Disabled", "Vanilla", "Hypixel" }; + private String[] omniDirectionalModes = new String[] { "Disabled", "Vanilla", "Hypixel", "Float" }; public Sprint() { super("Sprint", category.movement, 0); @@ -49,23 +58,116 @@ public class Sprint extends Module { @SubscribeEvent public void onPreMotion(PreMotionEvent e) { + + if (ModuleUtils.groundTicks <= 8 || floatConditions()) { + canFloat = true; + } + if (!floatConditions()) { + canFloat = false; + } + if (!mc.thePlayer.onGround) { + requireJump = false; + } + + if (canFloat && floatConditions() && !requireJump && omniSprint()) { + e.setPosY(e.getPosY() + ModuleUtils.offsetValue); + if (Utils.isMoving()) Utils.setSpeed(getFloatSpeed(getSpeedLevel())); + } + + if (rotationConditions()) { + float yaw = mc.thePlayer.rotationYaw; + e.setYaw(yaw - 55); + } + } + + private boolean floatConditions() { + int edgeY = (int) Math.round((mc.thePlayer.posY % 1.0D) * 100.0D); + if (ModuleUtils.stillTicks > 20) { + requireJump = true; + return false; + } + if (!(mc.thePlayer.posY % 1 == 0) && edgeY >= 10 && !allowedBlocks()) { + requireJump = true; + return false; + } + if (Safewalk.canSafeWalk()) { + requireJump = true; + return false; + } + if (ModuleManager.scaffold.isEnabled || ModuleManager.bhop.isEnabled()) { + requireJump = true; + return false; + } + if (ModuleManager.sprint.omniDirectional.getInput() != 3) { + return false; + } + if (!mc.thePlayer.onGround) { + return false; + } + if (Utils.jumpDown()) { + return false; + } + if (ModuleManager.LongJump.function) { + return false; + } + if (Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { + return false; + } + return true; + } + + private boolean allowedBlocks() { + Block block = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)); + if (block instanceof BlockSnow) { + return true; + } + if (block instanceof BlockCarpet) { + return true; + } + return false; + } + + private boolean rotationConditions() { if (Utils.noSlowingBackWithBow()) { ModuleManager.bhop.setRotation = false; - return; + return false; } - if (ModuleManager.sprint.isEnabled() && ModuleManager.sprint.omniDirectional.getInput() == 2) { - if (mc.thePlayer.onGround && mc.thePlayer.moveForward <= -0.5 && mc.thePlayer.moveStrafing == 0 && !Utils.jumpDown()) { - if (!ModuleManager.killAura.isTargeting && !Utils.noSlowingBackWithBow() && !ModuleManager.safeWalk.canSafeWalk() && !ModuleManager.scaffold.isEnabled && !ModuleManager.bhop.isEnabled() && !mc.thePlayer.isCollidedHorizontally) { - float yaw = mc.thePlayer.rotationYaw; - e.setYaw(yaw - 55); - } - } + if (omniDirectional.getInput() < 2) { + return false; } + if (!mc.thePlayer.onGround) { + return false; + } + if (mc.thePlayer.moveForward >= 0 || mc.thePlayer.moveStrafing != 0) { + return false; + } + if (Utils.jumpDown()) { + return false; + } + if (ModuleManager.killAura.isTargeting) { + return false; + } + if (Safewalk.canSafeWalk()) { + return false; + } + if (ModuleManager.scaffold.isEnabled || ModuleManager.bhop.isEnabled()) { + return false; + } + if (Utils.holdingFireball() && mc.thePlayer.moveStrafing == 0 && mc.thePlayer.moveForward <= -0.5) { + return false; + } + if (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock && Mouse.isButtonDown(1) && mc.thePlayer.moveStrafing == 0 && mc.thePlayer.moveForward <= -0.8) { + return false; + } + if (Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { + return false; + } + return true; } public boolean disableBackwards() { limit = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw - Utils.getLastReportedYaw()); - double limitVal = 125; + double limitVal = 145; if (!disableBackwards.isToggled()) { return false; } @@ -99,18 +201,54 @@ public class Sprint extends Module { } public boolean omniSprint() { - if (Utils.noSlowingBackWithBow() || Utils.safeWalkBackwards() || !Utils.isMoving()) { + if (!this.isEnabled()) { + return false; + } + if (Utils.safeWalkBackwards()) { + return false; + } + if (!Utils.isMoving()) { return false; } if (mc.thePlayer.moveForward <= 0.5 && Utils.jumpDown()) { return false; } - if (ModuleManager.sprint.omniDirectional.getInput() > 0) { + if (Utils.noSlowingBackWithBow()) { + return false; + } + if (Utils.holdingFireball() && mc.thePlayer.moveStrafing == 0 && mc.thePlayer.moveForward <= -0.5) { + return false; + } + if (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock && Mouse.isButtonDown(1) && mc.thePlayer.moveStrafing == 0 && mc.thePlayer.moveForward <= -0.8) { + return false; + } + if (omniDirectional.getInput() > 0) { return true; } return false; } + double[] floatSpeedLevels = {0.2, 0.22, 0.28, 0.29, 0.3}; + + double getFloatSpeed(int speedLevel) { + double min = 0; + if (mc.thePlayer.moveStrafing != 0 && mc.thePlayer.moveForward != 0) min = 0.003; + if (speedLevel >= 0) { + return floatSpeedLevels[speedLevel] - min; + } + return floatSpeedLevels[0] - min; + } + + private int getSpeedLevel() { + for (PotionEffect potionEffect : mc.thePlayer.getActivePotionEffects()) { + if (potionEffect.getEffectName().equals("potion.moveSpeed")) { + return potionEffect.getAmplifier() + 1; + } + return 0; + } + return 0; + } + private boolean exceptions() { return ModuleManager.scaffold.isEnabled || mc.thePlayer.hurtTime > 0 || !mc.thePlayer.onGround; } diff --git a/src/main/java/keystrokesmod/module/impl/player/DelayRemover.java b/src/main/java/keystrokesmod/module/impl/player/DelayRemover.java index 3fad243..875e55f 100644 --- a/src/main/java/keystrokesmod/module/impl/player/DelayRemover.java +++ b/src/main/java/keystrokesmod/module/impl/player/DelayRemover.java @@ -35,7 +35,7 @@ public class DelayRemover extends Module { ((IAccessorEntityLivingBase) mc.thePlayer).setJumpTicks(0); break; case 2: - if (!mc.thePlayer.onGround && mc.thePlayer.isCollidedVertically) { + if (!mc.thePlayer.onGround && mc.thePlayer.isCollidedVertically || Utils.isMoving()) { ((IAccessorEntityLivingBase) mc.thePlayer).setJumpTicks(0); } break; diff --git a/src/main/java/keystrokesmod/module/impl/player/Disabler.java b/src/main/java/keystrokesmod/module/impl/player/Disabler.java index 2e0b6e6..51f59fa 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Disabler.java +++ b/src/main/java/keystrokesmod/module/impl/player/Disabler.java @@ -3,19 +3,23 @@ package keystrokesmod.module.impl.player; import keystrokesmod.event.*; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.impl.render.HUD; import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.utility.Theme; import keystrokesmod.utility.Utils; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.network.play.client.C0BPacketEntityAction; import net.minecraft.network.play.server.S08PacketPlayerPosLook; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import java.awt.*; import java.util.Objects; public class Disabler extends Module { - public ButtonSetting motion; - public ButtonSetting bridging; private final int defaultSetbacks = 20; private final long joinDelay = 200, delay = 0, checkDisabledTime = 4000, timeout = 12000; @@ -26,35 +30,29 @@ public class Disabler extends Module { private int setbackCount, airTicks, disablerAirTicks; private double minSetbacks, zOffset; private float savedYaw, savedPitch; - private boolean noRotateWasEnabled; - private Class noRotate; - private boolean hasSneaked, hasWentInAir; - private int lastSneakTicks; - private int lastY; + private int color = new Color(0, 187, 255, 255).getRGB(); - //private String text; + private String text; private int[] disp; private int width; public Disabler() { super("Disabler", Module.category.player); - - this.registerSetting(motion = new ButtonSetting("Motion", false)); - this.registerSetting(bridging = new ButtonSetting("Bridging", false)); } private void resetVars() { - if (noRotateWasEnabled) { - Objects.requireNonNull(getModule(noRotate)).enable(); - } - awaitJoin = joinTick = awaitSetback = noRotateWasEnabled = awaitJump = false; + awaitJoin = joinTick = awaitSetback = awaitJump = false; minSetbacks = zOffset = lobbyTime = finished = setbackCount = 0; } + public void onDisable() { + resetVars(); + } + @SubscribeEvent(priority = EventPriority.LOWEST) public void onPreMotion(PreMotionEvent e) { - /*long now = System.currentTimeMillis(); + long now = System.currentTimeMillis(); if (!awaitGround && !mc.thePlayer.onGround) { disablerAirTicks++; @@ -64,17 +62,20 @@ public class Disabler extends Module { } if (awaitJoin && now >= joinTime + joinDelay) { - ItemStack item = mc.thePlayer.inventory.getStackInSlot(8); - if (Utils.getBedwarsStatus() == 1 || Utils.isBedwarsPractice() || Utils.skywarsQueue()) { - if (ModuleManager.noRotate.isEnabled() && Utils.skywarsQueue()) { - Objects.requireNonNull(getModule(noRotate)).disable(); - noRotateWasEnabled = true; - } + if (Utils.getBedwarsStatus() == 1 || Utils.isBedwarsPractice() || Utils.getSkyWarsStatus() == 1) { awaitJoin = false; joinTick = true; } } + if (awaitSetback) { + color = Theme.getGradient((int) HUD.theme.getInput(), 0); + text = "§7running disabler " + "§r" + Utils.round((now - lobbyTime) / 1000d, 1) + "s " + ((int) Utils.round(100 * (setbackCount / minSetbacks), 0)) + "%"; + width = mc.fontRendererObj.getStringWidth(text) / 2 - 2; + } else { + text = null; + } + if (finished != 0 && mc.thePlayer.onGround && now - finished > checkDisabledTime) { Utils.print("&7[&dR&7] &adisabler enabled"); finished = 0; @@ -91,12 +92,11 @@ public class Disabler extends Module { } if (joinTick) { + joinTick = false; Utils.print("&7[&dR&7] running disabler..."); if (mc.thePlayer.onGround || (mc.thePlayer.fallDistance < 0.3 && !Utils.isBedwarsPractice())) { awaitJump = true; - mc.thePlayer.jump(); - //client.print("Jump"); - joinTick = false; + KeyBinding.setKeyBindState(mc.gameSettings.keyBindJump.getKeyCode(), true); } else { minSetbacks = defaultSetbacks; savedYaw = e.getYaw(); // pitch will be 0 @@ -123,56 +123,23 @@ public class Disabler extends Module { mc.thePlayer.motionX = 0; mc.thePlayer.motionY = 0; mc.thePlayer.motionZ = 0; - //client.print("2"); - if (Utils.skywarsQueue()) { + + if (mc.thePlayer.ticksExisted % 2 == 0) { + //e.setPosX(mc.thePlayer.posX + 0.11); + } + + if (Utils.getSkyWarsStatus() == 1) { zOffset = min_offset * 0.7; if (mc.thePlayer.ticksExisted % 2 == 0) { zOffset *= -1; } e.setPosZ(e.getPosZ() + zOffset); } else { - e.setPosZ(zOffset + min_offset); - } - } - }*/ - - if (bridging.isToggled()) { - if (mc.gameSettings.keyBindSneak.isKeyDown() || !Safewalk.canSafeWalk() && !ModuleManager.scaffold.isEnabled) { - lastSneakTicks = 0; - } - if (mc.thePlayer.onGround) { // Switching Y levels doesnt stop flagging - if ((int) mc.thePlayer.posY != lastY && hasWentInAir) { - lastSneakTicks = 0; - Utils.print("Dif Y"); - } - lastY = (int) mc.thePlayer.posY; - hasWentInAir = false; - } - else { - hasWentInAir = true; - } - lastSneakTicks++; - } - - } - - @SubscribeEvent - public void onPostPlayerInput(PostPlayerInputEvent e) { - if (bridging.isToggled()) { - if (hasSneaked) { - if (!mc.gameSettings.keyBindSneak.isKeyDown()) { - mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); - } - hasSneaked = false; - lastSneakTicks = 0; - } else if (lastSneakTicks >= 19) { - if (!mc.gameSettings.keyBindSneak.isKeyDown() && (Safewalk.canSafeWalk() || ModuleManager.scaffold.isEnabled) && mc.thePlayer.onGround) { - mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING)); - hasSneaked = true; - Utils.print("Sneak packet"); + e.setPosZ(e.getPosZ() + (zOffset += min_offset)); } } } + } @SubscribeEvent() @@ -180,6 +147,7 @@ public class Disabler extends Module { if (awaitSetback) { e.setForward(0); e.setStrafe(0); + mc.thePlayer.movementInput.jump = false; } } @@ -191,14 +159,22 @@ public class Disabler extends Module { } } - /*void onRenderTick(float partialTicks) { - if (awaitSetback) { - if (hideProgress || text == null) { + @SubscribeEvent + public void onRenderTick(TickEvent.RenderTickEvent ev) { + if (!Utils.nullCheck()) { + return; + } + if (ev.phase == TickEvent.Phase.END) { + if (mc.currentScreen != null || !awaitSetback || text == null) { return; } - render.text(text, disp[0] / 2 - width, disp[1] / 2 + 13, 1, -1, true); } - }*/ + float widthOffset = 0; + color = Theme.getGradient((int) HUD.theme.getInput(), 0); + final ScaledResolution scaledResolution = new ScaledResolution(mc); + int[] display = {scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), scaledResolution.getScaleFactor()}; + mc.fontRendererObj.drawString(text, display[0] / 2 - width + widthOffset, display[1] / 2 + 8, color, true); + } @SubscribeEvent public void onWorldJoin(EntityJoinWorldEvent e) { @@ -206,8 +182,8 @@ public class Disabler extends Module { long joinTime = System.currentTimeMillis(); if (awaitSetback) { Utils.print("&7[&dR&7] &cdisabing disabler"); - resetVars(); } + resetVars(); awaitJoin = awaitGround = true; } } diff --git a/src/main/java/keystrokesmod/module/impl/player/NoFall.java b/src/main/java/keystrokesmod/module/impl/player/NoFall.java index b753b19..0eac8f3 100644 --- a/src/main/java/keystrokesmod/module/impl/player/NoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/NoFall.java @@ -67,7 +67,7 @@ public class NoFall extends Module { } if (isFalling && mode.getInput() == 2) { if (distanceFallen >= dynamic) { - Utils.getTimer().timerSpeed = 0.7199789F; + Utils.getTimer().timerSpeed = 0.7099789F; mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true)); initialY = mc.thePlayer.posY; } @@ -87,7 +87,7 @@ public class NoFall extends Module { } if (isFalling && mode.getInput() == 4) { Utils.getTimer().timerSpeed = 1F; - if (distanceFallen >= 8) { + if (distanceFallen >= 7) { Utils.getTimer().timerSpeed = 0.7F; mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true)); initialY = mc.thePlayer.posY; diff --git a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java index b8cf8ba..f3c4ede 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java @@ -4,6 +4,7 @@ import keystrokesmod.Raven; import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.ReceivePacketEvent; +import keystrokesmod.event.SlotUpdateEvent; import keystrokesmod.mixin.interfaces.IMixinItemRenderer; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; @@ -27,6 +28,7 @@ import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import java.util.*; @@ -46,7 +48,6 @@ public class Scaffold extends Module { public ButtonSetting safeWalk; public ButtonSetting showBlockCount; private ButtonSetting silentSwing; - private ButtonSetting limitMotionWhileKeepY; private String[] rotationModes = new String[] { "None", "Simple", "Offset", "Precise" }; private String[] sprintModes = new String[] { "None", "Vanilla", "Float" }; @@ -63,13 +64,12 @@ public class Scaffold extends Module { private boolean hasPlaced; private boolean rotateForward; - private int onGroundTicks; private double startYPos = -1; public boolean fastScaffoldKeepY; private boolean firstKeepYPlace; private boolean rotatingForward; private int keepYTicks; - private boolean lowhop; + public boolean lowhop; private int rotationDelay; private int blockSlot = -1; @@ -99,19 +99,25 @@ public class Scaffold extends Module { private boolean was451, was452; - private float minOffset; + private float minOffset, pOffset, minPitch; - private long firstStroke, strokeDelay = 575; - private float lastEdge, lastEdge2, yawAngle; + private float edge; + + private long firstStroke; + private float lastEdge, lastEdge2, yawAngle, theYaw; + private boolean lastAir; + private double thisX, thisY, thisZ; private int speedEdge; 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); - this.registerSetting(motion = new SliderSetting("Motion", "x", 1.0, 0.5, 1.2, 0.01)); + this.registerSetting(motion = new SliderSetting("Motion", "%", 100, 50, 150, 1)); this.registerSetting(rotation = new SliderSetting("Rotation", 1, rotationModes)); this.registerSetting(sprint = new SliderSetting("Sprint mode", 0, sprintModes)); this.registerSetting(fastScaffold = new SliderSetting("Fast scaffold", 0, fastScaffoldModes)); @@ -124,7 +130,9 @@ public class Scaffold extends Module { this.registerSetting(safeWalk = new ButtonSetting("Safewalk", true)); this.registerSetting(showBlockCount = new ButtonSetting("Show block count", true)); this.registerSetting(silentSwing = new ButtonSetting("Silent swing", false)); - this.registerSetting(limitMotionWhileKeepY = new ButtonSetting("Limit motion while Keep Y", false)); + //this.registerSetting(pitchOffset = new SliderSetting("Pitch offset", "", 9, 0, 30, 1)); + + //this.registerSetting(offsetAmount = new SliderSetting("Offset amount", "%", 100, 0, 100, 0.25)); this.alwaysOn = true; } @@ -141,6 +149,7 @@ public class Scaffold extends Module { isEnabled = true; moduleEnabled = true; ModuleUtils.fadeEdge = 0; + edge = -999999929; FMLCommonHandler.instance().bus().register(scaffoldBlockCount = new ScaffoldBlockCount(mc)); lastSlot.set(-1); @@ -163,7 +172,6 @@ public class Scaffold extends Module { if (!Utils.nullCheck()) { return; } - onGroundTicks = !mc.thePlayer.onGround ? 0 : ++onGroundTicks; if (!isEnabled) { return; } @@ -198,32 +206,20 @@ public class Scaffold extends Module { startYPos = -1; keepYTicks = speedEdge = 0; } - if (lowhop) { - switch (simpleY) { - case 4200: - mc.thePlayer.motionY = 0.39; - break; - case 1138: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.13; - break; - case 2031: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.2; - lowhop = false; - break; - } - } //Float if (sprint.getInput() == 2 && !usingFastScaffold() && !ModuleManager.bhop.isEnabled() && !ModuleManager.tower.canTower() && !ModuleManager.LongJump.function) { floatWasEnabled = true; if (!floatStarted) { - if (onGroundTicks > 8 && mc.thePlayer.onGround) { + if (ModuleUtils.groundTicks > 8 && mc.thePlayer.onGround) { floatKeepY = true; startYPos = e.posY; mc.thePlayer.jump(); - Utils.setSpeed(Utils.getHorizontalSpeed() - Utils.randomizeDouble(0.0001, 0.001)); + if (Utils.isMoving()) { + Utils.setSpeed(getSpeed(getSpeedLevel()) - Utils.randomizeDouble(0.0003, 0.0001)); + } floatJumped = true; - } else if (onGroundTicks <= 8 && mc.thePlayer.onGround) { + } else if (ModuleUtils.groundTicks <= 8 && mc.thePlayer.onGround) { floatStarted = true; } if (floatJumped && !mc.thePlayer.onGround) { @@ -246,17 +242,6 @@ public class Scaffold extends Module { floatStarted = floatJumped = floatKeepY = floatWasEnabled = false; } - if (limitMotionWhileKeepY.isToggled()) { - if (startYPos != -1) { - if (hasPlaced && !mc.thePlayer.onGround) { - if (ModuleUtils.inAirTicks > 4) { - mc.thePlayer.motionX *= 0.965; - mc.thePlayer.motionZ *= 0.965; - } - } - } - } - if (targetBlock != null) { Vec3 lookAt = new Vec3(targetBlock.xCoord - lookVec.xCoord, targetBlock.yCoord - lookVec.yCoord, targetBlock.zCoord - lookVec.zCoord); @@ -266,7 +251,9 @@ public class Scaffold extends Module { switch ((int) rotation.getInput()) { case 1: - e.setRotations(mc.thePlayer.rotationYaw - hardcodedYaw(), 81.150F); + yaw = mc.thePlayer.rotationYaw - hardcodedYaw(); + pitch = 80F; + e.setRotations(yaw, pitch); break; case 2: float moveAngle = (float) getMovementAngle(); @@ -275,86 +262,52 @@ public class Scaffold extends Module { float quad = normalizedYaw % 90; float side = MathHelper.wrapAngleTo180_float(getMotionYaw() - yaw); - float offset = yawAngle;//(!Utils.scaffoldDiagonal(false)) ? 125.500F : 143.500F; float yawBackwards = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - hardcodedYaw(); float blockYawOffset = MathHelper.wrapAngleTo180_float(yawBackwards - blockYaw); - int quadVal = 0; - float minPitch = 78.650f; + long strokeDelay = 225; - float firstStraight = 128.50f; - float secondStraight = 129.50f; - float thirdStraight = 130.50f; - float firstDiag = 130.50f; - float secondDiag = 131.50f; - float thirdDiag = 134.50f; - float fourthDiag = 139f; - - float firstOffset = 16; - float secondOffset = 14; - float thirdOffset = 10; - float fourthOffset = 9; - float fifthOffset = 8; - float sixthOffset = 5; - float seventhOffset = 2; - - //first straight if (quad <= 5 || quad >= 85) { - yawAngle = firstStraight; - minOffset = firstOffset; - quadVal = 1; + yawAngle = 127F;//(float) first.getInput(); + minOffset = 18;//(int) first1.getInput(); + minPitch = 71.08F; } - else if (quad > 5 || quad < 85) { - - //second straight - if (quad >= 80 || quad < 10) { - yawAngle = secondStraight; - minOffset = secondOffset; - quadVal = 2; - - //third straight - } else if (quad >= 65 || quad < 25) { - yawAngle = thirdStraight; - minOffset = thirdOffset; - quadVal = 3; - - //first diag - } else if (quad >= 55 || quad < 35) { - yawAngle = firstDiag; - minOffset = fourthOffset; - quadVal = 4; - - //second diag - } else if (quad >= 15 && quad < 45) { - yawAngle = secondDiag; - minOffset = fifthOffset; - quadVal = 5; - if (quad >= 38) { - yawAngle = thirdDiag; - minOffset = sixthOffset; - quadVal = 6; - if (quad >= 42) { - yawAngle = fourthDiag; - minOffset = seventhOffset; - quadVal = 7; - } - } - } else { - yawAngle = secondDiag; - minOffset = fifthOffset; - quadVal = 5; - if (quad >= 45 && quad < 52) { - yawAngle = thirdDiag; - minOffset = sixthOffset; - quadVal = 6; - if (quad < 48) { - yawAngle = fourthDiag; - minOffset = seventhOffset; - quadVal = 7; - } - } - } + if (quad > 5 && quad <= 15 || quad >= 75 && quad < 85) { + yawAngle = 128F;//(float) second.getInput(); + minOffset = 15;//(int) second1.getInput(); + minPitch = 71.84F; } + if (quad > 15 && quad <= 25 || quad >= 65 && quad < 75) { + yawAngle = 129F;//(float) three.getInput(); + minOffset = 12;//(int) three1.getInput(); + minPitch = 72.45F; + } + if (quad > 25 && quad <= 32 || quad >= 58 && quad < 65) { + yawAngle = 130F;//(float) four.getInput(); + minOffset = 9;//(int) four1.getInput(); + minPitch = 75.43F; + } + if (quad > 32 && quad <= 38 || quad >= 52 && quad < 58) { + yawAngle = 131F;//(float) five.getInput(); + minOffset = 7;//(int) five1.getInput(); + minPitch = 75.8F; + } + if (quad > 38 && quad <= 42 || quad >= 48 && quad < 52) { + yawAngle = 132.50F;//(float) six.getInput(); + minOffset = 5;//(int) six1.getInput(); + minPitch = 76.84F; + } + if (quad > 42 && quad <= 45 || quad >= 45 && quad < 48) { + yawAngle = 137F;//(float) seven.getInput(); + minOffset = 3;//(int) seven1.getInput(); + minPitch = 78.1F; + } + //float offsetAmountD = ((((float) offsetAmount.getInput() / 10) - 10) * -2) - (((float) offsetAmount.getInput() / 10) - 10); + //yawAngle += offsetAmountD; + //Utils.print("" + offsetAmountD); + + float offset = yawAngle;//(!Utils.scaffoldDiagonal(false)) ? 125.500F : 143.500F; + if (firstStroke > 0 && (System.currentTimeMillis() - firstStroke) > strokeDelay) { firstStroke = 0; @@ -364,37 +317,34 @@ public class Scaffold extends Module { blockYaw = blockRotations[0]; pitch = blockRotations[1]; yawOffset = blockYawOffset; - if (Utils.getHorizontalSpeed() < 0.6) { - //pitch = 80F; - } - if (firstStroke == 0) { - strokeDelay = 300; + if (pitch < minPitch) { + pitch = minPitch; } } else { - firstStroke = Utils.time(); + pitch = 80F; + if (edge == 1) { + firstStroke = Utils.time(); + } yawOffset = 0; - pitch = minPitch; - strokeDelay = 200; } - minOffset = 0;//turning this off for now + //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(yaw, pitch); + e.setRotations(theYaw, pitch); break; } float motionYaw = getMotionYaw(); - float lastYaw = Utils.getLastReportedYaw(); float newYaw = motionYaw - offset * Math.signum( MathHelper.wrapAngleTo180_float(motionYaw - yaw) ); - yaw = applyGcd( - lastYaw + MathHelper.wrapAngleTo180_float(newYaw - lastYaw) - ); + yaw = MathHelper.wrapAngleTo180_float(newYaw); - if (quadVal != 1) { - if (quad >= 0 && quad < 45F) { + if (quad > 5 && quad < 85) { + if (quad < 45F) { if (firstStroke == 0) { if (side >= 0) { set2 = false; @@ -423,15 +373,17 @@ public class Scaffold extends Module { } } - double minSwitch = (!Utils.scaffoldDiagonal(false)) ? 0 : 15; + double minSwitch = (!Utils.scaffoldDiagonal(false)) ? 9 : 15; if (side >= 0) { - if (quadVal == 1) { - if (yawOffset <= -minSwitch && firstStroke == 0) { + if (yawOffset <= -minSwitch && firstStroke == 0) { + if (quad <= 5 || quad >= 85) { if (set2) { firstStroke = Utils.time(); } set2 = false; - } else if (yawOffset >= 0 && firstStroke == 0) { + } + } else if (yawOffset >= 0 && firstStroke == 0) { + if (quad <= 5 || quad >= 85) { if (yawOffset >= minSwitch) { if (!set2) { firstStroke = Utils.time(); @@ -444,16 +396,19 @@ public class Scaffold extends Module { if (yawOffset <= -0) yawOffset = -0; if (yawOffset >= minOffset) yawOffset = minOffset; e.setRotations((yaw + offset * 2) - yawOffset, pitch); + theYaw = e.getYaw(); break; } } else if (side <= -0) { - if (quadVal == 1) { - if (yawOffset >= minSwitch && firstStroke == 0) { + if (yawOffset >= minSwitch && firstStroke == 0) { + if (quad <= 5 || quad >= 85) { if (set2) { firstStroke = Utils.time(); } set2 = false; - } else if (yawOffset <= 0 && firstStroke == 0) { + } + } else if (yawOffset <= 0 && firstStroke == 0) { + if (quad <= 5 || quad >= 85) { if (yawOffset <= -minSwitch) { if (!set2) { firstStroke = Utils.time(); @@ -466,6 +421,7 @@ public class Scaffold extends Module { if (yawOffset >= 0) yawOffset = 0; if (yawOffset <= -minOffset) yawOffset = -minOffset; e.setRotations((yaw - offset * 2) - yawOffset, pitch); + theYaw = e.getYaw(); break; } } @@ -478,17 +434,26 @@ public class Scaffold extends Module { if (yawOffset >= minOffset) yawOffset = minOffset; } e.setRotations(yaw - yawOffset, pitch); - set2 = false; + theYaw = e.getYaw(); break; case 3: if (blockRotations != null) { - e.setRotations(blockRotations[0], blockRotations[1]); + yaw = blockRotations[0]; + pitch = blockRotations[1]; } else { - e.setRotations(mc.thePlayer.rotationYaw - hardcodedYaw(), 81.150F); + yaw = mc.thePlayer.rotationYaw - hardcodedYaw(); + pitch = 80F; } + + e.setRotations(yaw, pitch); + theYaw = e.getYaw(); break; } + if (edge != 1) { + firstStroke = Utils.time(); + edge = 1; + } //get yaw - player yaw offset float yv = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - hardcodedYaw(); @@ -529,6 +494,14 @@ public class Scaffold extends Module { } } + //Smoothing + float yawDifference = getAngleDifference(lastEdge2, e.getYaw()); + float smoothingFactor = (1.0f - (30.0f / 100.0f)); + if (!mc.thePlayer.onGround) { + //e.setYaw(lastEdge2 + yawDifference * smoothingFactor); + } + lastEdge2 = e.getYaw(); + //pitch fix if (e.getPitch() > 89.9F) { e.setPitch(89.9F); @@ -539,12 +512,24 @@ public class Scaffold extends Module { if (rotationDelay > 0) --rotationDelay; } + @SubscribeEvent + public void onSlotUpdate(SlotUpdateEvent e) { + if (isEnabled) { + lastSlot.set(e.slot); + //Utils.print("Switched slot | " + e.slot); + } + } + @SubscribeEvent public void onPreUpdate(PreUpdateEvent e) { if (!isEnabled) { return; } + if (LongJump.function) { + startYPos = -1; + } if (holdingBlocks() && setSlot()) { + if (LongJump.stopModules) { //Utils.print("Stopped scaffold due to longjump swapping"); return; @@ -635,8 +620,8 @@ public class Scaffold extends Module { targetBlock = null; blockInfo = null; blockRotations = null; - fastScaffoldKeepY = firstKeepYPlace = rotateForward = rotatingForward = lowhop = floatStarted = floatJumped = floatWasEnabled = towerEdge = - was451 = was452 = false; + fastScaffoldKeepY = firstKeepYPlace = rotateForward = rotatingForward = floatStarted = floatJumped = floatWasEnabled = towerEdge = + was451 = was452 = lastAir = false; rotationDelay = keepYTicks = scaffoldTicks = speedEdge = 0; firstStroke = 0; startYPos = -1; @@ -714,8 +699,12 @@ public class Scaffold extends Module { } } + private boolean usingFloat() { + return sprint.getInput() == 2 && Utils.isMoving() && !usingFastScaffold(); + } + private boolean usingFastScaffold() { - return fastScaffold.getInput() > 0 && (!fastOnRMB.isToggled() || Mouse.isButtonDown(1) && Utils.tabbedIn()); + return fastScaffold.getInput() > 0 && (!fastOnRMB.isToggled() || (Mouse.isButtonDown(1) || ModuleManager.bhop.isEnabled()) && Utils.tabbedIn()); } public boolean safewalk() { @@ -1052,6 +1041,10 @@ public class Scaffold extends Module { return MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(mc.thePlayer.motionZ, mc.thePlayer.motionX)) - 90.0F); } + float getMotionYaw2() { + return (float) Math.toDegrees(Math.atan2(mc.thePlayer.motionZ, mc.thePlayer.motionX)) - 90.0F; + } + private int getSpeedLevel() { for (PotionEffect potionEffect : mc.thePlayer.getActivePotionEffects()) { if (potionEffect.getEffectName().equals("potion.moveSpeed")) { @@ -1074,18 +1067,25 @@ public class Scaffold extends Module { double[] floatSpeedLevels = {0.2, 0.22, 0.28, 0.29, 0.3}; double getFloatSpeed(int speedLevel) { + double min = 0; + double value = 0; + double input = (motion.getInput() / 100); + if (mc.thePlayer.moveStrafing != 0 && mc.thePlayer.moveForward != 0) min = 0.003; + value = floatSpeedLevels[0] - min; if (speedLevel >= 0) { - return floatSpeedLevels[speedLevel]; + value = floatSpeedLevels[speedLevel] - min; } - return floatSpeedLevels[0]; + value *= input; + return value; } private void handleMotion() { if (handleFastScaffolds() > 0 || ModuleManager.tower.canTower()) { return; } - mc.thePlayer.motionX *= motion.getInput(); - mc.thePlayer.motionZ *= motion.getInput(); + double input = (motion.getInput() / 100); + mc.thePlayer.motionX *= input; + mc.thePlayer.motionZ *= input; } public float hardcodedYaw() { @@ -1150,6 +1150,10 @@ public class Scaffold extends Module { return slot; } + public static boolean bypassRots() { + return (ModuleManager.scaffold.rotation.getInput() == 2 || ModuleManager.scaffold.rotation.getInput() == 0); + } + public boolean setSlot() { int slot = getSlot(); if (slot == -1) { diff --git a/src/main/java/keystrokesmod/module/impl/player/Tower.java b/src/main/java/keystrokesmod/module/impl/player/Tower.java index d8940fe..247dfcd 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Tower.java +++ b/src/main/java/keystrokesmod/module/impl/player/Tower.java @@ -11,6 +11,7 @@ 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.potion.PotionEffect; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -60,6 +61,9 @@ public class Tower extends Module { if (tower) { towerTicks = mc.thePlayer.onGround ? 0 : ++towerTicks; } + if (disableWhileHurt.isToggled() && ModuleUtils.damage) { + return; + } switch ((int) towerMove.getInput()) { case 1: @@ -87,6 +91,9 @@ public class Tower extends Module { int valY = (int) Math.round((mc.thePlayer.posY % 1) * 10000); if (canTower() && Utils.keysDown()) { wasTowering = true; + if (disableWhileHurt.isToggled() && ModuleUtils.damage) { + return; + } switch ((int) towerMove.getInput()) { case 1: mc.thePlayer.motionY = 0.41965; @@ -124,7 +131,7 @@ public class Tower extends Module { } break; case 3: - if (mc.thePlayer.posY % 1 == 0 && mc.thePlayer.onGround && !setLowMotion) { + if (mc.thePlayer.posY % 1 == 0 && !setLowMotion) { tower = true; } if (tower) { @@ -150,9 +157,10 @@ public class Tower extends Module { else if (setLowMotion) { ++cMotionTicks; if (cMotionTicks == 1) { - mc.thePlayer.motionY = 0.06F; + mc.thePlayer.motionY = 0.08F; + Utils.setSpeed(getTowerSpeed(getSpeedLevel())); } - else if (cMotionTicks == 3) { + else if (cMotionTicks == 4) { cMotionTicks = 0; setLowMotion = false; tower = true; @@ -163,7 +171,7 @@ public class Tower extends Module { case 4: speed = false; int simpleY = (int) Math.round((mc.thePlayer.posY % 1.0D) * 100.0D); - if (mc.thePlayer.posY % 1 == 0 && mc.thePlayer.onGround) { + if (mc.thePlayer.posY % 1 == 0) { tower = true; } if (tower) { @@ -190,12 +198,15 @@ public class Tower extends Module { } } else { - if (wasTowering && slowedTicks.getInput() > 0 && modulesEnabled()) { - if (slowTicks++ < slowedTicks.getInput()) { + if (wasTowering && modulesEnabled()) { + if (slowedTicks.getInput() > 0 && slowedTicks.getInput() != 100 && slowTicks++ < slowedTicks.getInput()) { mc.thePlayer.motionX *= slowedSpeed.getInput() / 100; mc.thePlayer.motionZ *= slowedSpeed.getInput() / 100; } else { + ModuleUtils.handleSlow(); + } + if (slowTicks >= slowedTicks.getInput()) { slowTicks = 0; wasTowering = false; } @@ -320,10 +331,7 @@ public class Tower extends Module { } public boolean canTower() { - if (!Utils.nullCheck() || !Utils.jumpDown()) { - return false; - } - else if (disableWhileHurt.isToggled() && ModuleUtils.damage) { + if (!Utils.nullCheck() || !Utils.jumpDown() || !Utils.tabbedIn()) { return false; } else if (mc.thePlayer.isCollidedHorizontally) { diff --git a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java index 9028632..0d8c9bc 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java +++ b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java @@ -6,7 +6,6 @@ import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.BlockUtils; -import keystrokesmod.utility.Reflection; import keystrokesmod.utility.Utils; import net.minecraft.block.BlockBed; import net.minecraft.client.renderer.GlStateManager; @@ -114,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/script/ScriptDefaults.java b/src/main/java/keystrokesmod/script/ScriptDefaults.java index 7a84eaa..41f0121 100644 --- a/src/main/java/keystrokesmod/script/ScriptDefaults.java +++ b/src/main/java/keystrokesmod/script/ScriptDefaults.java @@ -1378,9 +1378,13 @@ public class ScriptDefaults { public static List getBookContents() { if (mc.currentScreen instanceof GuiScreenBook) { List contents = new ArrayList<>(); - int max = Math.min(128 / mc.fontRendererObj.FONT_HEIGHT, ((IAccessorGuiScreenBook) mc.currentScreen).getBookContents().size()); + List bookContents = ((IAccessorGuiScreenBook) mc.currentScreen).getBookContents(); + if (bookContents == null) { + return contents; + } + int max = Math.min(128 / mc.fontRendererObj.FONT_HEIGHT, bookContents.size()); for (int line = 0; line < max; ++line) { - IChatComponent lineStr = ((IAccessorGuiScreenBook) mc.currentScreen).getBookContents().get(line); + IChatComponent lineStr = bookContents.get(line); contents.add(lineStr.getUnformattedText()); } if (!contents.isEmpty()) { diff --git a/src/main/java/keystrokesmod/utility/Commands.java b/src/main/java/keystrokesmod/utility/Commands.java index be294cb..f014001 100644 --- a/src/main/java/keystrokesmod/utility/Commands.java +++ b/src/main/java/keystrokesmod/utility/Commands.java @@ -375,6 +375,7 @@ public class Commands { print(name, 0); if (Settings.sendMessage.isToggled()) { Utils.sendMessage("&7Enabled profile: &b" + name); + ModuleUtils.profileTicks = 0; } return; } diff --git a/src/main/java/keystrokesmod/utility/ModuleUtils.java b/src/main/java/keystrokesmod/utility/ModuleUtils.java index 9a41417..ffa4190 100644 --- a/src/main/java/keystrokesmod/utility/ModuleUtils.java +++ b/src/main/java/keystrokesmod/utility/ModuleUtils.java @@ -1,11 +1,15 @@ package keystrokesmod.utility; import keystrokesmod.event.*; +import keystrokesmod.module.impl.combat.Velocity; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.impl.render.HUD; import keystrokesmod.utility.command.CommandManager; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; import net.minecraft.client.Minecraft; import keystrokesmod.module.ModuleManager; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.EntityLivingBase; import net.minecraft.network.Packet; import net.minecraft.network.play.client.*; @@ -34,22 +38,26 @@ public class ModuleUtils { private int isBreakingTick; public static long MAX_EXPLOSION_DIST_SQ = 10; private long FIREBALL_TIMEOUT = 500L, fireballTime = 0; - public static int inAirTicks, groundTicks; + public static int inAirTicks, groundTicks, stillTicks; public static int fadeEdge; public static int lastFaceDifference; private int lastFace; - public static float offsetValue = 1E-12F; + public static double offsetValue = 0.0000000000201; public static boolean isAttacking; private int attackingTicks; private int unTargetTicks; public static int profileTicks = -1; public static boolean lastTickOnGround, lastTickPos1; private boolean thisTickOnGround, thisTickPos1; + public static boolean firstDamage; public static boolean isBlocked; public static boolean damage; private int damageTicks; + private boolean lowhopAir; + + public static boolean canSlow, didSlow, setSlow; @SubscribeEvent public void onSendPacketNoEvent(NoEventPacketEvent e) { @@ -165,7 +173,7 @@ public class ModuleUtils { if (e.getPacket() instanceof S12PacketEntityVelocity) { if (((S12PacketEntityVelocity) e.getPacket()).getEntityID() == mc.thePlayer.getEntityId()) { - damage = true; + damage = firstDamage = true; damageTicks = 0; } @@ -176,7 +184,7 @@ public class ModuleUtils { public void onPreUpdate(PreUpdateEvent e) { if (damage && ++damageTicks >= 8) { - damage = false; + damage = firstDamage = false; damageTicks = 0; } @@ -277,6 +285,43 @@ public class ModuleUtils { } } + @SubscribeEvent + public void onPostMotion(PostMotionEvent e) { + if (bhopBoostConditions()) { + if (firstDamage) { + Utils.setSpeed(Utils.getHorizontalSpeed()); + firstDamage = false; + } + } + if (veloBoostConditions()) { + if (firstDamage) { + double added = 0; + if (Utils.getHorizontalSpeed() <= Velocity.minExtraSpeed.getInput()) { + added = Velocity.extraSpeedBoost.getInput() / 100; + if (Velocity.reverseDebug.isToggled()) { + Utils.print("&7[&dR&7] Applied extra boost | Original speed: " + Utils.getHorizontalSpeed()); + } + } + Utils.setSpeed((Utils.getHorizontalSpeed() * (Velocity.reverseHorizontal.getInput() / 100)) * (1 + added)); + firstDamage = false; + } + } + } + + private boolean bhopBoostConditions() { + if (ModuleManager.bhop.isEnabled() && ModuleManager.bhop.damageBoost.isToggled() && (!ModuleManager.bhop.damageBoostRequireKey.isToggled() || ModuleManager.bhop.damageBoostKey.isPressed())) { + return true; + } + return false; + } + + private boolean veloBoostConditions() { + if (ModuleManager.velocity.isEnabled() && ModuleManager.velocity.velocityModes.getInput() == 2) { + return true; + } + return false; + } + @SubscribeEvent public void onPreMotion(PreMotionEvent e) { int simpleY = (int) Math.round((e.posY % 1) * 10000); @@ -287,34 +332,92 @@ public class ModuleUtils { lastTickPos1 = thisTickPos1; thisTickPos1 = mc.thePlayer.posY % 1 == 0; - if (inAirTicks <= 20) { - inAirTicks = mc.thePlayer.onGround ? 0 : ++inAirTicks; - } - else { - inAirTicks = 19; - } + inAirTicks = mc.thePlayer.onGround ? 0 : ++inAirTicks; groundTicks = !mc.thePlayer.onGround ? 0 : ++groundTicks; + stillTicks = Utils.isMoving() ? 0 : ++stillTicks; - // 7 tick needs to always finish the motion or itll lag back - if (!ModuleManager.bhop.isEnabled() && ModuleManager.bhop.mode.getInput() == 3 && ModuleManager.bhop.didMove) { + Block blockBelow = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ)); + Block blockBelow2 = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 2, mc.thePlayer.posZ)); + Block block = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)); - if (mc.thePlayer.hurtTime == 0) { - switch (simpleY) { - case 4200: - mc.thePlayer.motionY = 0.39; - break; - case 1138: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.13; - ModuleManager.bhop.lowhop = false; - ModuleManager.bhop.didMove = false; - break; - /*case 2031: - mc.thePlayer.motionY = mc.thePlayer.motionY - 0.2; - didMove = false; - break;*/ + + if (ModuleManager.bhop.didMove || ModuleManager.scaffold.lowhop) { + + if ((!ModuleUtils.damage || Velocity.vertical.getInput() == 0) && !mc.thePlayer.isCollidedHorizontally) { + + if (ModuleManager.scaffold.lowhop && !ModuleManager.bhop.didMove) { + switch (simpleY) { + case 4200: + mc.thePlayer.motionY = 0.39; + break; + case 1138: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.13; + break; + case 2031: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.2; + resetLowhop(); + break; + } + } + else { + if (!(block instanceof BlockAir) || (blockBelow instanceof BlockAir && blockBelow2 instanceof BlockAir)) { + resetLowhop(); + } + switch ((int) ModuleManager.bhop.mode.getInput()) { + case 2: // 9 tick + switch (simpleY) { + case 13: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.02483; + break; + case 2000: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.1913; + break; + case 7016: + mc.thePlayer.motionY = mc.thePlayer.motionY + 0.08; + break; + } + if (ModuleUtils.inAirTicks > 6 && Utils.isMoving()) { + Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer)); + } + if (ModuleUtils.inAirTicks > 8) { + resetLowhop(); + } + break; + case 3: // 8 tick + switch (simpleY) { + case 13: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.045;//0.02483; + break; + case 2000: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.175;//0.1913; + resetLowhop(); + break; + } + break; + case 4: // 7 tick + switch (simpleY) { + case 4200: + mc.thePlayer.motionY = 0.39; + break; + case 1138: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.13; + break; + case 2031: + mc.thePlayer.motionY = mc.thePlayer.motionY - 0.2; + resetLowhop(); + break; + } + break; + } } } } + if (!mc.thePlayer.onGround) { + lowhopAir = true; + } + else if (lowhopAir) { + resetLowhop(); + } if (ModuleManager.bhop.setRotation) { if (!ModuleManager.killAura.isTargeting && !ModuleManager.scaffold.isEnabled) { @@ -331,6 +434,34 @@ public class ModuleUtils { fadeEdge = 0; ModuleManager.scaffold.highlight.clear(); } + + if ((canSlow || ModuleManager.scaffold.moduleEnabled && !ModuleManager.tower.canTower()) && !mc.thePlayer.onGround) { + double motionVal = 0.9 - ((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() { + ModuleManager.bhop.lowhop = ModuleManager.scaffold.lowhop = false; + ModuleManager.bhop.didMove = false; + lowhopAir = false; + } + + public static void handleSlow() { + didSlow = false; + canSlow = true; } @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/src/main/java/keystrokesmod/utility/RotationUtils.java b/src/main/java/keystrokesmod/utility/RotationUtils.java index e3be851..9ce7108 100644 --- a/src/main/java/keystrokesmod/utility/RotationUtils.java +++ b/src/main/java/keystrokesmod/utility/RotationUtils.java @@ -36,9 +36,9 @@ public class RotationUtils { } public static float[] getRotations(BlockPos blockPos) { - double x = blockPos.getX() + 0.45 - mc.thePlayer.posX; - double y = blockPos.getY() + 0.45 - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight()); - double z = blockPos.getZ() + 0.45 - mc.thePlayer.posZ; + double x = blockPos.getX() + 0.5D - mc.thePlayer.posX; + double y = blockPos.getY() + 0.5D - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight()); + double z = blockPos.getZ() + 0.5D - mc.thePlayer.posZ; float angleToBlock = (float) (Math.atan2(z, x) * (180 / Math.PI)) - 90.0f; float deltaYaw = MathHelper.wrapAngleTo180_float(angleToBlock - mc.thePlayer.rotationYaw); @@ -55,9 +55,9 @@ public class RotationUtils { } public static float[] getRotations(Vec3 vec3) { - double x = vec3.xCoord + 1.0 - mc.thePlayer.posX; - double y = vec3.yCoord + 1.0 - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight()); - double z = vec3.zCoord + 1.0 - mc.thePlayer.posZ; + double x = vec3.xCoord + 1.0D - mc.thePlayer.posX; + double y = vec3.yCoord + 1.0D - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight()); + double z = vec3.zCoord + 1.0D - mc.thePlayer.posZ; float angleToBlock = (float) (Math.atan2(z, x) * (180 / Math.PI)) - 90.0f; float deltaYaw = MathHelper.wrapAngleTo180_float(angleToBlock - mc.thePlayer.rotationYaw); @@ -74,9 +74,9 @@ public class RotationUtils { } public static float[] getRotations(double posX, double posY, double posZ) { - double x = posX + 1.0 - mc.thePlayer.posX; - double y = posY + 1.0 - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight()); - double z = posZ + 1.0 - mc.thePlayer.posZ; + double x = posX + 1.0D - mc.thePlayer.posX; + double y = posY + 1.0D - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight()); + double z = posZ + 1.0D - mc.thePlayer.posZ; float angleToBlock = (float) (Math.atan2(z, x) * (180 / Math.PI)) - 90.0f; float deltaYaw = MathHelper.wrapAngleTo180_float(angleToBlock - mc.thePlayer.rotationYaw); diff --git a/src/main/java/keystrokesmod/utility/Utils.java b/src/main/java/keystrokesmod/utility/Utils.java index 9d8f3be..5870097 100644 --- a/src/main/java/keystrokesmod/utility/Utils.java +++ b/src/main/java/keystrokesmod/utility/Utils.java @@ -82,6 +82,45 @@ public class Utils { return false; } + public static double getPosDirectionX(double posOffset) { + if (!isMoving()) { + return mc.thePlayer.posX; + } + float yaw = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw); + if (yaw > 45 && yaw <= 90) { + return mc.thePlayer.posX + posOffset; + } else if (yaw > 90 && yaw <= 135) { + return mc.thePlayer.posX + posOffset; + } else if (yaw > 135 && yaw <= 180) { + return mc.thePlayer.posX + posOffset; + } else if (yaw < -90 && yaw >= -135) { + return mc.thePlayer.posX - posOffset; + } else if (yaw < -45 && yaw >= -90) { + return mc.thePlayer.posX - posOffset; + } else if (yaw <= -0 && yaw > -45) { + return mc.thePlayer.posX - posOffset; + } + return 0; + } + + public static double getPosDirectionZ(double posOffset) { + if (!isMoving()) { + return mc.thePlayer.posX; + } + float yaw = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw); + if (yaw >= 0 && yaw <= 45) { + return mc.thePlayer.posZ - posOffset; + } else if (yaw > 135 && yaw <= 180) { + return mc.thePlayer.posZ + 1; + } else if (yaw < -135 && yaw >= -180) { + return mc.thePlayer.posZ + posOffset; + } else if (yaw <= -0 && yaw > -45) { + return mc.thePlayer.posZ - posOffset; + } + return 0; + } + + public static boolean holdingEdible(ItemStack stack) { if (stack.getItem() instanceof ItemFood && mc.thePlayer.getFoodStats().getFoodLevel() == 20) { ItemFood food = (ItemFood) stack.getItem(); @@ -679,7 +718,7 @@ public class Utils { return false; } final ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - if (objective != null || stripString(objective.getDisplayName()).contains("SKYWARS")) { + if (stripString(objective.getDisplayName()).contains("SKYWARS")) { Utils.print("Skywars"); return true; } @@ -1455,6 +1494,9 @@ public class Utils { if (ModuleManager.autoTool.isEnabled() && ModuleManager.autoTool.spoofItem.isToggled()) { return mc.thePlayer.inventory.getStackInSlot(ModuleManager.autoTool.previousSlot == -1 ? mc.thePlayer.inventory.currentItem : ModuleManager.autoTool.previousSlot); } + if (ModuleManager.LongJump.isEnabled() && ModuleManager.LongJump.spoofItem.isToggled()) { + return mc.thePlayer.inventory.getStackInSlot(ModuleManager.LongJump.lastSlot == -1 ? mc.thePlayer.inventory.currentItem : ModuleManager.LongJump.lastSlot); + } return original; } diff --git a/src/main/java/keystrokesmod/utility/profile/ProfileModule.java b/src/main/java/keystrokesmod/utility/profile/ProfileModule.java index 20487e8..4e04b29 100644 --- a/src/main/java/keystrokesmod/utility/profile/ProfileModule.java +++ b/src/main/java/keystrokesmod/utility/profile/ProfileModule.java @@ -38,6 +38,7 @@ public class ProfileModule extends Module { if (Settings.sendMessage.isToggled()) { Utils.sendMessage("&7Enabled profile: &b" + this.getName()); + ModuleUtils.profileTicks = 0; } saved = true; }