From f544f005a8320a1fc6ba7286d2bfb1e71e1001e4 Mon Sep 17 00:00:00 2001 From: xia-mc <2052472631@qq.com> Date: Fri, 12 Jul 2024 21:35:48 +0800 Subject: [PATCH] add grimac speed FIX AIMASSIST!!!!! --- .../module/impl/movement/Fly.java | 4 +- .../module/impl/movement/Speed.java | 38 +++++++++++++++++-- .../module/impl/movement/TargetStrafe.java | 8 ++++ .../keystrokesmod/utility/AimSimulator.java | 8 +++- .../keystrokesmod/utility/RotationUtils.java | 4 +- 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/src/main/java/keystrokesmod/module/impl/movement/Fly.java b/src/main/java/keystrokesmod/module/impl/movement/Fly.java index 373f2ed5..93b80801 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Fly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Fly.java @@ -192,9 +192,9 @@ else if (Utils.jumpDown()) { * @see ac.grim.grimac.predictionengine.UncertaintyHandler#hasHardCollision * SUPER⭐GrimAC⭐TIME */ + AxisAlignedBB playerBox = mc.thePlayer.getEntityBoundingBox(); + AxisAlignedBB grimACBox = playerBox.expand(1, 1, 1); for (Entity entity : mc.theWorld.loadedEntityList) { - AxisAlignedBB playerBox = mc.thePlayer.getEntityBoundingBox(); - AxisAlignedBB grimACBox = playerBox.expand(1, 1, 1); if (entity instanceof EntityBoat) { AxisAlignedBB boatBox = entity.getEntityBoundingBox(); if (boatBox.intersectsWith(grimACBox) && !(boatBox.intersectsWith(playerBox))) { // if grimAC disabled simulation diff --git a/src/main/java/keystrokesmod/module/impl/movement/Speed.java b/src/main/java/keystrokesmod/module/impl/movement/Speed.java index 4b9ef185..e61267b2 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Speed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Speed.java @@ -12,9 +12,13 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.play.client.C0BPacketEntityAction; import net.minecraft.network.play.server.S08PacketPlayerPosLook; import net.minecraft.potion.Potion; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -25,11 +29,13 @@ public class Speed extends Module { private final ModeSetting mode; private final SliderSetting vulcan$lowHop; + private final SliderSetting grimAC$boost; + private final ButtonSetting autoJump; private final ButtonSetting liquidDisable; private final ButtonSetting sneakDisable; private final ButtonSetting stopMotion; private final ButtonSetting stopSprint; - private final String[] modes = new String[]{"Ground", "BlocksMC", "Vulcan"}; + private final String[] modes = new String[]{"Hypixel", "BlocksMC", "Vulcan", "GrimAC"}; private int offGroundTicks = 0; public static int ticksSinceVelocity = Integer.MAX_VALUE; @@ -38,8 +44,6 @@ public class Speed extends Module { double lastAngle = 0; - float angle = 0; - int groundYPos = -1; private boolean reset; @@ -49,6 +53,9 @@ public Speed() { super("Speed", Module.category.movement); this.registerSetting(mode = new ModeSetting("Mode", modes, 0)); this.registerSetting(vulcan$lowHop = new SliderSetting("Low hop", 2, 0, 4, 1, "ticks", new ModeOnly(mode, 2))); + ModeOnly grimAC = new ModeOnly(mode, 3); + this.registerSetting(grimAC$boost = new SliderSetting("Boost", 4, 0, 10, 1, grimAC)); + this.registerSetting(autoJump = new ButtonSetting("Auto jump", false, grimAC)); this.registerSetting(liquidDisable = new ButtonSetting("Disable in liquid", true)); this.registerSetting(sneakDisable = new ButtonSetting("Disable while sneaking", true)); this.registerSetting(stopMotion = new ButtonSetting("Stop motion", false)); @@ -122,9 +129,34 @@ public void onUpdate() { } } break; + case 3: + if (!Utils.nullCheck() || !MoveUtil.isMoving()) break; + if (mc.thePlayer.onGround && autoJump.isToggled()) { + mc.thePlayer.jump(); + } + + int collisions = 0; + AxisAlignedBB grimPlayerBox = mc.thePlayer.getEntityBoundingBox().expand(1.0, 1.0, 1.0); + for (Entity entity : mc.theWorld.loadedEntityList) { + if (canCauseSpeed(entity) && (grimPlayerBox.intersectsWith(entity.getEntityBoundingBox()))) { + collisions += 1; + } + } + double yaw = Math.toRadians(MoveYaw()); + double boost = grimAC$boost.getInput() / 100 * collisions; + mc.thePlayer.addVelocity(-Math.sin(yaw) * boost, 0.0, Math.cos(yaw) * boost); + break; } } + public static double MoveYaw(){ + return (MoveUtil.direction() * 180f / Math.PI); + } + + private boolean canCauseSpeed(Entity entity) { + return entity != mc.thePlayer && entity instanceof EntityLivingBase; + } + private boolean noAction() { return ((mc.thePlayer.isInWater() || mc.thePlayer.isInLava()) && liquidDisable.isToggled()) diff --git a/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java index 31b89981..f3f0be5f 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java +++ b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java @@ -1,5 +1,7 @@ package keystrokesmod.module.impl.movement; +import keystrokesmod.event.JumpEvent; +import keystrokesmod.event.MoveInputEvent; import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.combat.KillAura; @@ -51,6 +53,12 @@ public void onPreInput(PrePlayerInputEvent input) { movementYaw = toTarget; } + @SubscribeEvent(priority = EventPriority.HIGH) + public void onJump(JumpEvent event) { + if (movementYaw != null) + event.setYaw(movementYaw); + } + @Override public void onDisable() { movementYaw = null; diff --git a/src/main/java/keystrokesmod/utility/AimSimulator.java b/src/main/java/keystrokesmod/utility/AimSimulator.java index 5237cb7b..9feac659 100644 --- a/src/main/java/keystrokesmod/utility/AimSimulator.java +++ b/src/main/java/keystrokesmod/utility/AimSimulator.java @@ -82,7 +82,7 @@ public static float rotMoveNoRandom(float target, float current, float diff) { } else { delta = dist1; } - } else { + } else if (fixedTarget < fixedCurrent) { float dist1 = fixedCurrent - fixedTarget; float dist2 = fixedTarget + 360 - fixedCurrent; if (dist1 > dist2) { // 另一边移动更近 @@ -90,6 +90,8 @@ public static float rotMoveNoRandom(float target, float current, float diff) { } else { delta = -dist1; } + } else { + return current; } if (Math.abs(delta) <= diff) { @@ -97,8 +99,10 @@ public static float rotMoveNoRandom(float target, float current, float diff) { } else { if (delta < 0) { return current - diff; - } else { + } else if (delta > 0) { return current + diff; + } else { + return current; } } } diff --git a/src/main/java/keystrokesmod/utility/RotationUtils.java b/src/main/java/keystrokesmod/utility/RotationUtils.java index a2c674b1..6f13d518 100644 --- a/src/main/java/keystrokesmod/utility/RotationUtils.java +++ b/src/main/java/keystrokesmod/utility/RotationUtils.java @@ -240,10 +240,10 @@ public static float toPositive(float yaw) { } public static float normalize(float yaw) { - while (yaw > 360) { + while (yaw > 180) { yaw -= 360; } - while (yaw < 0) { + while (yaw < -180) { yaw += 360; } return yaw;