EnchantmentBuilder

Properties

Link copied to clipboard
val id: ResourceLocation

Functions

Link copied to clipboard
fun anvilCost(anvilCost: Int)

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

Link copied to clipboard
fun compatibility(compatibility: (Enchantment) -> Boolean)

Sets the compatibility of this enchantment with other enchantments.

Link copied to clipboard
fun compatibleWith(vararg enchantments: Enchantment)

Defines with which enchantments this enchantment is compatible. All other enchantments are incompatible.

Link copied to clipboard
fun curse(curse: Boolean)

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

Link copied to clipboard
fun enchants(canEnchant: (ItemStack) -> Boolean)

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

Link copied to clipboard
fun enchantsPrimary(canEnchant: (ItemStack) -> Boolean)

Sets the items for which this enchantment can show up in the enchanting table.

Link copied to clipboard
fun incompatibleWith(vararg enchantments: Enchantment)

Sets the compatibility of this enchantment with other enchantments.

Link copied to clipboard
fun localizedName(localizedName: String)

Sets the localization key of the enchantment.

Link copied to clipboard
fun maxLevel(maxLevel: Int)

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

Link copied to clipboard
fun name(name: Component)

Sets the name of the enchantment.

Link copied to clipboard
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
fun tableDiscoverable(tableDiscoverable: Boolean)

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

Link copied to clipboard
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.

fun tableLevelRequirement(tableLeveRequirement: IntRange)

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

Link copied to clipboard
fun tradeable(tradeable: Boolean)

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

Link copied to clipboard
fun treasure(treasure: Boolean)

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