Commit c18612b
committed
Fix inventory desync for <1.17 clients on 1.17+ servers
This addresses the known issue where <1.17 clients experience inventory
desyncs on certain inventory click actions when connected to 1.17+ servers.
The root cause is threefold:
1. Carried item not forwarded from CONTAINER_SET_CONTENT (1.17.1->1.17)
In 1.17.1+, CONTAINER_SET_CONTENT includes a carried/cursor item
field that doesn't exist in <1.17 formats. The handler stripped
this field and stored it internally, but never forwarded it to the
client. This caused the cursor to remain desynced after cancelled
clicks.
Fix: Send the carried item as a separate CONTAINER_SET_SLOT packet
(windowId=-1, slot=-1) so the client's cursor state is properly
synced.
2. Empty changedSlots array in CONTAINER_CLICK translation (1.17->1.16.4)
The serverbound CONTAINER_CLICK was translated with an empty
changedSlots array. The server uses this to detect client-server
desync and send corrections. With an empty array, the server
skipped sending corrections for cancelled InventoryClickEvents.
Fix: For PICKUP mode (mode 0), include the clicked slot with a
null predicted value so the server detects the desync and sends
a SET_SLOT correction.
For non-PICKUP modes (shift-click, swap, throw, drag, etc.)
which affect multiple unpredictable slots, force a state ID
mismatch to trigger a full CONTAINER_SET_CONTENT resync.1 parent 827c00f commit c18612b
2 files changed
Lines changed: 32 additions & 3 deletions
File tree
- common/src/main/java/com/viaversion/viabackwards/protocol
- v1_17_1to1_17
- v1_17to1_16_4/rewriter
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| |||
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
88 | 107 | | |
89 | 108 | | |
90 | 109 | | |
| |||
0 commit comments