Interface EnchantmentRegistryEntry

All Known Subinterfaces:
EnchantmentRegistryEntry.Builder

@Experimental @NullMarked @NonExtendable public interface EnchantmentRegistryEntry
A data-centric version-specific registry entry for the Enchantment type.
  • Method Details

    • description

      Component description()
      Provides the description of this enchantment entry as displayed to the client, e.g. "Sharpness" for the sharpness enchantment.
      Returns:
      the description component.
    • supportedItems

      RegistryKeySet<ItemType> supportedItems()
      Provides the registry key set referencing the items this enchantment is supported on.
      Returns:
      the registry key set.
    • primaryItems

      Provides the registry key set referencing the item types this enchantment can be applied to when enchanting in an enchantment table.

      If this value is null, supportedItems() will be sourced instead in the context of an enchantment table. Additionally, the tag EnchantmentTagKeys.IN_ENCHANTING_TABLE defines which enchantments can even show up in an enchantment table.

      Returns:
      the registry key set.
    • weight

      @org.jetbrains.annotations.Range(from=1L, to=1024L) int weight()
      Provides the weight of this enchantment used by the weighted random when selecting enchantments.
      Returns:
      the weight value.
      See Also:
    • maxLevel

      @org.jetbrains.annotations.Range(from=1L, to=255L) int maxLevel()
      Provides the maximum level this enchantment can have when applied.
      Returns:
      the maximum level.
    • minimumCost

      Provides the minimum cost needed to enchant an item with this enchantment.

      Note that a cost is not directly related to the consumed xp.

      Returns:
      the enchantment cost.
      See Also:
    • maximumCost

      Provides the maximum cost allowed to enchant an item with this enchantment.

      Note that a cost is not directly related to the consumed xp.

      Returns:
      the enchantment cost.
      See Also:
    • anvilCost

      @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int anvilCost()
      Provides the cost of applying this enchantment using an anvil.

      Note that this is halved when using an enchantment book, and is multiplied by the level of the enchantment. See https://minecraft.wiki/w/Anvil_mechanics for more information.

      Returns:
      the anvil cost of this enchantment
    • activeSlots

      Provides a list of slot groups this enchantment may be active in.

      If the item enchanted with this enchantment is equipped in a slot not covered by the returned list and its groups, the enchantment's effects, like attribute modifiers, will not activate.

      Returns:
      a list of equipment slot groups.
      See Also:
    • exclusiveWith

      RegistryKeySet<Enchantment> exclusiveWith()
      Provides the registry key set of enchantments that this enchantment is exclusive with.

      Exclusive enchantments prohibit the application of this enchantment to an item if they are already present on said item.

      Returns:
      a registry set of enchantments exclusive to this one.