Class PlayerInventoryUtils

java.lang.Object
net.minestom.server.utils.inventory.PlayerInventoryUtils

public final class PlayerInventoryUtils extends Object
  • Field Details

  • 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 with isPlayerInventorySlot(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