Repairable Items
Durability is set with vanilla components too, so any EcoItem can wear out, be repaired at an anvil with the materials you choose, be enchanted, or never break at all. This page covers giving an item durability and making it repairable, on top of a standard item.
Quick start
Open your item's config in
/plugins/EcoItems/items/.Add
minecraft:max_damageto give it durability, plusminecraft:max_stack_size: 1.Add
minecraft:repairablewith the items that repair it.Run
/ecoitems reload.Damage the item (or set its durability with
/ecoitems durability <remaining>), then combine it with a repair item in an anvil to confirm it repairs.
The structure of a repairable item
| Part | What it controls |
|---|---|
| Item | The base item, display, and recipe, identical to any EcoItem |
minecraft:max_damage | Total durability |
minecraft:repairable | The items that repair it in an anvil |
minecraft:enchantable | How well it enchants at an enchanting table |
minecraft:repair_cost | The starting anvil cost |
minecraft:unbreakable | Whether it never loses durability |
# === Item: a normal EcoItem ===
item:
item: iron_pickaxe
name: "&bMithril Pickaxe"
# === Durability and repair, as vanilla components ===
components:
"minecraft:max_stack_size": 1 # Items with durability can't stack
"minecraft:max_damage": 1200 # Total durability
# Read here: https://minecraft.wiki/w/Data_component_format#repairable
"minecraft:repairable":
items: "#minecraft:diamond_tool_materials" # An item, a list of items, or a #tag
# Read here: https://minecraft.wiki/w/Data_component_format#enchantable
"minecraft:enchantable":
value: 10 # Enchantability; iron is 14, diamond is 10, gold is 22
"minecraft:repair_cost": 0 # Optional; extra anvil levels, grows with each use
Item
The item: section is the same as any other EcoItem; see How to Make an Item. Basing the item on a vanilla tool, weapon, or armor piece means it already has durability, repair materials, and enchantability, so you only override what changes.
Durability
minecraft:max_damage is the item's total durability. It needs minecraft:max_stack_size: 1, since an item can't be both damageable and stackable. minecraft:damage sets how much durability a fresh copy has already lost.
To make an item that never wears out, add minecraft:unbreakable instead:
components:
"minecraft:unbreakable": {}
Repairing
minecraft:repairable lists the items that repair it in an anvil. items takes a single item ID, a list of IDs, or an item tag starting with #, such as #minecraft:iron_tool_materials. Each repair item restores a quarter of the durability, like vanilla.
Players can also repair an item by combining two copies in an anvil, like vanilla tools. /ecoitems repair fully repairs the held item for operators.
Enchanting
minecraft:enchantable sets the item's enchantability, which affects how good the enchantments from an enchanting table are. Which enchantments apply is decided by the base item's type and tags. minecraft:repair_cost is the extra level cost added in an anvil, which vanilla increases every time the item is worked on.
Where to go next
Tools and weapons: Custom Tools and Custom Weapons for items that wear out as they're used.
Commands: Commands and Permissions for
/ecoitems repairand/ecoitems durability.The base item: How to Make an Item for the shared item, display, and recipe fields.