diff options
author | Pokechu22 <Pokechu022@gmail.com> | 2017-05-26 20:03:53 -0700 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-05-28 10:31:18 +1000 |
commit | 17ec944682dfbd068b1ec47cf352db6cb43edf1d (patch) | |
tree | 22e381fc33d47206aa6005731588718e9f2cf43b /src | |
parent | 1f3b0516a644fe37fdee0626f137dd65d4fcd88d (diff) | |
download | bukkit-17ec944682dfbd068b1ec47cf352db6cb43edf1d.tar bukkit-17ec944682dfbd068b1ec47cf352db6cb43edf1d.tar.gz bukkit-17ec944682dfbd068b1ec47cf352db6cb43edf1d.tar.lz bukkit-17ec944682dfbd068b1ec47cf352db6cb43edf1d.tar.xz bukkit-17ec944682dfbd068b1ec47cf352db6cb43edf1d.zip |
SPIGOT-3272: Fix convertSlot in creative
Creative's slots are indexed the same as the survival crafting inventory, and thus the same transforms that happen in survival should happen in creative.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/inventory/InventoryView.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java index 2677e94d..35c7d2bd 100644 --- a/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/src/main/java/org/bukkit/inventory/InventoryView.java @@ -1,6 +1,5 @@ package org.bukkit.inventory; -import org.bukkit.GameMode; import org.bukkit.entity.HumanEntity; import org.bukkit.event.inventory.InventoryType; @@ -228,13 +227,9 @@ public abstract class InventoryView { // Move down the slot index by the top size int slot = rawSlot - numInTop; - // Creative mode players have one contiguous inventory dictated by the client - if (getPlayer().getGameMode() == GameMode.CREATIVE && getType() == InventoryType.PLAYER) { - return slot; - } - // Player crafting slots are indexed differently. The matrix is caught by the first return. - if (getType() == InventoryType.CRAFTING) { + // Creative mode is the same, except that you can't see the crafting slots (but the IDs are still used) + if (getType() == InventoryType.CRAFTING || getType() == InventoryType.CREATIVE) { /** * Raw Slots: * @@ -247,7 +242,7 @@ public abstract class InventoryView { * 27 28 29 30 31 32 33 34 35 * 36 37 38 39 40 41 42 43 44 */ - + /** * Converted Slots: * |