Enum Class PlayerInventorySection

java.lang.Object
java.lang.Enum<PlayerInventorySection>
net.xun.lib.common.api.inventory.PlayerInventorySection
All Implemented Interfaces:
Serializable, Comparable<PlayerInventorySection>, Constable

public enum PlayerInventorySection extends Enum<PlayerInventorySection>
Represents inventory sections with dynamic slot ranges and validation.

Provides both predefined player inventory sections and tools for creating custom slot ranges. Handles container size validation and inverted ranges automatically.

Predefined Sections (Minecraft Player Inventory):

  • HOTBAR (0-8 inclusive)
  • MAIN_INVENTORY (9-35 inclusive)
  • ARMOR (36-39 inclusive)
  • OFFHAND (slot 40)
  • ALL (0-40 inclusive)
  • Enum Constant Details

  • Method Details

    • values

      public static PlayerInventorySection[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PlayerInventorySection valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getStart

      public int getStart()
    • getEnd

      public int getEnd()
    • getSlotRange

      public SlotRange getSlotRange()
      Creates a dynamic slot range that adapts to container size.
    • matches

      public boolean matches(int slot)
      Checks if a slot belongs to this section in a standard player inventory.