Skip to content

server/session: Send the held hotbar slot when a player spawns - #1483

Open
ezchr wants to merge 1 commit into
df-mc:masterfrom
ezchr:fix/held-slot-on-spawn
Open

ezchr wants to merge 1 commit into
df-mc:masterfrom
ezchr:fix/held-slot-on-spawn

Conversation

@ezchr

@ezchr ezchr commented Oct 31, 2026

Copy link
Copy Markdown

Session.Spawn sends the inventories but not the selected hotbar slot, so the client keeps whichever slot it had selected while the server uses the loaded HeldSlot. A client that is already in a world when it spawns, for example one moved between servers by a proxy, then holds a different item than the server thinks until it changes slot.

This sends PlayerHotBar with the held slot after the inventories, as the vanilla server does after sending a player's inventory.

@MEMOxiiii MEMOxiiii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM
Tested before and after the change
The hotbar slot updates correctly when switching servers

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.

2 participants