Skip to content

Commit

Permalink
[Bleeding] Fix logic for calculating slot in Creative mode. Fixes BUK…
Browse files Browse the repository at this point in the history
…KIT-4715

Previously, hotbar slots for player inventory would return 9 - 18 while in
Creative mode, rather than 0 - 9. This commit fixes the logic used for
calculating the returned slot based on the raw slot.
  • Loading branch information
gmcferrin authored and Wolvereness committed Jan 26, 2014
1 parent 4b0e6ba commit 43d61f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/bukkit/inventory/InventoryView.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.bukkit.inventory;

import org.bukkit.GameMode;
import org.bukkit.entity.HumanEntity;
import org.bukkit.event.inventory.InventoryType;

Expand Down Expand Up @@ -174,6 +175,9 @@ public final int convertSlot(int rawSlot) {
return rawSlot;
}
int slot = rawSlot - numInTop;
if (getPlayer().getGameMode() == GameMode.CREATIVE && getType() == InventoryType.PLAYER) {
return slot;
}
if (getType() == InventoryType.CRAFTING) {
if(slot < 4) return 39 - slot;
else slot -= 4;
Expand Down

0 comments on commit 43d61f1

Please sign in to comment.