primaryItemTag
- Parameters:
tag- the item tag the enchanting table offers the enchantment for- Returns:
- this builder
- Since:
- 0.1.0
EnchantmentDefinitionEnchantmentDefinition.
The supported items are mandatory. Other values default to: the translatable description
enchantment.<namespace>.<value>, a maximum level of 1, a weight of 1, an
anvil cost of 1, a minimum cost of 1 + 10 per level, a maximum cost of
21 + 10 per level and the EquipmentSlotGroup.ANY slot group.
anvilCost(int anvilCost) behaviour(EnchantmentBehaviour behaviour) build()description(Component description) effectsJson(@Nullable String json) effects object of
a data pack enchantment, for instance
{"minecraft:damage": [{"effect": {"type": "minecraft:add", "value": 2}}]}.minecraft:exclusive_set/damage.exclusiveWith(Collection<TypedKey<EnchantmentDefinition>> enchantments) maxCost(int base,
int perLevelAboveFirst) maxLevel(int maxLevel) minCost(int base,
int perLevelAboveFirst) primaryItems(Collection<TypedKey<Item>> items) primaryItemTag(TagKey<Item> tag) default EnchantmentDefinition.Builderslots(EquipmentSlotGroup... slots) slots(Collection<EquipmentSlotGroup> slots) supportedItems(Collection<TypedKey<Item>> items) supportedItemTag(TagKey<Item> tag) weight(int weight) description - the name of the enchantment, without its leveltag - the item tag the enchantment can be applied to, such as
minecraft:enchantable/weaponitems - the items the enchantment can be applied toIllegalArgumentException - if items is emptytag - the item tag the enchanting table offers the enchantment foritems - the items the enchanting table offers the enchantment forminecraft:exclusive_set/damage. The tag is created if it does not exist.tag - the enchantment tagenchantments - the incompatible enchantmentsmaxLevel - the maximum level, between 1 and 255IllegalArgumentException - if the level is out of rangeweight - the weight in random selections, between 1 and
1024IllegalArgumentException - if the weight is out of rangeanvilCost - the base anvil cost per levelIllegalArgumentException - if the cost is negativebase - the minimum cost at level 1perLevelAboveFirst - the cost added by each level above the firstbase - the maximum cost at level 1perLevelAboveFirst - the cost added by each level above the firstslots - the equipment slots in which the enchantment is activeIllegalArgumentException - if slots is emptyslots - the equipment slots in which the enchantment is activeIllegalArgumentException - if no slot is giveneffects object of
a data pack enchantment, for instance
{"minecraft:damage": [{"effect": {"type": "minecraft:add", "value": 2}}]}.
Every component is sent to clients; the server runs the supported ones.
json - the effects JSON object, or null to remove every effect componentIllegalArgumentException - if the JSON is malformed or contains an unknown componentbehaviour - the server-side behaviour of the enchantmentIllegalStateException - if no supported item was set