mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 17:22:55 +01:00
SPIGOT-2211: Fix offhand slot client refresh
By: md_5 <git@md-5.net>
This commit is contained in:
parent
d106bad54b
commit
4b22260d42
1 changed files with 6 additions and 3 deletions
|
@ -95,10 +95,13 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
|
|||
// to reverse the order of the index from 8. That means we need 0 to correspond to 8, 1 to correspond to 7,
|
||||
// 2 to correspond to 6, and 3 to correspond to 5. We do this simply by taking the result of (index - 36) and
|
||||
// subtracting that value from 8.
|
||||
if (index < PlayerInventory.getHotbarSize())
|
||||
index = index + 36;
|
||||
else if (index > 35)
|
||||
if (index < PlayerInventory.getHotbarSize()) {
|
||||
index += 36;
|
||||
} else if (index > 39) {
|
||||
index += 5; // Off hand
|
||||
} else if (index > 35) {
|
||||
index = 8 - (index - 36);
|
||||
}
|
||||
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.defaultContainer.windowId, index, CraftItemStack.asNMSCopy(item)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue