Interface EnchantmentType

All Superinterfaces:
ComponentLike, DefaultedRegistryValue

@CatalogedBy(EnchantmentTypes.class) public interface EnchantmentType extends DefaultedRegistryValue, ComponentLike
Represents a modifier on an item that has various effects.
  • Method Details

    • weight

      int weight()
      Gets the weight of this enchantment type.

      Higher values are more common. This value is also used in the repair cost calculation.

      Returns:
      The weight of this enchantment type
    • minimumLevel

      int minimumLevel()
      Gets the minimum level of this enchantment type allowed where it is present.
      Returns:
      The minimum level
    • maximumLevel

      int maximumLevel()
      Gets the maximum level of this enchantment type normally allowed.
      Returns:
      The maximum level
    • minimumEnchantabilityForLevel

      int minimumEnchantabilityForLevel(int level)
      Gets the minimum item enchantability for this level to be normally added by enchanting tables.
      Parameters:
      level - The enchantment type level
      Returns:
      The minimum enchantability
    • maximumEnchantabilityForLevel

      int maximumEnchantabilityForLevel(int level)
      Gets the maximum item enchantability for this level to be normally added by enchanting tables.
      Parameters:
      level - The enchantment type level
      Returns:
      The maximum enchantability
    • canBeAppliedToStack

      boolean canBeAppliedToStack(ItemStack stack)
      Test if this enchantment type can be applied to an ItemStack.
      Parameters:
      stack - The item stack to check
      Returns:
      Whether this enchantment type can be applied
    • canBeAppliedByTable

      boolean canBeAppliedByTable(ItemStack stack)
      Test if this enchantment type can be applied to an ItemStack by the EnchantmentTable.
      Parameters:
      stack - Te item stack to check
      Returns:
      Whether this enchantment type can be applied by the enchantment table
    • isCompatibleWith

      boolean isCompatibleWith(EnchantmentType enchantmentType)
      Test if this enchantment type can be applied along with another enchantment type.
      Parameters:
      enchantmentType - The enchantment type to test compatibility with
      Returns:
      Whether these enchantment types are compatible
    • isTreasure

      boolean isTreasure()
      Gets whether or not this enchantment type is considered a "treasure" enchantment.

      These do not occur naturally in enchantment tables.

      Returns:
      Whether this enchantment type is a treasure enchantment type
    • isCurse

      boolean isCurse()
      Gets whether or not this enchantment type is considered a "curse" enchantment.
      Returns:
      Whether this enchantment type is a curse enchantment type