🔧Change Item Format
The change_item Ability passes its nested changes section use Change Item Format. Change rules run in YAML order against the current item, so a later rule sees metadata written by an earlier rule.
type: change_item
item:
selector: MAIN_HAND
holder: PLAYER
changes: {}The change item format of EnchantmentReform is almost same as MythicChanger's one, so please click here to view it's Wiki to know basic format of them, this page will only show the thing availble in this plugin.
Power variables inside changes
This allows a reusable variable to depend on the item currently being changed:
variables:
repair-amount: '{max-damage} * {level} * 0.1'
enchant-level-change: -1
powers:
on-item-damage:
abilities:
emergency-repair:
type: change_item
item: TRIGGER_ITEM
changes:
modify-enchants:
enchantmentreform:emergency_repair: '{enchant-level-change}'
repair-damage: '{repair-amount}'At execution time, {repair-amount} first expands to {max-damage} * {level} * 0.1; the current item's maximum durability and the triggering enchantment level are then substituted before the expression is calculated.
Variables may also contain numeric trigger-context placeholders such as {original_item_damage} when the current trigger provides them. Field-specific placeholders are resolved by their owning rule afterward, so a modify-enchants variable may also contain {current-level} or {max-level}.
Because rules execute in YAML order and ObjectSingleChange keeps its current ItemMeta synchronized, a variable used by a later rule observes metadata changes made by earlier rules in the same changes section.
modify-enchants
Changes the current levels of normal item enchantments without rebuilding or serializing the item.
Additive shorthand
A scalar value is treated as a level delta:
For an item with Looting III and Unbreaking I, the result is Looting II and Unbreaking III.
The minecraft: namespace may be omitted for vanilla enchantments:
Custom enchantments use their complete namespaced key:
Operation form
Each enchantment may instead use an operation section:
operation
ADD
ADD, SUBTRACT, MULTIPLY, or SET. Unknown values use ADD.
value
0
Operand. Supports mathematical expressions and ChangeItem placeholders.
Field-specific placeholders
{current-level}
The enchantment level currently stored on the item. Missing enchantments use 0.
{max-level}
The registered maximum level of that enchantment.
The normal ChangeItem placeholders remain available, including {level}, {amount}, {max-stack}, {damage}, {max-damage}, and {original-damage}.
Behavior and limits
The calculated result is rounded to the nearest integer.
A result less than or equal to
0removes the enchantment.A positive result adds or replaces the enchantment using unsafe level handling, so compatibility and vanilla maximum-level restrictions are not enforced.
A missing enchantment starts at level
0; a positive additive result may therefore add it.Unknown enchantment keys are skipped.
Invalid or non-finite expressions are reported and skipped instead of removing the enchantment.
This rule changes normal item enchantments. Stored enchantments on enchanted books are not affected.
Registry lookups are cached by normalized enchantment key, and each execution reads the requested level directly from
ItemMetarather than serializing or scanning the whole item format.
Decrease one level and remove at zero
Looting III
Looting II
Looting II
Looting I
Looting I
Enchantment removed
No Looting
No change
Last updated