Skip to content

Fix: Teleports on chests causing players to get stuck#6421

Merged
onebeastchris merged 8 commits into
GeyserMC:masterfrom
onebeastchris:fix/chest-collisions
May 26, 2026
Merged

Fix: Teleports on chests causing players to get stuck#6421
onebeastchris merged 8 commits into
GeyserMC:masterfrom
onebeastchris:fix/chest-collisions

Conversation

@onebeastchris
Copy link
Copy Markdown
Member

We now check if the Bedrock player is standing on any blocks (currently, only chests) that have a different collision size; and then bump the teleport position up. Otherwise, we teleport the player into the chest, which causes the player to "fall through it" - which causes the server to re-send the teleport, causing a loop. Thanks to oxy's ChestCollision impl we'd correct the movement to match Java collisions anyways, so this correction would be only on the Bedrock player's end.

To reproduce it currently:

  • Stand on a chest block (of any kind)
  • run /tp @s @s
  • ...voila!

Note: AI tools were used in the making of the PR, but the final changes are manually reviewed & tested by me and do resolve the issue. Would appreciate a look over GeyserPlayerEntity#adjustPositionForBedrock - maybe there's a cleaner way to do it?

We now check if the Bedrock player is standing on any blocks (currently, only chests) that have a different collision size
Copilot AI review requested due to automatic review settings May 20, 2026 22:05
@onebeastchris onebeastchris added the PR: Bugfix When a PR contains a bugfix label May 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent Bedrock players from getting stuck in a teleport loop when teleported while standing on blocks whose Bedrock collision height differs from Java (currently implemented for chests). It does so by computing an “adjusted” Bedrock-side teleport position and using it for teleport confirmation / client positioning.

Changes:

  • Add a per-block hook (BlockCollision#pushUpForTeleport) and implement it for chests to define a Bedrock-side Y “bump” for teleports.
  • Extend TeleportCache to store an adjusted teleport position and use it for teleport confirmation and SessionPlayerEntity#bedrockPosition() during unconfirmed teleports.
  • Refactor CollisionManager#collidableBlocksIterator to a static helper and update call sites.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java Reorders teleport caching and introduces session-aware TeleportCache construction.
core/src/main/java/org/geysermc/geyser/translator/collision/fixes/SeaPickleCollision.java Comment punctuation fix.
core/src/main/java/org/geysermc/geyser/translator/collision/fixes/ChestCollision.java Adds chest-specific pushUpForTeleport() bump value.
core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java Introduces pushUpForTeleport() API and Javadoc link.
core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java Stores adjustedPosition and uses it for teleport confirmation; constructors now take session.
core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Makes collidableBlocksIterator static and updates internal use.
core/src/main/java/org/geysermc/geyser/entity/vehicle/VehicleComponent.java Updates iterator call to new static helper.
core/src/main/java/org/geysermc/geyser/entity/vehicle/BoatVehicleComponent.java Updates iterator call to new static helper and adds import.
core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java Adds adjustPositionForBedrock and uses adjusted teleport position while unconfirmed.
core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java Updates iterator call to new static helper and adds import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java Outdated
Copilot AI review requested due to automatic review settings May 24, 2026 18:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Comment thread core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Outdated
Comment thread core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Outdated
@onebeastchris onebeastchris force-pushed the fix/chest-collisions branch from 1cd32d8 to bfe1ee5 Compare May 25, 2026 11:22
Comment thread core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Outdated
Copilot AI review requested due to automatic review settings May 26, 2026 07:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

public class CollisionManager {
public static final BlockCollision SOLID_COLLISION = new SolidCollision(null);
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 else
Comment thread core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Outdated
Comment thread core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Outdated
Copilot AI review requested due to automatic review settings May 26, 2026 10:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Comment thread core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Outdated
Comment thread core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java Outdated
Changed POSITION_ADJUSTMENT_MARGIN to private and updated comment for clarity.
Copilot AI review requested due to automatic review settings May 26, 2026 10:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

@onebeastchris onebeastchris merged commit 13bf67f into GeyserMC:master May 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bugfix When a PR contains a bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants