Interface AnvilView

All Superinterfaces:
InventoryView

public interface AnvilView extends InventoryView
An instance of InventoryView which provides extra methods related to anvil view data.
  • Method Details

    • getTopInventory

      @NotNull @NotNull AnvilInventory getTopInventory()
      Description copied from interface: InventoryView
      Get the upper inventory involved in this transaction.
      Specified by:
      getTopInventory in interface InventoryView
      Returns:
      the inventory
    • getRenameText

      @Nullable @Nullable String getRenameText()
      Gets the rename text specified within the anvil's text field.
      Returns:
      The text within the anvil's text field if an item is present otherwise null
    • getRepairItemCountCost

      int getRepairItemCountCost()
      Gets the amount of items needed to repair.
      Returns:
      The amount of materials required to repair the item
    • getRepairCost

      int getRepairCost()
      Gets the experience cost needed to repair.
      Returns:
      The repair cost in experience
    • getMaximumRepairCost

      int getMaximumRepairCost()
      Gets the maximum repair cost needed to repair.
      Returns:
      The maximum repair cost in experience
    • setRepairItemCountCost

      void setRepairItemCountCost(int amount)
      Sets the amount of repair materials required to repair the item.
      Parameters:
      amount - the amount of repair materials
    • setRepairCost

      void setRepairCost(int cost)
      Sets the repair cost in experience.
      Parameters:
      cost - the experience cost to repair
    • setMaximumRepairCost

      void setMaximumRepairCost(int levels)
      Sets maximum repair cost in experience.
      Parameters:
      levels - the levels to set
    • bypassesEnchantmentLevelRestriction

      boolean bypassesEnchantmentLevelRestriction()
      Returns whether this view will bypass the vanilla enchantment level restriction when applying enchantments to an item or not.

      By default, vanilla will limit enchantments applied to items to the respective Enchantment.getMaxLevel(), even if the applied enchantment itself is above said limit. Disabling this limit via bypassEnchantmentLevelRestriction(boolean) allows for, e.g., enchanted books to be applied fully, even if their enchantments are beyond the limit.

      Returns:
      true if this view bypasses the vanilla restrictions.
    • bypassEnchantmentLevelRestriction

      void bypassEnchantmentLevelRestriction(boolean bypassEnchantmentLevelRestriction)
      Sets if enchantments applied via this anvil view may bypass vanilla's level restrictions.
      Parameters:
      bypassEnchantmentLevelRestriction - if this view bypasses the vanilla level restrictions.
      See Also: