Anvil mechanics/Before 1.8

This page explains the mechanics of the anvil. The anvil is primarily used to repair tools, armor, and weapons, which it can do without stripping their enchantments. It can also be used to combine the enchantments of two items, to give an item an individual name, or to crush other players that walk beneath it while it is falling. All its functions, except for crushing players, cost experience levels, and some have material costs.

The anvil has five basic functions:

Renaming any item, including normal blocks. Besides entertainment value, this can save on the costs of repeated repairs. Blocks lose the rename when placed

Repairing a "tiered" item with units of its material. (For example, iron ingots can be used to repair iron tools and armor.) Acceptable items for repair have the material to use in their default name, except for chainmail, which is repaired with iron ingots.

Combining two items of the same kind that have durability. (For example, bows, shears, etc.) The durabilities will combine similar to using a crafting table, and the enchantments are combined following rules detailed below.

Combining a tool with an enchanted book to add the book's enchantment to the tool. This costs much less than combining two similar items, and can give enchantments to items that they could not get at an enchanting table.

Crushing any players who happen to walk under or be under the anvil while it is falling.

Renaming items can be done in the same work step as repairing or combining, provided the experience cost is not too high. In survival mode, the anvil can only apply 39 levels worth of work in a single operation. If the job would cost 40 or more levels, it will be rejected as "Too Expensive!". (This does not apply in creative mode.) Such jobs can often be done piecewise: rename first, then repair, then combine. Note that it is possible to produce items so heavily enchanted that they cannot be worked on at all.

The most important concept for using an anvil is the Base Value of an item, figured in experience levels. Other than combining with enchanted books, any change made to an item will cost its Base Value plus costs for the change. An item's Base Value is the sum of the costs of its enchantments, plus a charge for the number of its enchantments. Note that the item's material does not affect its base cost, nor does the order of its enchantments. An unenchanted (or unenchantable) item has Base Value 0.

As formulas:

For each Enchantment, ECost = Cost per level × level

For the item, BaseValue = ECost1 (+ Ecost2 + ...) + NumEnchantCost

Sword enchantments

Enchantment title

Cost per Level

Max level

Sharpness*†

1

5

Smite†

2

5

Bane of Arthropods†

2

5

Knockback

2

2

Fire Aspect

4

2

Looting

4

3

Tool Enchantments

Enchantment title

Cost per Level

Max level

Efficiency*

1

5

Unbreaking

2

3

Fortune†

4

3

Silk Touch†

8

1

Armor enchantments

Enchantment title

Cost per Level

Max level

Protection†

1

4

Fire Protection†

2

4

Projectile Protection†

2

4

Feather Falling

2

4

Blast Protection†

4

4

Respiration

4

3

Aqua Affinity

4

1

Thorns

8

3

Bow enchantments

Enchantment title

Cost per Level

Max level

Power*

1

5

Punch

4

2

Flame

4

1

Infinity

8

1

Fishing Rod enchantments

Enchantment title

Cost per Level

Max level

Luck of the Sea

4

3

Lure

4

3

Finally, an extra value (NumEnchantCost) needs to be added based on how many enchantments the item has, which can be found from the table below.

Multiple Enchantments

Number of enchantments

Extra cost

1

1

2

3

3

6

4

10

5

15

Notes:

Enchantments marked with an asterisk (*) are ones that cannot be produced at level V by an enchanting table, but can be produced by combining two level IV items in an anvil.

Enchantments marked with a dagger (†) are incompatible with each other. For example, only one kind of "Protection" can be on a piece of armor at a time.

Example:
Say we have a sword with Sharpness 3, Knockback 2 and Looting 2. Referring to the table we see that the Enchantments will cost 3×1 → 3, 2×2 → 4, and 2×4 → 8 respectively, and another 6 levels for having three of them. 3+4+8+6 → 21. In the anvil for the first time, this sword will cost at least 21 levels to work on, even before considering what to do with it.

Simultaneously renaming and repairing an object costs both charges, but you only pay for Base Value and the (current) penalty once. For example, consider an item with Base Value of 5 never renamed before, with two prior works (penalty of 4). Then this item is altered a third time, for a repair costing 3 (over Base+Penalty). Repairing and renaming it simultaneously would cost (5+4)+3+7=19, as opposed to 5+4+3=12 for a repair alone or 5+4+7=16 for a rename alone.

An item which has been renamed has its prior-work penalty set to 2, remaining so regardless of later work. Renaming the item back to its default name (e.g. "Iron Sword") does not revert prior-work to full cost.[note 1]

As a consequence of the above, and using the same example, if you then damage that item slightly so that the next (fourth) repair cost would be 3 levels (over BV+Penalty), the renamed item will cost (5+2)+3=10 levels to repair, while if the item was not renamed before it would cost (5+6)+3=14 levels (4 more).

Renaming an item without durability costs 5 the first time, then stays 9 for all later renames. This includes the implicit prior-work penalty, and everything without durability except enchanted books has a Base Value of 0.

Stackable items can be renamed as a stack; you do pay for each item, but the total cost is capped at 39 levels, for which you can rename a full stack.

Note that renamed items in general will not stack with normal items, and renamed blocks lose their name when placed.

Repairing a "tiered" target item using units of its material restores up to 25% total durability per unit and costs the sum of the unit costs of each unit. (In addition to the Base Value and Prior Work Penalty.)

The unit cost is normally 1 plus the number of enchantments on the target item. For Diamond tools, the unit cost is up to 3 plus the number of enchantments on the target item, depending on how much durability the unit is repairing. All but the last unit take the full cost for a full repair of 390 durability. The last unit costs 1 less for restoring less than 300, and another less for restoring less than 200.

The material to use is in the original name of the item, except for chainmail, which uses iron ingots.

The anvil can be used to combine two items of the same type, or an item with an enchanted book. This applies only to items with durability: swords, tools, and armor. The first/left item is the target item, the second/right item is the sacrifice item, which will be destroyed. Combining two similar items does either or both of two things. Each of these costs levels, but if they're both done at once, part of the cost will be shared:

The target will be repaired, adding the durability of the sacrifice plus a bonus, up to the item's maximum durability. If the target item is undamaged, there will be no charge for repair.

It also tries to combine the sacrifice's enchantments onto the target. If the sacrifice has no enchantments, or only weaker versions of the target's enchantments, then there will be no charge. Otherwise, you will pay for enchantments added, and for some cases where the transfer fails (see below). For each enchantment on the sacrifice:

If the target has the enchantment as well...

and the sacrifice level is greater, the target will be raised to the sacrifice's level.

and the sacrifice level is equal, the target gains one level, unless it is already at the maximum level for that enchantment.

and the sacrifice level is less, nothing changes on the target.

If the target does not have the enchantment, it will gain all levels of that enchantment, unless it already has an incompatible enchantment. Enchantments are incompatible if both are in one of the following groups:

If the sacrifice is a book, there will be no repair, but the anvil will try to combine the book's enchantment onto the target. The item can also be renamed at the same time. The cost will be much less than for combining two similar items.

The target item will end up with the sum of both items durabilities, plus a bonus (12% of the items' maximum durability, rounded down) up to the maximum.

To make the best use of the bonus, repair when the total item durability of the pair is no more than 88% of the maximum. For swords and tools, the 12% bonus is 3 durability for gold, 7 for wood, 15 for stone, 30 for iron, and 187 for diamond.

You may want to use F3+H to show the numeric durability of your items (in the inventory tooltips).

The cost for the repair depends only on the sacrifice's current durability and (slightly) the type of item:

S is the sacrifice durability, and MaxD is the maximum durability for it's type.

N is an offset for the item type, equal to 100-floor(0.12*MaxD). (This is negative for diamond tools.)

The cost is 1+floor((S-N)/100)

For each item type and sacrifice durability, the repair cost is:

Sacrifice Repair Cost per Item Type and Sacrifice Durability

⇓ Item / XP Cost ⇒

1

2

3

4

5

...

17

Diamond Tools*

1-12

13-112

113-212

213-312

313-412

...

1513-1561

Diamond Chestplate

1-136

137-236

237-336

337-436

437-528

Diamond Leggings

1-140

141-240

241-340

341-440

441-495

Diamond Boots

1-148

149-248

249-348

349-429

Bow

1-153

154-253

254-353

354-384

Diamond Helmet

1-156

157-256

257-356

357-363

Iron Tools*

1-169

170-250

Iron/Chain Chestplate

1-171

172-240

Shears

1-171

172-238

Iron/Chain Leggings

1-173

174-225

Iron/Chain Boots

1-176

177-195

Iron/Chain Helmet

for any sacrifice

Gold, Wood, Stone,Leather Items

Flint and Steel

Fishing Rod

Carrot On a Stick

* Swords have the same cost as tools.

Example

A maxed out fishing rod (Lure 3, Luck 3, Unbreaking 3) which has been renamed is barely repairable. It has base value 36 (12 for luck, 12 for lure, 6 for unbreaking, 6 for three enchantments). Assuming it's been renamed, repairing it will cost that plus 2 for prior work, and 1 for the repair itself, for a total of exactly 39. If it has not been renamed, then its second combination or repair will make it too expensive to repair. (It might be rescued from this state by combining it with an incompatible book, which will allow simultaneously renaming it. See below for details.)

(This is just the enchanting cost. The total cost outline is in Combining Items.)

For each enchantment on the sacrifice:

If the enchantment is incompatible with the target, add 1 per level of enchantment.

If the enchantment is compatible, for each level the target will gain, add twice the cost-per-level from the Base Value tables.

If the enchantment is compatible, but both target and sacrifice are at max level, add the cost-per-level once.

If new enchantments are added, add (number of new enchantments)×(number of final enchantments - 1) + 1.

Examples:

Dealing with equal enchantments:

In the first slot, the target is a sword named "Pointy" with Sharpness III, Knockback II, and Looting III.

In the second slot, the sacrifice is a sword with Sharpness III and Looting III from two prior jobs.

The Base Value of the target is 25. The total Prior Work Penalty is 2 + 4 = 6. The cost so far is 31.

Sharpness III is equal to the target, so the result will have Sharpness IV at a cost of twice 1.

Looting III is equal to the target but maxed out, so the result will have Looting III, with the cost of 4.

The result costs 31 + 2 + 4 = 37 levels for a sword named "Pointy" with Sharpness IV, Knockback II, and Looting III. The result's Base Value is 26.

Swapping the target and sacrifice here gives a lower target Base Value but higher enchanting cost. The resulting sword would have the same enchantments, but with three prior jobs instead of the name "Pointy". Unfortunately, the enchantment cost goes up to 41 levels, which is above the anvil limit!

Dealing with conflicting enchantments:

The target is a sword with Sharpness III and Looting II, Base Value 14, two prior jobs.

The sacrifice is a sword with Smite II and Looting II, Base Value 15, two prior jobs.

The cost so far is 14 + 4 + 4 = 22 for Base Value of target and total Prior Work Penalty.

Smite II is incompatible with Sharpness III, so the result will not have Smite at all, but there will still be a cost of 2 levels for trying.

Looting II is equal to the target, so the result will have Looting III at a cost of twice 4.

Don't do this: Take a helmet with Protection IV, and Respiration III, and add a helmet with Blast Protection IV and Respiration III. You pay 4 levels for the incompatible Blast Protection, and another 4 for the maxed-out Respiration. With the Base Value of 19, you've just paid 27 levels (and a heavily-enchanted helmet) for nothing. (You could still be repairing the target, but that costs extra....)

The costs for enchanting with books expose more of the internals of the anvil system, but while this makes them more complex, they also include some major discounts compared to item combination. Naturally, repair costs do not apply.
Normally, enchanted books only have one enchantment, but books with multiple enchantments can be produced by combining two books on an anvil. Such books will have their own prior-work penalty.

First, the following costs are added together:

Start with the target's modified Base Value, where cost-per-level is halved to a minimum of 1 per level.

If the target is gaining any new enchantments, add a cost of (number of new enchantments)×(final number of enchantments - 1) + 1.

For each enchantment level the target will gain, add the cost-per-level halved to a minimum of 1 per level. (save this number)

For each enchantment both target and book already have at max level, add the enchantment cost-per-level once.

If the item was already renamed, and is being renamed again, add 3. (This is half the basic rename cost, rounded down. If you are somehow enchanting an item without durability, only pay 2.)

The above sum is then halved and rounded down. It can round down to 0.

For each book enchantment that's incompatible with the target, add 1 per enchantment level.

For each enchantment level the target will gain, add (again) the cost-per-level halved to a minimum of 1 per level.

If the target is being renamed, add the basic rename cost, that is 7 for items with durability, 5 for other items.

Notes:

An approximation for the cost breakdown without renaming or other complications, is: (BaseValue/4) + (PriorWork/2) + (NewEnchantmentCost/2) + levels gained × (cost-per-level × 3/4). If each part in parentheses needs no rounding, then the answer is exact.

When the sacrifice is a book, costs are significantly cheaper than sacrificing a matching item with same enchantment. This allows enchantment combinations that wouldn't be possible otherwise, but it also makes it easier to produce an item that can't even be repaired.

Sometimes it is good to rename an item while combining it with a book with an incompatible (or duplicate, maxed-out) enchantment to lower the cost, especially if you had no use for the book anyway.

Examples:

Enchanting a newly crafted Bow with an Infinity I Book: the only cost is 1 * cost-per-level * 3/4 = 8 * 3/4 = 6. No rounding was needed in any steps, so that result is exact.

Adding Infinity I to a Bow already enchanted with Power III and Flame I, with Prior Work = 6: Original Base Value is 3*1 + 1*4 + (3*2/2) = 10, and the Modified Base Value is 3*1 + 1*(4/2) + (3*2/2) = 8, 2 enchants, and halved cost-per-level is 1*8/2 = 4. So (8+6+2+4)/2 + 4 = 14 levels. If Infinity I was obtained from another bow instead of a book it would cost 35 levels, 21 more.

Enchantments can be raised to their maximum power, which can be above the table's range.

Shears can receive Silk Touch, allowing them to gather cobwebs.

Axes can receive some of the sword enchantments: Sharpness, Smite, or Bane of Arthropods.

Even before version 1.7.2, a book can be used to apply Unbreaking to almost any item with durability. As of version 1.7.2, the enchanting table can apply Unbreaking to more items, but a few of the minor tools still require use of a book.

Enchanted books can also be combined with each other to produce higher-level or multi-enchantment books.

Tools

In other languages

Content is available under CC BY-NC-SA 3.0 unless otherwise noted.Minecraft content and materials are trademarks and copyrights of Mojang and its licensors. All rights reserved.
This site is a part of Wikia, Inc. and is not affiliated with Mojang.