From d66b8f1dd8b5c96f741ae016868b689501441aef Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 18 Jun 2023 00:13:55 -0500 Subject: [PATCH] Extract `currentSpeed` into variable --- src/main/java/baritone/behavior/ElytraBehavior.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/behavior/ElytraBehavior.java b/src/main/java/baritone/behavior/ElytraBehavior.java index 9945d0b31..8fdcb34f6 100644 --- a/src/main/java/baritone/behavior/ElytraBehavior.java +++ b/src/main/java/baritone/behavior/ElytraBehavior.java @@ -402,12 +402,18 @@ public final class ElytraBehavior extends Behavior implements Helper { final BetterBlockPos goingTo = this.pathManager.goingTo(); final boolean useOnDescend = !Baritone.settings().conserveFireworks.value || ctx.player().posY < goingTo.y + 5; + final double currentSpeed = new Vec3d( + ctx.player().motionX, + // ignore y component if we are BOTH below where we want to be AND descending + ctx.player().posY < goingTo.y ? Math.max(0, ctx.player().motionY) : ctx.player().motionY, + ctx.player().motionZ + ).length(); if (!firework && sinceFirework > 10 && useOnDescend && (ctx.player().posY < goingTo.y - 5 || start.distanceTo(new Vec3d(goingTo.x + 0.5, ctx.player().posY, goingTo.z + 0.5)) > 5) // UGH!!!!!!! - && new Vec3d(ctx.player().motionX, ctx.player().posY < goingTo.y ? Math.max(0, ctx.player().motionY) : ctx.player().motionY, ctx.player().motionZ).length() < Baritone.settings().elytraFireworkSpeed.value // ignore y component if we are BOTH below where we want to be AND descending + && currentSpeed < Baritone.settings().elytraFireworkSpeed.value ) { logDirect("firework"); ctx.playerController().processRightClick(ctx.player(), ctx.world(), EnumHand.MAIN_HAND);