Skip to content

Commit

Permalink
add grimac speed
Browse files Browse the repository at this point in the history
FIX AIMASSIST!!!!!
  • Loading branch information
xia-mc committed Jul 12, 2024
1 parent 0ac9d4c commit f544f00
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/keystrokesmod/module/impl/movement/Fly.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 35 additions & 3 deletions src/main/java/keystrokesmod/module/impl/movement/Speed.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -38,8 +44,6 @@ public class Speed extends Module {

double lastAngle = 0;

float angle = 0;

int groundYPos = -1;

private boolean reset;
Expand All @@ -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));
Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/keystrokesmod/utility/AimSimulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,27 @@ 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) { // 另一边移动更近
delta = fixedTarget + 360 + fixedCurrent;
} else {
delta = -dist1;
}
} else {
return current;
}

if (Math.abs(delta) <= diff) {
return current + delta;
} else {
if (delta < 0) {
return current - diff;
} else {
} else if (delta > 0) {
return current + diff;
} else {
return current;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/keystrokesmod/utility/RotationUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f544f00

Please sign in to comment.