From 3890d12105effd29cfb4d104fd1b332144b7ecb1 Mon Sep 17 00:00:00 2001 From: SamB440 Date: Thu, 5 Sep 2024 16:45:29 +0100 Subject: [PATCH] Fix strider speed outside of lava --- .../movementtick/MovementTickerStrider.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/ac/grim/grimac/predictionengine/movementtick/MovementTickerStrider.java b/src/main/java/ac/grim/grimac/predictionengine/movementtick/MovementTickerStrider.java index da3ab356db..9460f4e570 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/movementtick/MovementTickerStrider.java +++ b/src/main/java/ac/grim/grimac/predictionengine/movementtick/MovementTickerStrider.java @@ -4,6 +4,7 @@ import ac.grim.grimac.utils.data.packetentity.PacketEntityStrider; import ac.grim.grimac.utils.nmsutil.BlockProperties; import com.github.retrooper.packetevents.protocol.attribute.Attributes; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags; import com.github.retrooper.packetevents.protocol.world.states.type.StateType; import com.github.retrooper.packetevents.util.Vector3d; @@ -34,8 +35,6 @@ public static boolean isAbove(GrimPlayer player) { public void livingEntityAIStep() { super.livingEntityAIStep(); - ((PacketEntityStrider) player.compensatedEntities.getSelf().getRiding()).isShaking = true; - StateType posMaterial = player.compensatedWorld.getStateTypeAt(player.x, player.y, player.z); StateType belowMaterial = BlockProperties.getOnPos(player, player.mainSupportingBlockData, new Vector3d(player.x, player.y, player.z)); @@ -48,7 +47,10 @@ public void livingEntityAIStep() { @Override public float getSteeringSpeed() { PacketEntityStrider strider = (PacketEntityStrider) player.compensatedEntities.getSelf().getRiding(); - return (float) strider.getAttributeValue(Attributes.GENERIC_MOVEMENT_SPEED) * (strider.isShaking ? 0.23F : 0.55F); + // Unsure which version the speed changed in + final boolean newSpeed = player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20); + final float coldSpeed = newSpeed ? 0.35F : 0.23F; + return (float) strider.getAttributeValue(Attributes.GENERIC_MOVEMENT_SPEED) * (strider.isShaking ? coldSpeed : 0.55F); } @Override