#issue with timer

1 messages · Page 1 of 1 (latest)

frail yew
#

what this code is supposed to do is pull you down 400 milliseconds after jumping into the air but instead it wont do that and will just multiply your speed on the ground.

            if (PlayerUtil.isInLiquid() || mc.gameSettings.keyBindJump.isKeyDown()) return;
            if (MovementUtil.isMoving()) {
                if (mc.thePlayer.onGround) {
                    MovementUtil.setSpeed(MovementUtil.getAllowedHorizontalDistance() - Math.random() / 100.0D);
                    mc.thePlayer.jump();
                    if (Math.abs(this.lastAngle - Math.atan(mc.thePlayer.motionX / mc.thePlayer.motionZ) * 57.29577951308232D) > 20.0D) {
                        MovementUtil.setSpeed((float) (0.434784145f + (0.0232600284172 * (EffectUtil.getAmplifier(Potion.moveSpeed) - 1)) + (.044 * mc.thePlayer.movementInput.moveForward)));
                        if (timer.hasTimePassed(400))
                            mc.thePlayer.motionY = -10;
                        timer.reset();```
fiery flameBOT
# frail yew what this code is supposed to do is pull you down 400 milliseconds after jumping...

Detected code, here are some useful tools:

Formatted code
if (mode.is("Watchdog")) {
  if (PlayerUtil.isInLiquid() || mc.gameSettings.keyBindJump.isKeyDown()) return ;
  if (MovementUtil.isMoving()) {
    if (mc.thePlayer.onGround) {
      MovementUtil.setSpeed(MovementUtil.getAllowedHorizontalDistance() - Math.random() / 100.0D);
      mc.thePlayer.jump();
      if (Math.abs(this .lastAngle - Math.atan(mc.thePlayer.motionX / mc.thePlayer.motionZ) * 57.29577951308232D) > 20.0D) {
        MovementUtil.setSpeed((float ) (0.434784145f + (0.0232600284172 * (EffectUtil.getAmplifier(Potion.moveSpeed) - 1)) + (.044 * mc.thePlayer.movementInput.moveForward)));
        if (timer.hasTimePassed(400)) mc.thePlayer.motionY =  - 10;
        timer.reset();
#

<@&987246652869971988> please have a look, thanks.

fallen spoke
#

it seems like setSpeed affects both horizontal & vertical axis

#

when you really only want it to apply for vertical actions (where change in vertical outweighs change in horizontal)

#

youll probably receive better help if you clean up the code

frail yew
#

ok

north rose
#

Try this one.

if (mode.is("Watchdog")) {
if (PlayerUtil.isInLiquid() || mc.gameSettings.keyBindJump.isKeyDown()) return;
if (MovementUtil.isMoving()) {
if (mc.thePlayer.onGround) {
// Initial speed setting and jump logic
MovementUtil.setSpeed(MovementUtil.getAllowedHorizontalDistance() - Math.random() / 100.0D);
mc.thePlayer.jump();
this.lastAngle = Math.atan(mc.thePlayer.motionX / mc.thePlayer.motionZ) * 57.29577951308232D;
}

    if (Math.abs(this.lastAngle) > 20.0D) {
        // Adjust speed
        MovementUtil.setSpeed((float) (0.4347841445F + (0.0232600284172 * (EffectUtil.getAmplifier(Potion.moveSpeed) - 1)) + (0.044 * mc.thePlayer.movementInput.moveForward)));
        
        // Check if 400ms has passed since the jump
        if (!mc.thePlayer.onGround && timer.hasTimePassed(400)) {
            mc.thePlayer.motionY = -10;
            timer.reset();
        }
    }
}

}