Skip to content

Fix: Shelf block entity items rendered in wrong slot for Bedrock clients#6225

Merged
onebeastchris merged 2 commits intoGeyserMC:masterfrom
LPettay:fix/shelf-slot-offset-pr
Mar 12, 2026
Merged

Fix: Shelf block entity items rendered in wrong slot for Bedrock clients#6225
onebeastchris merged 2 commits intoGeyserMC:masterfrom
LPettay:fix/shelf-slot-offset-pr

Conversation

@LPettay
Copy link
Contributor

@LPettay LPettay commented Mar 8, 2026

Bedrock determines shelf item position by list index, not by a Slot tag. The previous implementation streamed Java's sparse Items list (which only contains occupied slots), so items would shift left into the wrong visual position. For example, an item in slot 1 (middle) would appear in slot 0 (left) on Bedrock.

This fix produces a dense 3-element list with empty item entries for unoccupied slots, so each item lands at the correct list index matching its Java Slot value.

Before: [{item}] → Bedrock renders in slot 0 (wrong)
After: [{empty}, {item}, {empty}] → Bedrock renders in slot 1 (correct)

Tested on a Velocity + Paper server with both Java and Bedrock clients connected.

Bedrock determines shelf item position by list index rather than
a Slot tag, so a sparse Items list causes items to shift left into
the wrong visual position. This produces a dense 3-element list
with empty entries for unoccupied slots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@LPettay
Copy link
Contributor Author

LPettay commented Mar 8, 2026

Video demonstration of issue pre/post fix

shelf-fix-demo.mp4

@onebeastchris
Copy link
Member

Hello! Thank you for the PR. In the future, please indicate to which extent AI tools have been used - we'll get out AI policy online asap.

Tested BDS handling, which matches the changes implemented in this PR:

[16:32:30:462] [CLIENT BOUND] - BlockEntityDataPacket(blockPosition=(96, 63, 101), data={
  "Items": [
    {
      "Count": 64b,
      "Damage": 0s,
      "Name": "minecraft:shulker_shell",
      "WasPickedUp": 0b
    },
    {
      "Count": 0b,
      "Damage": 0s,
      "Name": "",
      "WasPickedUp": 0b
    },
    {
      "Count": 64b,
      "Damage": 0s,
      "Name": "minecraft:nautilus_shell",
      "WasPickedUp": 0b
    }
  ],
  "id": "Shelf",
  "isMovable": 1b,
  "x": 96i,
  "y": 63i,
  "z": 101i
})

Copy link
Member

@onebeastchris onebeastchris left a comment

Choose a reason for hiding this comment

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

LGTM

@onebeastchris onebeastchris merged commit 2f1cb9b into GeyserMC:master Mar 12, 2026
2 checks passed
onebeastchris added a commit to onebeastchris/Geyser that referenced this pull request Mar 18, 2026
…nts (GeyserMC#6225)

* Fix: Shelf block entity items rendered in wrong slot for Bedrock clients

Bedrock determines shelf item position by list index rather than
a Slot tag, so a sparse Items list causes items to shift left into
the wrong visual position. This produces a dense 3-element list
with empty entries for unoccupied slots.

* Move static final EMPTY_ITEM variable to BedrockItemBuilder, add comment with last tested note

---------

Co-authored-by: onebeastchris <github@onechris.mozmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants