code cleanupo

This commit is contained in:
Bella 2020-04-15 13:48:23 -04:00
parent 2e894ccd40
commit 065bb4364c
No known key found for this signature in database
GPG Key ID: DBD4A6030080C8B3
1 changed files with 13 additions and 18 deletions

View File

@ -81,7 +81,7 @@ public class ElytraFlight extends Module {
if (!mc.player.isElytraFlying()) { if (!mc.player.isElytraFlying()) {
if (easyTakeOffControl.getValue() && !mc.player.onGround && mc.player.motionY < -0.04) { if (easyTakeOffControl.getValue() && !mc.player.onGround && mc.player.motionY < -0.04) {
Objects.requireNonNull(mc.getConnection()).sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING)); Objects.requireNonNull(mc.getConnection()).sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING));
// mc.timer.tickLength = 200.0f; mc.timer.tickLength = 200.0f;
event.cancel(); event.cancel();
return; return;
} }
@ -89,10 +89,9 @@ public class ElytraFlight extends Module {
} }
mc.timer.tickLength = 50.0f; mc.timer.tickLength = 50.0f;
if (hoverTarget < 0.0) { if (hoverTarget < 0.0) hoverTarget = mc.player.posY;
hoverTarget = mc.player.posY;
}
/* this is horrible but what other way to store these for later */
boolean moveForward = mc.gameSettings.keyBindForward.isKeyDown(); boolean moveForward = mc.gameSettings.keyBindForward.isKeyDown();
boolean moveBackward = mc.gameSettings.keyBindBack.isKeyDown(); boolean moveBackward = mc.gameSettings.keyBindBack.isKeyDown();
boolean moveLeft = mc.gameSettings.keyBindLeft.isKeyDown(); boolean moveLeft = mc.gameSettings.keyBindLeft.isKeyDown();
@ -116,26 +115,25 @@ public class ElytraFlight extends Module {
packetYaw = yawDeg; packetYaw = yawDeg;
float yaw = (float) Math.toRadians(yawDeg); float yaw = (float) Math.toRadians(yawDeg);
/*float pitch = (float) Math.toRadians(ElytraFlight.mc.player.rotationPitch);*/ /*float pitch = (float) Math.toRadians(ElytraFlight.mc.player.rotationPitch);*/
double d8 = Math.sqrt(mc.player.motionX * mc.player.motionX + mc.player.motionZ * mc.player.motionZ); double motionAmount = Math.sqrt(mc.player.motionX * mc.player.motionX + mc.player.motionZ * mc.player.motionZ);
hoverState = hoverState ? mc.player.posY < hoverTarget + 0.1 : mc.player.posY < hoverTarget + 0.0; hoverState = hoverState ? mc.player.posY < hoverTarget + 0.1 : mc.player.posY < hoverTarget + 0.0;
boolean tmp = doHover = hoverState && hoverControl.getValue(); doHover = hoverState && hoverControl.getValue();
if (moveUp || moveForward || moveBackward || moveLeft || moveRight || MODULE_MANAGER.isModuleEnabled(AutoWalk.class)) { if (moveUp || moveForward || moveBackward || moveLeft || moveRight || MODULE_MANAGER.isModuleEnabled(AutoWalk.class)) {
if ((moveUp || doHover) && d8 > 1.0) { if ((moveUp || doHover) && motionAmount > 1.0) {
if (mc.player.motionX == 0.0 && mc.player.motionZ == 0.0) { if (mc.player.motionX == 0.0 && mc.player.motionZ == 0.0) {
mc.player.motionY = downSpeedControl.getValue(); mc.player.motionY = downSpeedControl.getValue();
} else { } else {
double d6 = 1.0; double calcMotionDiff = motionAmount * 0.008;
double d10 = d8 * 0.2 * 0.04; mc.player.motionY += calcMotionDiff * 3.2;
mc.player.motionY += d10 * 3.2; mc.player.motionX -= (double) (-MathHelper.sin(yaw)) * calcMotionDiff / 1.0;
mc.player.motionX -= (double) (-MathHelper.sin(yaw)) * d10 / d6; mc.player.motionZ -= (double) MathHelper.cos(yaw) * calcMotionDiff / 1.0;
mc.player.motionZ -= (double) MathHelper.cos(yaw) * d10 / d6;
mc.player.motionX *= 0.99f; mc.player.motionX *= 0.99f;
mc.player.motionY *= 0.98f; mc.player.motionY *= 0.98f;
mc.player.motionZ *= 0.99f; mc.player.motionZ *= 0.99f;
} }
} else { } else { /* runs when pressing wasd */
mc.player.motionX = (double) (-MathHelper.sin(yaw)) * speedControl.getValue(); mc.player.motionX = (double) (-MathHelper.sin(yaw)) * speedControl.getValue();
mc.player.motionY = -fallSpeedControl.getValue().doubleValue(); mc.player.motionY = -fallSpeedControl.getValue();
mc.player.motionZ = (double) MathHelper.cos(yaw) * speedControl.getValue(); mc.player.motionZ = (double) MathHelper.cos(yaw) * speedControl.getValue();
} }
} else { /* Stop moving if no inputs are pressed */ } else { /* Stop moving if no inputs are pressed */
@ -155,10 +153,7 @@ public class ElytraFlight extends Module {
@Override @Override
public void onUpdate() { public void onUpdate() {
if (mc.player == null) { if (mc.player == null) return;
// disable();
return;
}
if (defaultSetting.getValue()) defaults(); if (defaultSetting.getValue()) defaults();