13
0
geforkt von Mirrors/Paper

[Bleeding] Fix logic for calculating slot in Creative mode. Fixes BUKKIT-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.

By: GJ <gjmcferrin@gmail.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2013-12-16 23:09:35 -05:00
Ursprung c44805468e
Commit 158b3ce2c1

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.inventory;
import org.bukkit.GameMode;
import org.bukkit.entity.HumanEntity;
import org.bukkit.event.inventory.InventoryType;
@ -174,6 +175,9 @@ public abstract class InventoryView {
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;