Class PlayerInventoryUtils
java.lang.Object
net.minestom.server.utils.inventory.PlayerInventoryUtils
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
convertMinestomSlotToPlayerInventorySlot
(int minestomSlot) Used to convert a Minestom slot to a player inventory slot.static int
convertMinestomSlotToWindowSlot
(int slot) Used to convert internal slot to one used in packetsstatic int
convertPlayerInventorySlotToMinestomSlot
(int slot) Used to convert a player inventory slot from a client to a Minestom slot.static int
convertWindow0SlotToMinestomSlot
(int slot) Converts a window packet slot to a Minestom one.static int
convertWindowSlotToMinestomSlot
(int slot, int offset) static boolean
isHotbarOrOffHandSlot
(int minestomSlot) Returns true if the given minestom slot is on the hotbar or offhand, false otherwise.static boolean
isPlayerInventorySlot
(int minestomSlot) Returns true if the given Minestom slot is valid as a Player inventory slot (ie is it not a crafting grid slot)
-
Field Details
-
WINDOW_0_OFFSET
public static final int WINDOW_0_OFFSET- See Also:
-
CRAFT_RESULT
public static final int CRAFT_RESULT- See Also:
-
CRAFT_SLOT_1
public static final int CRAFT_SLOT_1- See Also:
-
CRAFT_SLOT_2
public static final int CRAFT_SLOT_2- See Also:
-
CRAFT_SLOT_3
public static final int CRAFT_SLOT_3- See Also:
-
CRAFT_SLOT_4
public static final int CRAFT_SLOT_4- See Also:
-
HELMET_SLOT
public static final int HELMET_SLOT- See Also:
-
CHESTPLATE_SLOT
public static final int CHESTPLATE_SLOT- See Also:
-
LEGGINGS_SLOT
public static final int LEGGINGS_SLOT- See Also:
-
BOOTS_SLOT
public static final int BOOTS_SLOT- See Also:
-
OFFHAND_SLOT
public static final int OFFHAND_SLOT- See Also:
-
-
Method Details
-
isHotbarOrOffHandSlot
public static boolean isHotbarOrOffHandSlot(int minestomSlot) Returns true if the given minestom slot is on the hotbar or offhand, false otherwise. -
convertWindow0SlotToMinestomSlot
public static int convertWindow0SlotToMinestomSlot(int slot) Converts a window packet slot to a Minestom one.- Parameters:
slot
- the packet slot- Returns:
- a slot which can be use internally with Minestom
-
convertWindowSlotToMinestomSlot
public static int convertWindowSlotToMinestomSlot(int slot, int offset) -
isPlayerInventorySlot
public static boolean isPlayerInventorySlot(int minestomSlot) Returns true if the given Minestom slot is valid as a Player inventory slot (ie is it not a crafting grid slot) -
convertMinestomSlotToPlayerInventorySlot
public static int convertMinestomSlotToPlayerInventorySlot(int minestomSlot) Used to convert a Minestom slot to a player inventory slot. Only valid for some slots, should be tested withisPlayerInventorySlot(int)
first. -
convertMinestomSlotToWindowSlot
public static int convertMinestomSlotToWindowSlot(int slot) Used to convert internal slot to one used in packets- Parameters:
slot
- the internal slot- Returns:
- a slot id which can be used for packets
-
convertPlayerInventorySlotToMinestomSlot
public static int convertPlayerInventorySlotToMinestomSlot(int slot) Used to convert a player inventory slot from a client to a Minestom slot. See above for description- Parameters:
slot
- the client slot- Returns:
- a slot which can be used internally with Minestom
-