From 31e54c4036c18d9cf3af061d53a501e6af5e43dd Mon Sep 17 00:00:00 2001 From: SamB440 Date: Sat, 30 May 2026 20:19:27 +0100 Subject: [PATCH 1/4] Fix javaY precision --- .../org/geysermc/geyser/level/physics/CollisionManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java index c0650289488..4afce334e4c 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java @@ -159,6 +159,8 @@ public BoundingBox getActiveBoundingBox() { return playerBoundingBox; } + private static final double PLAYER_OFFSET = Double.parseDouble(Float.toString(EntityDefinitions.PLAYER.offset())); + /** * Adjust the Bedrock position before sending to the Java server to account for inaccuracies in movement between * the two versions. Will also send corrected movement packets back to Bedrock if they collide with pistons. @@ -174,9 +176,11 @@ public BoundingBox getActiveBoundingBox() { if (pistonCache.isPlayerAttachedToHoney()) { return null; } + // We need to parse the float as a string since casting a float to a double causes us to // lose precision and thus, causes players to get stuck when walking near walls - double javaY = Double.parseDouble(Float.toString(bedrockPosition.getY())) - EntityDefinitions.PLAYER.offset(); + double rawY = Double.parseDouble(Float.toString(bedrockPosition.getY())); + double javaY = rawY - PLAYER_OFFSET; Vector3d position = Vector3d.from(Double.parseDouble(Float.toString(bedrockPosition.getX())), javaY, Double.parseDouble(Float.toString(bedrockPosition.getZ()))); From f853a2cefc633a87eaa1759075509c36193b8949 Mon Sep 17 00:00:00 2001 From: SamB440 Date: Sat, 30 May 2026 20:32:38 +0100 Subject: [PATCH 2/4] Fix player offset --- .../main/java/org/geysermc/geyser/entity/EntityDefinitions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java index 44bdcb43f1a..2be84169306 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -692,7 +692,7 @@ public final class EntityDefinitions { EntityDefinition avatarEntityBase = EntityDefinition.inherited(null, livingEntityBase) .height(1.8f).width(0.6f) - .offset(1.62f) + .offset(1.62001f) .addTranslator(null) // Player main hand .addTranslator(MetadataTypes.BYTE, AvatarEntity::setSkinVisibility) .build(); From 6072be7718759802a982d9a2a201105a982ba077 Mon Sep 17 00:00:00 2001 From: SamB440 Date: Sat, 30 May 2026 21:40:37 +0100 Subject: [PATCH 3/4] Clarify player offset --- .../main/java/org/geysermc/geyser/entity/EntityDefinitions.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java index 2be84169306..9032ef02b04 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -692,6 +692,7 @@ public final class EntityDefinitions { EntityDefinition avatarEntityBase = EntityDefinition.inherited(null, livingEntityBase) .height(1.8f).width(0.6f) + // This is the offset sent by Bedrock in its player position. Verified on Bedrock 26.23. .offset(1.62001f) .addTranslator(null) // Player main hand .addTranslator(MetadataTypes.BYTE, AvatarEntity::setSkinVisibility) From 456865ddaaba27fc94fc8f524af21c8dd5f73ab4 Mon Sep 17 00:00:00 2001 From: SamB440 Date: Mon, 1 Jun 2026 18:47:59 +0100 Subject: [PATCH 4/4] Implement requested changes --- .../org/geysermc/geyser/level/physics/CollisionManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java index 4afce334e4c..161d0df499e 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java @@ -61,6 +61,7 @@ public class CollisionManager { public static final BlockCollision FLUID_COLLISION = new OtherCollision(new BoundingBox[]{new BoundingBox(0.5, 0.25, 0.5, 1, 0.5, 1)}); // If you read this, feel free to suggest a more proper way to detect the Bedrock player's own onGround status instead of using a margin private static final double POSITION_ADJUSTMENT_MARGIN = 0.05; + private static final double PLAYER_OFFSET = Double.parseDouble(Float.toString(EntityDefinitions.PLAYER.offset())); private final GeyserSession session; @@ -159,8 +160,6 @@ public BoundingBox getActiveBoundingBox() { return playerBoundingBox; } - private static final double PLAYER_OFFSET = Double.parseDouble(Float.toString(EntityDefinitions.PLAYER.offset())); - /** * Adjust the Bedrock position before sending to the Java server to account for inaccuracies in movement between * the two versions. Will also send corrected movement packets back to Bedrock if they collide with pistons. @@ -179,8 +178,7 @@ public BoundingBox getActiveBoundingBox() { // We need to parse the float as a string since casting a float to a double causes us to // lose precision and thus, causes players to get stuck when walking near walls - double rawY = Double.parseDouble(Float.toString(bedrockPosition.getY())); - double javaY = rawY - PLAYER_OFFSET; + double javaY = Double.parseDouble(Float.toString(bedrockPosition.getY())) - PLAYER_OFFSET; Vector3d position = Vector3d.from(Double.parseDouble(Float.toString(bedrockPosition.getX())), javaY, Double.parseDouble(Float.toString(bedrockPosition.getZ())));