EnchantmentBuilder

sealed interface EnchantmentBuilder : RegistryEntryBuilder.Paper<Enchantment>

A builder for enchantments.

Properties

Link copied to clipboard
abstract val entry: RegistryEntry.Paper<Enchantment>

The entry of the element being built.

Functions

Link copied to clipboard
abstract fun anvilCost(anvilCost: Int)

Configures the cost of this enchantment in an anvil. Defaults to 4.

Link copied to clipboard
abstract fun curse(curse: Boolean)

Whether this enchantment is a curse enchantment. Defaults to false.

Link copied to clipboard
abstract fun enchants(items: RegistryEntrySet.Paper<ItemType>)

Sets the item types to which this enchantment can be applied to, for example, in an anvil.

Link copied to clipboard
abstract fun enchantsPrimary(items: RegistryEntrySet.Paper<ItemType>)

Sets the item types for which this enchantment can show up in the enchanting table (if tableDiscoverable). If unspecified, defaults to the set of item types defined in enchants.

Link copied to clipboard
abstract fun incompatibleWith(enchantments: RegistryEntrySet.Paper<Enchantment>)

Sets the enchantments that are incompatible (exclusive) with this enchantment.

Link copied to clipboard
open fun localizedName(localizedName: String)

Sets the localization key of the enchantment.

Link copied to clipboard
abstract fun maxLevel(maxLevel: Int)

Configures the maximum level of this enchantment. Defaults to 1.

Link copied to clipboard
abstract fun name(name: Component)

Sets the name of the enchantment.

Link copied to clipboard
abstract fun rarity(weight: Int)

The rarity of this enchantment. The value is used as a weight, so enchantments with a higher value are more common. Defaults to 10.

Link copied to clipboard
abstract fun tableDiscoverable(tableDiscoverable: Boolean)

Whether this enchantment can appear in the enchanting table. Defaults to false.

Link copied to clipboard
abstract fun tableLevelRequirement(tableLeveRequirement: (level: Int) -> IntRange)

Configures the level range where the enchantment can appear in an enchanting table slot, based on the enchantment level.

abstract fun tableLevelRequirement(tableLeveRequirement: IntRange)

Configures the level range where the enchantment can appear in an enchanting table slot.

Link copied to clipboard
abstract fun tags(vararg tags: RegistryEntrySet.Paper.Tag<Enchantment>)

Adds the entry of the element being build to the given tags.

Link copied to clipboard
abstract fun tradeable(tradeable: Boolean)

Whether this enchantment can be traded with villagers. Defaults to false.

Link copied to clipboard
abstract fun treasure(treasure: Boolean)

Whether this enchantment is a treasure enchantment. Defaults to false.