Skip to content

Update BlockItemPacketRewriter1_9.java - #699

Merged
florianreuth merged 5 commits into
ViaVersion:masterfrom
Term4:set_player_inventory_fix
Jul 25, 2026
Merged

Update BlockItemPacketRewriter1_9.java#699
florianreuth merged 5 commits into
ViaVersion:masterfrom
Term4:set_player_inventory_fix

Conversation

@Term4

@Term4 Term4 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Problem
1.21.2, servers can update a single player-inventory slot via ClientboundSetPlayerInventory. ViaBackwards maps that to CONTAINER_SET_SLOT with window id -2

The 1.8 client's handleSetSlot only handles window -1, 0, and the oopen container's id. No -2 case, so these updates are silently dropped. This leads to the inventory only resyncing on a full window refresh (when a player opens and closes their inventory). Any server that uses this packet for inventorry updates (AHEM Minestom, but also some edge cases in vanilla, or custom vanilla servers) have this issue.

@Beaness

Beaness commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Is this specifically 1.9 that started supporting this?
Also wouldn't the slot need different recalculation based on what window you have open (as the player inventory slot ids change I think)

@Term4

Term4 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Is this specifically 1.9 that started supporting this? Also wouldn't the slot need different recalculation based on what window you have open (as the player inventory slot ids change I think)

Updated! Also yes, I checked and it was specifically the 1.9 -> 1.8 rewriter. I sent those pics on discord unless you need them here too.

@Beaness

Beaness commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Even though the server sends the slot count, the client only uses that slot count for dynamic inventories, I think for inventories like brewing stands, furnaces, ... it'd be better to have a hardcoded slot count that ignores the server send slot count (as that isn't used for slot recalculation)

@florianreuth

Copy link
Copy Markdown
Member

Agreeing with @Beaness here, this should match the client's behavior.

@Term4
Term4 force-pushed the set_player_inventory_fix branch from 13a06cf to 9726bbd Compare July 8, 2026 19:06
@Term4
Term4 force-pushed the set_player_inventory_fix branch from 9726bbd to 637df4a Compare July 12, 2026 23:22

@florianreuth florianreuth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems okay for me, thank you

@florianreuth
florianreuth merged commit 315a1a0 into ViaVersion:master Jul 25, 2026
1 check passed
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