diff options
author | md_5 <git@md-5.net> | 2016-04-24 12:30:55 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-04-24 12:31:02 +1000 |
commit | d884ab38d82eeab912a9cf866b5b704e60702679 (patch) | |
tree | f983d41ce7b4a2e063fd794119efc7096ec9e200 /src/main/java/org | |
parent | 78434e8910379dc42d0c9f439d815a6f40eaf2c8 (diff) | |
download | craftbukkit-d884ab38d82eeab912a9cf866b5b704e60702679.tar craftbukkit-d884ab38d82eeab912a9cf866b5b704e60702679.tar.gz craftbukkit-d884ab38d82eeab912a9cf866b5b704e60702679.tar.lz craftbukkit-d884ab38d82eeab912a9cf866b5b704e60702679.tar.xz craftbukkit-d884ab38d82eeab912a9cf866b5b704e60702679.zip |
SPIGOT-2211: Fix offhand slot client refresh
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java index 09023860..51a8b4e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -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))); } |