Item repair



Item Repair is a feature that allows players to repair damaged tools, armor, or other items with durability by combining them on a crafting grid. Two items of the same type and material can be placed anywhere on the crafting grid, and the result is a single repaired item. The repaired item will have usage points equal to the sum of the old items' usage points plus a 'repair bonus' of 10% of the item's maximum uses, up to a limit of the maximum durability for that item.

Even if both items were enchanted with exactly the same enchantments, the repaired object will always be unenchanted. Hence, given the current random enchantment system, using a 'junk' item in a repair may sometimes be useful for removing an unwanted enchantment from an item prior to trying to enchant it again.

Repairing gives a slight benefit in conserving inventory space, as it combines two non-stackable objects into one, and the ~10% 'repair bonus' allows you to get slightly more total uses out of tools, which helps eke out resources a little further.

Tools made of different materials (for example, a wood and a stone pickaxe) cannot be combined.

Formula for uses restored
The formula for determining how many uses a repaired item will have restored to it is as follows:

min( floor( Item A uses + Item B uses + (Max uses / 10) ), Max uses)

('floor' means round down to the nearest integer, 'min(a,b)' means whichever of a or b is smallest.)

Example: Two stone axes have 10 and 45 uses. A newly-crafted stone axe would have 132 uses.


 * 10 + 45 + 132/10 = 55 + 13.2 = 68

This algorithm gives the greatest benefit when the two items have an average durability of at most 45%. You can combine 45% + 45%, 89% + 1%, 1% + 1% or any other values that total 90% or less. The order in which items are combined does not matter; one sequence of repairs gives exactly the same durability as any other.

A good strategy is to wear down two items until both have less than 45% durability remaining, but are not so damaged that you risk accidentally breaking them. Put each item in a crafting slot, and check whether the resulting repaired item still has a damage bar. If it does, you can be sure of gaining the full 10% repair bonus for combining those two items, and if it does not, you will lose some of the repair bonus. (A 'perfect' repair is theoretically possible, but unlikely in practice.)

Note that combining items whose average durability is more than 50% actually wastes more resources than simply using tools until they break.

Formula for anvil repair costs
When repairing items via an anvil, several complex calculations are made to determine the level cost of the repair.

First, every item has a RepairCost, which is 0 by default. This value will be a number of levels appended to the cost of repairing.

If there are two compatible items in the input slots (that is, repairable tools), the same repair formula above is applied for the output item. In addition, if the result has more uses than first input item, the repair cost is incremented as follows: max( 1, floor( ( Item B uses + (Max uses / 10) ) / 100 ) ) It should be noted that this means repairs are more expensive if a damaged item is in the first slot, even if the item in the second slot is at full durability.

Each enchantment on the second item also exacts a cost. If an enchantment exists on both items, and is at the same level for both, the level is incremented. Otherwise, the largest of the two is taken. If the enchantment does not exist on the first item, the level taken, of course, will be the enchantment's level on the second item. Then, a special modifier is calculated: Cost modifier = Result level - Item A level It should be noted that this modifier is 1 if both items had a same-level enchantment, 0 if the first item had a higher level version of the enchantment, equal to the difference between the enchantment levels if the second item had the higher level, and equal to the second item's level if the first item did not have the enchantment. Thus, this value is actually minimized by having higher-enchanted items in the first slot, or having identical enchantments of equal level. It is maximized for enchantments which only exist on the second item.

If an enchantment on the second item conflicts with an enchantment on the first item (e.g. Silk Touch vs. Fortune), the enchantment of the second item is dropped. However, the total cost of repair increments by Cost modifier, meaning, in practice, the cost will go up in an amount of levels equal to the level of the enchantment which is deleted (this is not necessarily the case for hacked items).

If, however, there are no conflicts, the new enchantment is applied, and the level is capped to the natural maximum for that type of enchantment (for example, you can never go above level 3 Looting). This capping does not limit the cost, however, and Cost modifier will remain as it was initially calculated. The actual amount of levels added to the repair cost will equal Cost modifier multiplied by a Weight modifier. The Weight modifier is based on the weight of the enchantment in question: if the weight is 10, the modifier is 1. If the weight is 5, the modifier is 2. If the weight is 2, the modifier is 4. If the weight is 1, the modifier is 8. As a result, rarer enchantments will cost more levels if they are not discarded during repair.

Note that the above steps are applied for each enchantment on the second item.

After this, renaming is taken into account. Note that items cannot be renamed if alterations are merely made to the capitalization of letters. If the item is a tool, 15 levels are added to the repair cost. Otherwise, 5 levels per item in a stack are added. In addition, if the item has previously been renamed, the renaming costs are raised to 150%.

Finally, the enchantments on the resulting item are taken into consideration. Each enchantment adds its own level, multiplied by the Weight modifier described above, to the cost. In addition, one level of cost is added per enchantment. Note that this process applies to enchantments inherited from both items, meaning some costs from the second item are being counted multiple times.

The final cost must be between 0 and 40 levels in cost, inclusive, else you cannot repair the item. This means you cannot even rename items which have very high enchantments, as well as various similar limitations.

Finally, the output item has a new RepairCost property: New RepairCost = Item A RepairCost + 2 + floor( Item B RepairCost / 2 ) Therefore, future repairs to this item will be more expensive as well. Previously renamed items are exempt from this cost increase on all future repairs.