From 82dbf9a3d78d3e482a29a1db381555c7b7eb358d Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Thu, 5 Nov 2026 13:18:30 +1100 Subject: [PATCH 1/8] fix: press jump around Bounce's start-flying Grim's ElytraB wants the jump key released as start-flying goes out and pressed by the next move, as pressing jump mid-air sends them. --- .../movement/elytrafly/ElytraFlyMode.kt | 2 +- .../elytrafly/modes/BounceElytraFly.kt | 18 ++++++++++++++++++ src/main/resources/lambda.accesswidener | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ElytraFlyMode.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ElytraFlyMode.kt index e178d4e71..c289e7e55 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ElytraFlyMode.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ElytraFlyMode.kt @@ -137,7 +137,7 @@ abstract class ElytraFlyMode( fakeGliding = true } - protected fun SafeContext.startFlyPacket() = + protected open fun SafeContext.startFlyPacket() = connection.sendPacket(ClientCommandC2SPacket(player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)) open fun isGliding() = runSafe { player.getFlag(Entity.GLIDING_FLAG_INDEX) || (fakeFly && fakeGliding) } == true diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 178bd19cb..9ed0263b9 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -47,6 +47,8 @@ import com.lambda.util.player.PlayerUtils.canTakeoff import net.minecraft.client.input.KeyboardInput.getMovementMultiplier import net.minecraft.entity.Entity import net.minecraft.network.packet.Packet +import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket +import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket import net.minecraft.network.packet.s2c.common.CommonPingS2CPacket import net.minecraft.util.PlayerInput import net.minecraft.util.math.Vec2f @@ -258,6 +260,22 @@ class BounceElytraFly( } } + // Sent like pressing jump mid-air, which Grim checks for + override fun SafeContext.startFlyPacket() { + if (player.lastPlayerInput.jump) sendJumpKey(false) + connection.sendPacket(ClientCommandC2SPacket(player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)) + sendJumpKey(true) + // Kept down into the next move, as a press would be + wantJump = true + } + + private fun SafeContext.sendJumpKey(down: Boolean) { + val last = player.lastPlayerInput + val input = PlayerInput(last.forward, last.backward, last.left, last.right, down, last.sneak, last.sprint) + connection.sendPacket(PlayerInputC2SPacket(input)) + player.lastPlayerInput = input + } + fun getModifiedVelocity(original: Vec3d) = runSafe { if (!yMotion) return@runSafe original diff --git a/src/main/resources/lambda.accesswidener b/src/main/resources/lambda.accesswidener index c446edbb0..ce3882ce2 100644 --- a/src/main/resources/lambda.accesswidener +++ b/src/main/resources/lambda.accesswidener @@ -49,6 +49,7 @@ transitive-accessible method net/minecraft/entity/LivingEntity applyArmorToDamag transitive-accessible method net/minecraft/entity/Entity isAlwaysInvulnerableTo (Lnet/minecraft/entity/damage/DamageSource;)Z transitive-accessible field net/minecraft/entity/player/PlayerInventory equipment Lnet/minecraft/entity/EntityEquipment; transitive-accessible method net/minecraft/client/network/ClientPlayerEntity applyMovementSpeedFactors (Lnet/minecraft/util/math/Vec2f;)Lnet/minecraft/util/math/Vec2f; +transitive-accessible field net/minecraft/client/network/ClientPlayerEntity lastPlayerInput Lnet/minecraft/util/PlayerInput; transitive-accessible field net/minecraft/entity/EntityEquipment map Ljava/util/EnumMap; transitive-accessible method net/minecraft/entity/LivingEntity getHandSwingDuration ()I transitive-accessible method net/minecraft/client/network/ClientPlayerInteractionManager syncSelectedSlot ()V From ddc3f3527d53deb34183c5be8a6d291a0d0c6502 Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Thu, 5 Nov 2026 12:03:29 +1100 Subject: [PATCH 2/8] fix: make Bounce's sprint real Bounce had isSprinting say true while gliding, without the speed sprinting adds, so off the glide it walked at walking speed with the flag on, which Grim set back every move. It now sprints for real, from start-flying on, while canSprintOrFly allows it. --- .../lambda/mixin/entity/ClientPlayerEntityMixin.java | 7 +++++++ .../java/com/lambda/mixin/entity/EntityMixin.java | 11 ----------- .../movement/elytrafly/modes/BounceElytraFly.kt | 8 ++++++++ src/main/resources/lambda.accesswidener | 1 + 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java b/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java index 136c9d2d4..f0edaaba9 100644 --- a/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java +++ b/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java @@ -27,6 +27,7 @@ import com.lambda.module.modules.render.ViewModel; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; @@ -153,6 +154,12 @@ boolean modifyIsSprinting(boolean original) { return EventFlow.post(new MovementEvent.Sprint(original)).getSprint(); } + // Bounce glides without forward input, which would stop the sprint every tick + @WrapWithCondition(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;setSprinting(Z)V")) + private boolean wrapSetSprinting(ClientPlayerEntity instance, boolean sprinting) { + return sprinting || !ElytraFly.getBounceMode().keepsSprint(instance); + } + @ModifyReturnValue(method = "isSneaking", at = @At("RETURN")) boolean injectSneakingInput(boolean original) { ClientPlayerEntity self = (ClientPlayerEntity) (Object) this; diff --git a/src/main/java/com/lambda/mixin/entity/EntityMixin.java b/src/main/java/com/lambda/mixin/entity/EntityMixin.java index 99fb142f6..bdce83c27 100644 --- a/src/main/java/com/lambda/mixin/entity/EntityMixin.java +++ b/src/main/java/com/lambda/mixin/entity/EntityMixin.java @@ -175,17 +175,6 @@ private boolean wrapSetPitch(Entity instance, float yaw) { return RotationManager.getLockPitch() == null; } - @ModifyReturnValue(method = "isSprinting()Z", at = @At("RETURN")) - private boolean injectIsSprinting(boolean original) { - var player = getMc().player; - if ((Object) this != getMc().player) return original; - - if (ElytraFly.getBounceMode().isEnabled() && player.isGliding()) - return true; - - return original; - } - @ModifyReturnValue(method = "getPose", at = @At("RETURN")) private EntityPose injectGetPose(EntityPose original) { var player = getMc().player; diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 9ed0263b9..0f6712cd9 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -45,6 +45,7 @@ import com.lambda.util.math.minus import com.lambda.util.player.PlayerUtils.canStartGliding import com.lambda.util.player.PlayerUtils.canTakeoff import net.minecraft.client.input.KeyboardInput.getMovementMultiplier +import net.minecraft.client.network.ClientPlayerEntity import net.minecraft.entity.Entity import net.minecraft.network.packet.Packet import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket @@ -125,6 +126,8 @@ class BounceElytraFly( listen { pauseTimer.tick() wantJump = false + // A sprint doesn't start by itself while gliding + if (keepsSprint(player) && !player.isSprinting) player.isSprinting = true if (autoPitch) { rotationRequest { @@ -267,6 +270,8 @@ class BounceElytraFly( sendJumpKey(true) // Kept down into the next move, as a press would be wantJump = true + // Now, as the flags the server echoes for a later sprint can end the next glide + if (keepsSprint(player) && !player.isSprinting) player.isSprinting = true } private fun SafeContext.sendJumpKey(down: Boolean) { @@ -276,6 +281,9 @@ class BounceElytraFly( player.lastPlayerInput = input } + fun keepsSprint(player: ClientPlayerEntity) = + isEnabled && player.isGliding && player.canSprintOrFly() + fun getModifiedVelocity(original: Vec3d) = runSafe { if (!yMotion) return@runSafe original diff --git a/src/main/resources/lambda.accesswidener b/src/main/resources/lambda.accesswidener index ce3882ce2..1acc244f0 100644 --- a/src/main/resources/lambda.accesswidener +++ b/src/main/resources/lambda.accesswidener @@ -64,6 +64,7 @@ transitive-accessible field net/minecraft/entity/Entity FLAGS Lnet/minecraft/ent transitive-accessible field net/minecraft/block/entity/BeaconBlockEntity level I transitive-accessible method net/minecraft/entity/LivingEntity canGlide ()Z transitive-accessible method net/minecraft/entity/player/PlayerEntity canGlide ()Z +transitive-accessible method net/minecraft/entity/player/PlayerEntity canSprintOrFly ()Z # Camera transitive-accessible method net/minecraft/client/render/Camera setPos (DDD)V From f5adff9f32e9e5ed807ff9fb9c3b411cc36a0d5e Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Thu, 5 Nov 2026 12:03:30 +1100 Subject: [PATCH 3/8] fix: keep Bounce hopping through setbacks Bounce stopped jumping in the pause after a setback, so it stayed on the ground after landing, and the server ended the glide. --- .../movement/elytrafly/modes/BounceElytraFly.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 0f6712cd9..41eb46785 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -110,7 +110,9 @@ class BounceElytraFly( private var interrupting = false private val flightPaused - get() = !pauseTimer.hasSurpassed(flagPause) || interrupting || BaritoneHandler.isActive + get() = !pauseTimer.hasSurpassed(flagPause) || bouncingStopped + private val bouncingStopped + get() = interrupting || BaritoneHandler.isActive private val SafeContext.queuePackets get() = fakeLag && player.isGliding && (!yMotionSetting || !onYMotionAngle) && @@ -164,7 +166,12 @@ class BounceElytraFly( } } - if (flightPaused) return@listen + if (bouncingStopped) return@listen + if (flightPaused) { + // Staying on the ground after a landing ends the glide + if (player.isOnGround && (player.isGliding || (takeoff && player.canTakeoff))) wantJump = jump + return@listen + } if (!player.isGliding) { if (takeoff && player.canTakeoff) { @@ -221,7 +228,7 @@ class BounceElytraFly( return@listen } if (!wantJump) return@listen - if (flightPaused) return@listen + if (bouncingStopped) return@listen input.jump() } From 8c95be540e3691b9577c8251fab970631c2e9d8f Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:54:59 +1100 Subject: [PATCH 4/8] fix: cap how long Fake Lag holds Stuck against something, nothing ended a hold: on 2b2t that held everything back for 13 s, and the server dropped the connection. --- .../modules/movement/elytrafly/modes/BounceElytraFly.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 41eb46785..34d6ef8d0 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -78,6 +78,7 @@ class BounceElytraFly( private val minimizePackets by c.setting("Minimize Packets", true, "Shrinks the amount of start fly packets sent to the server as much as possible") private val fakeLag by c.setting("Fake Lag", true, "Emulates the player lagging to allow flying in 1x2 tunnels") .onValueChange { _, to -> if (!to) flushPackets() } + private val maxHold by c.setting("Max Hold", 10, 1..100, 1, "How long Fake Lag can hold packets", "ticks") { fakeLag } @Group(Y_MOTION_GROUP) val yMotionSetting by c.setting("Y Motion", false, "Cancels the players y velocity to aid speed") @Group(Y_MOTION_GROUP) val onlyOnDiagonal: Boolean by c.setting("Only On Diagonal", true, "Only use y motion when the player is flying on a non-axial angle") { yMotionSetting } @@ -103,6 +104,7 @@ class BounceElytraFly( private var wantJump = false private var prevGliding: Boolean? = null private val pauseTimer = TickTimer() + private val holdTimer = TickTimer() private val pingPackets = ConcurrentLinkedQueue() private val sendPacketQueue = LinkedList>() private var sneakLeft = false @@ -202,6 +204,8 @@ class BounceElytraFly( listen({ -100 }) { interrupting = false + if (sendPacketQueue.isNotEmpty() || pingPackets.isNotEmpty()) holdTimer.tick() + if (holdTimer.hasSurpassed(maxHold)) flushPackets() } listen { event -> @@ -260,6 +264,7 @@ class BounceElytraFly( } private fun SafeContext.flushPackets() { + holdTimer.reset() while (sendPacketQueue.isNotEmpty()) { val packet = sendPacketQueue.poll() connection.sendPacketSilently(packet) From d5db027e4b296abe3bbc8b94ec7607c1eaa00d5c Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:55:17 +1100 Subject: [PATCH 5/8] fix: don't hold Fake Lag's setback answers The server takes no moves after a setback until its confirm and the move after it, so holding those had it set Bounce back again. --- .../movement/elytrafly/modes/BounceElytraFly.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 34d6ef8d0..976417893 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -50,6 +50,8 @@ import net.minecraft.entity.Entity import net.minecraft.network.packet.Packet import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket +import net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket import net.minecraft.network.packet.s2c.common.CommonPingS2CPacket import net.minecraft.util.PlayerInput import net.minecraft.util.math.Vec2f @@ -107,6 +109,7 @@ class BounceElytraFly( private val holdTimer = TickTimer() private val pingPackets = ConcurrentLinkedQueue() private val sendPacketQueue = LinkedList>() + private var answeringSetback = false private var sneakLeft = false private var sneakRight = false private var interrupting = false @@ -237,13 +240,17 @@ class BounceElytraFly( } listen({ 1 }) { event -> - if (queuePackets) { - sendPacketQueue.add(event.packet) + val packet = event.packet + // The server takes no moves until it has a setback's confirm and the move after it + if (packet is TeleportConfirmC2SPacket) answeringSetback = true + if (queuePackets && !answeringSetback) { + sendPacketQueue.add(packet) event.cancel() return@listen } flushPackets() + if (packet is PlayerMoveC2SPacket) answeringSetback = false } listen({ 1 }) { event -> if (event.packet is CommonPingS2CPacket && queuePackets) { @@ -257,6 +264,7 @@ class BounceElytraFly( onDisable { wantJump = false prevGliding = false + answeringSetback = false flushPackets() sneakLeft = false sneakRight = false From 1811413459cacfc0d55a1e850d95c67fd704aaa1 Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:55:45 +1100 Subject: [PATCH 6/8] fix: only hold packets sent on the game thread Keep-alives are answered from the network thread, where Fake Lag held them in the game thread's queue, and a flush from there threw, losing the answer and timing the player out. --- .../module/modules/movement/elytrafly/modes/BounceElytraFly.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 976417893..9c2ee512f 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -240,6 +240,8 @@ class BounceElytraFly( } listen({ 1 }) { event -> + // Keep-alives are answered from the network thread, and the queue is the game thread's + if (!mc.isOnThread) return@listen val packet = event.packet // The server takes no moves until it has a setback's confirm and the move after it if (packet is TeleportConfirmC2SPacket) answeringSetback = true From ee6f44d697b5d2136ba88baa5a593dcee826d3ec Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Thu, 5 Nov 2026 13:18:33 +1100 Subject: [PATCH 7/8] fix: hold Fake Lag's pongs, not its pings Pings were held as they arrived, ahead of packets still waiting for the game thread, so a setback's confirm answered the ping Grim sends after it, and Grim set back again: 76 of 77 such setbacks on 2b2t. Flushing them also answered pings held together in reverse order. Pings are now answered in turn, and Fake Lag holds the pongs instead. --- .../movement/elytrafly/modes/BounceElytraFly.kt | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 9c2ee512f..9a9691d3d 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -35,7 +35,6 @@ import com.lambda.module.modules.movement.elytrafly.ElytraFly.fakeFly import com.lambda.module.modules.movement.elytrafly.ObstaclePassingMode import com.lambda.module.modules.movement.elytrafly.PasserSettings import com.lambda.threading.runSafe -import com.lambda.util.PacketUtils.handlePacketSilently import com.lambda.util.PacketUtils.sendPacketSilently import com.lambda.util.SpeedUnit import com.lambda.util.TickTimer @@ -52,12 +51,10 @@ import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket import net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket -import net.minecraft.network.packet.s2c.common.CommonPingS2CPacket import net.minecraft.util.PlayerInput import net.minecraft.util.math.Vec2f import net.minecraft.util.math.Vec3d import java.util.* -import java.util.concurrent.ConcurrentLinkedQueue import kotlin.math.abs import kotlin.math.cos import kotlin.math.pow @@ -107,7 +104,7 @@ class BounceElytraFly( private var prevGliding: Boolean? = null private val pauseTimer = TickTimer() private val holdTimer = TickTimer() - private val pingPackets = ConcurrentLinkedQueue() + // Holds pongs too, so Grim gets them in order with the moves private val sendPacketQueue = LinkedList>() private var answeringSetback = false private var sneakLeft = false @@ -207,7 +204,7 @@ class BounceElytraFly( listen({ -100 }) { interrupting = false - if (sendPacketQueue.isNotEmpty() || pingPackets.isNotEmpty()) holdTimer.tick() + if (sendPacketQueue.isNotEmpty()) holdTimer.tick() if (holdTimer.hasSurpassed(maxHold)) flushPackets() } @@ -254,12 +251,6 @@ class BounceElytraFly( flushPackets() if (packet is PlayerMoveC2SPacket) answeringSetback = false } - listen({ 1 }) { event -> - if (event.packet is CommonPingS2CPacket && queuePackets) { - pingPackets.add(event.packet) - event.cancel() - } - } onFlag { pauseTimer.reset() } @@ -279,10 +270,6 @@ class BounceElytraFly( val packet = sendPacketQueue.poll() connection.sendPacketSilently(packet) } - while (pingPackets.isNotEmpty()) { - val packet = pingPackets.poll() - connection.handlePacketSilently(packet) - } } // Sent like pressing jump mid-air, which Grim checks for From 66bb52e8a8b63793facb32a5e73df98424be69dd Mon Sep 17 00:00:00 2001 From: blocksimus <336769374+blocksimus@users.noreply.github.com> Date: Thu, 5 Nov 2026 13:18:33 +1100 Subject: [PATCH 8/8] fix: stop the obstacle passer getting stuck A setback before moving off the start gave the passer no direction to search along, and it never finished beside the line, as Baritone stops a block short of its goal and the check wanted the exact block. --- .../movement/elytrafly/ObstaclePassingMode.kt | 15 +++++++++------ .../movement/elytrafly/modes/BounceElytraFly.kt | 4 +--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ObstaclePassingMode.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ObstaclePassingMode.kt index 36f5cfe17..4ef52496e 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ObstaclePassingMode.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ObstaclePassingMode.kt @@ -60,9 +60,10 @@ abstract class ObstaclePassingMode( } onFlag { if (!passerConfig.passObstacles || !passerConfig.walkWhenFlagged) return@onFlag - val snappedDir = getSnappedDir() - val closestLinePoint = player.pos.findClosestPointOnLine(snappedDir) runGameScheduled { + if (!movedFromStart()) return@runGameScheduled + val snappedDir = getSnappedDir() + val closestLinePoint = player.pos.findClosestPointOnLine(snappedDir) val delta = snappedDir.multiply(passerConfig.obstacleLookAhead.toDouble()) val pathToPoint = closestLinePoint.add(delta) pathToValidPoint(pathToPoint, snappedDir) @@ -82,16 +83,16 @@ abstract class ObstaclePassingMode( if (!passerConfig.passObstacles) return false val playerPos = player.pos - val validDistanceFromStart = Vec3d(playerPos.x, startPos.y, playerPos.z) dist startPos > 0.1 - if (!validDistanceFromStart) return false + if (!movedFromStart()) return false val snappedDir = getSnappedDir() val closestLinePoint = playerPos.findClosestPointOnLine(snappedDir) passingToPos?.let { passingTo -> if (passingTo distSq startPos < playerPos distSq startPos) { - val atClosestPointBlockPos = closestLinePoint.blockPos == player.blockPos - if (!atClosestPointBlockPos) pathToValidPoint(closestLinePoint, snappedDir, false) + // Baritone stops beside a GoalGetToBlock's block, so count beside as there + val atClosestPoint = GoalGetToBlock(closestLinePoint.blockPos).isInGoal(player.blockPos) + if (!atClosestPoint) pathToValidPoint(closestLinePoint, snappedDir, false) else { BaritoneHandler.cancel() passingToPos = null @@ -135,6 +136,8 @@ abstract class ObstaclePassingMode( return false } + protected fun SafeContext.movedFromStart() = Vec3d(player.x, startPos.y, player.z) dist startPos > 0.1 + protected fun SafeContext.getSnappedDir(): Vec3d { val travelDiff = player.pos.subtract(startPos).normalize().let { Vec3d(it.x, 0.0, it.z) } return lockYawToStep(travelDiff) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt index 9a9691d3d..107100c65 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/elytrafly/modes/BounceElytraFly.kt @@ -38,7 +38,6 @@ import com.lambda.threading.runSafe import com.lambda.util.PacketUtils.sendPacketSilently import com.lambda.util.SpeedUnit import com.lambda.util.TickTimer -import com.lambda.util.math.dist import com.lambda.util.math.distSq import com.lambda.util.math.minus import com.lambda.util.player.PlayerUtils.canStartGliding @@ -146,9 +145,8 @@ class BounceElytraFly( if (handlePassingObstacles()) return@listen if (yMotionSetting && strictYMotionRange && onYMotionAngle) run yMotionCorrection@ { + if (!movedFromStart()) return@yMotionCorrection val playerPos = player.pos - val validDistanceFromStart = Vec3d(playerPos.x, startPos.y, playerPos.z) dist startPos > 0.1 - if (!validDistanceFromStart) return@yMotionCorrection val snappedDir = getSnappedDir() val closestLinePoint = playerPos.findClosestPointOnLine(snappedDir)