Skip to content

Item Repair ​

The repair system lets equipment enter a disabled state when durability would break instead of disappearing; players then repair disabled equipment with the configured materials or currency

Disabled durability behavior ​

As durability approaches zero, the plugin runs these four steps:

  1. PlayerItemDamageEvent is cancelled so the item does not disappear
  2. Item damage is set to max damage and the item is marked disabled
  3. PDC stores emakiitem:disabled (BYTE=1)
  4. The on_disabled action list runs

This flow applies only to items with repair enabled; items without repair still break under vanilla rules

While you hold a disabled item in the main hand, its triggers no longer run, and attacking an entity fails the attack check so the damage event is cancelled

Configuration ​

All repair fields live at the top level of an item definition under repair:

FieldTypeRequiredDefaultRangeDescriptionExample
enabledbooleanNofalsetrue / falseWhether repair is enabled. When false or missing, the whole repair block is inactive (equivalent to being unconfigured)true
materialslistNoempty—Material repair list; an entry is loaded only with a resolvable source (or matcher) and a non-blank restoresee below
economyobjectNodisabled—Currency repair configurationsee below
disabled_displayobjectNoempty—Display overrides while the item is disabledname_prefix: "<dark_gray>[Broken] </dark_gray>"
disabled_display.name_prefixstringNo""—String prepended to the item name while disabled"<dark_gray>[Broken] </dark_gray>"
disabled_display.lore_appendlistNoempty—Lore lines appended while disabled- "<red>This item is broken; its stats are inactive.</red>"
on_disabledlistNoempty—Actions executed when the item becomes disabled- 'send_message text="..."'
on_repairedlistNoempty—Actions executed after repair- 'play_sound sound=...'

Material fields ​

FieldTypeRequiredDefaultRangeDescriptionExample
item_sourceslistNoempty—Allowed material item sources (ItemSource shorthand). This is the only accepted key name (item_source and item are retired)- "minecraft-diamond"
matcherobjectNononesee Item MatcherOptional non-item-source conditions (component, PDC, lore, variable), ANDed with the sibling item_sourcestype: component
amountintegerNo1>= 1 (the source applies max(1, value))Required amount1
restorestringYesnonea fixed integer or an N% percentageDurability restored; a percentage is relative to max_damage. A missing or non-numeric value drops the entry"50%"

item_sources and matcher are sibling fields and both must hold. Item source conditions must not be written inside matcher — type: item_source and its aliases are rejected at load time and never match

A material entry loads only when it has both a resolvable source and a non-blank restore

DANGER

repair.materials[].matcher is supported, but item.source in the same file is not

item.source says which vanilla item to build the custom item from; a matcher there stops the item from being created. repair.materials[] decides whether an incoming item counts as repair material, which is what matchers are for. The two look alike and mean entirely different things — see Only input-matching fields support matcher

yaml
repair:
  enabled: true
  materials:
    # Accepts only netherite ingots that have never been renamed
    - item_sources:
        - minecraft-netherite_ingot
      matcher:
        type: component
        component: custom_name
        operator: absent
      amount: 1
      restore: "50%"

Economy fields ​

FieldTypeRequiredDefaultRangeDescriptionExample
enabledbooleanNotrue when a valid currency entry existstrue / falseWhether currency repair is enabled. When missing, it is treated as enabled if any valid currency entry existstrue
restorestringNo"100%"a fixed integer or an N% percentageDurability restored per currency repair; a percentage is relative to max_damage"100%"
currencieslistNoempty—Currency cost listsee below

currencies entry fields:

FieldTypeRequiredDefaultRangeDescriptionExample
providerstringNoauto—Economy provider; blank falls back to auto, and a non-blank value is lowercasedvault
currency_idstringNo""—Currency ID; leave blank to use the provider defaultdefault
amountnumberNo0>= 0 (the source applies max(0, value))Fixed cost. When greater than 0 it applies directly and the formula is ignored100
base_costnumberNo0>= 0 (the source applies max(0, value))Base cost, referenced as base_cost in the formula100
cost_formulastringNo""—Cost formula. Available variables are max_damage, damage, current_damage, missing_durability, missing_ratio, restore_amount, restore_ratio, and base_cost"100 + missing_durability * 0.25"
display_namestringNo""—Currency name shown in messages; falls back to currency_id, then provider, when blankCoins

A cost entry is kept only when it produces a positive amount; entries sharing a provider and currency_id are merged and summed. If charging fails, already-debited currency is rolled back

Repair paths ​

The game offers two repair paths

Direct inventory repair: you hold repair material on the cursor and click the disabled item. The cursor amount must be at least the material entry's amount. On a match, the material is consumed, durability is restored, and on_repaired runs

Repair interface: use /ei repair to open gui/repair_gui.yml. The interface provides a target equipment slot (target_item), four material slots (material_input_1 through material_input_4), a preview slot (preview_display), and material repair (material_repair) and economy repair (economy_repair) buttons. Shift-clicking inventory items inserts them quickly. When repair finishes or the interface closes, the equipment and any unconsumed materials are returned to the player; if the inventory is full they are dropped and the player is notified

Whichever path you take, the repair:

  • damage reduced by the restore value;
  • the PDC disabled flag cleared automatically once damage is below max damage;
  • the on_repaired action list running

Going through the interface additionally refreshes player items, recalculates sets, and schedules Attribute equipment sync after a successful repair

Repair event ​

Whether you repair with materials or currency, the cancellable ItemRepairEvent fires before charging and restoring durability; listeners may override the restore amount or cancel the repair. See Events API

Example ​

yaml
id: legendary_sword
item:
  source: minecraft-netherite_sword
  components:
    custom_name: "<gold>Legendary Sword</gold>"
repair:
  enabled: true
  materials:
    - item_sources:
        - "minecraft-netherite_ingot"
      amount: 1
      restore: "50%"
    - item_sources:
        - "minecraft-diamond"
      amount: 3
      restore: 200
  economy:
    enabled: true
    restore: "100%"
    currencies:
      - provider: "vault"
        currency_id: "default"
        display_name: "Coins"
        cost_formula: "100 + missing_durability * 0.25"
  on_disabled:
    - 'send_message text="<red>Your equipment broke!</red>"'
    - "play_sound sound=minecraft:entity.item.break volume=1 pitch=0.5"
  on_repaired:
    - 'send_message text="<green>Equipment repaired!</green>"'
    - "play_sound sound=minecraft:block.anvil.use volume=1 pitch=1.2"

Action context ​

on_disabled injects item_id. On the interface path, on_repaired injects item_id, repair_source (material or economy), and restore; the direct inventory path injects only item_id