Class EnchantmentTableInventory

All Implemented Interfaces:
InventoryClickHandler, Taggable, TagReadable, TagWritable, Viewable

public class EnchantmentTableInventory extends Inventory
  • Constructor Details

    • EnchantmentTableInventory

      public EnchantmentTableInventory(@NotNull @NotNull Component title)
    • EnchantmentTableInventory

      public EnchantmentTableInventory(@NotNull @NotNull String title)
  • Method Details

    • getLevelRequirement

      public short getLevelRequirement(EnchantmentTableInventory.EnchantmentSlot enchantmentSlot)
      Gets the level requirement in a slot.
      Parameters:
      enchantmentSlot - the slot to check the level requirement
      Returns:
      the level requirement of the slot
    • setLevelRequirement

      public void setLevelRequirement(EnchantmentTableInventory.EnchantmentSlot enchantmentSlot, short level)
      Sets the level requirement of a slot.
      Parameters:
      enchantmentSlot - the slot
      level - the level
    • getSeed

      public short getSeed()
      Gets the enchantment seed.
      Returns:
      the enchantment seed
    • setSeed

      public void setSeed(short seed)
      Sets the enchantment seed.
      Parameters:
      seed - the enchantment seed
    • getEnchantmentShown

      public DynamicRegistry.Key<Enchantment> getEnchantmentShown(@NotNull @NotNull EnchantmentTableInventory.EnchantmentSlot enchantmentSlot)
      Gets the enchantment shown in a slot.
      Parameters:
      enchantmentSlot - the enchantment slot
      Returns:
      the enchantment shown in the slot, null if it is hidden
    • setEnchantmentShown

      public void setEnchantmentShown(@NotNull @NotNull EnchantmentTableInventory.EnchantmentSlot enchantmentSlot, @Nullable DynamicRegistry.Key<Enchantment> enchantment)
      Sets the enchantment shown in a slot.

      Can be set to null to hide it.

      Parameters:
      enchantmentSlot - the enchantment slot
      enchantment - the enchantment
    • getEnchantmentLevel

      public short getEnchantmentLevel(EnchantmentTableInventory.EnchantmentSlot enchantmentSlot)
      Gets the enchantment level shown on mouse hover.
      Parameters:
      enchantmentSlot - the enchantment slot
      Returns:
      the level shown, -1 if no enchant
    • setEnchantmentLevel

      public void setEnchantmentLevel(EnchantmentTableInventory.EnchantmentSlot enchantmentSlot, short level)
      Sets the enchantment level shown on mouse hover.

      Can be set to -1 if no enchant.

      Parameters:
      enchantmentSlot - the enchantment slot
      level - the level shown