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
convertClientInventorySlot
(int slot) Used to convert the clients inventory slot to a Minestom slot.static int
convertPlayerInventorySlot
(int slot, int offset) Converts a packet slot to an internal one.static int
convertSlot
(int slot, int offset) static int
convertToPacketSlot
(int slot) Used to convert internal slot to one used in packets
-
Field Details
-
OFFSET
public static final int 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
-
convertPlayerInventorySlot
public static int convertPlayerInventorySlot(int slot, int offset) Converts a packet slot to an internal one.- Parameters:
slot
- the packet slotoffset
- the slot count separating the up part of the inventory to the bottom part (armor/craft in PlayerInventory, inventory slots in others) the offset for the player inventory isOFFSET
- Returns:
- a packet which can be use internally with Minestom
-
convertSlot
public static int convertSlot(int slot, int offset) -
convertToPacketSlot
public static int convertToPacketSlot(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
-
convertClientInventorySlot
public static int convertClientInventorySlot(int slot) Used to convert the clients inventory slot to a Minestom slot. The client's inventory does not count the crafting slots.- Parameters:
slot
- the client slot- Returns:
- a slot which can be used internally with Minestom
-