Class PlayerInventoryUtils

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

public final class PlayerInventoryUtils extends Object
  • Field Details

  • Method Details

    • convertPlayerInventorySlot

      public static int convertPlayerInventorySlot(int slot, int offset)
      Converts a packet slot to an internal one.
      Parameters:
      slot - the packet slot
      offset - 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 is OFFSET
      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