Anvil mechanics/Before 1.8

The page talks about the mechanics of the anvil. This page focuses on combining enchantments on tools, swords, armour and bows

General Notes
This is for items in general for the anvil (doesn't depend which slot you put it in)

1) The material that the tool is made out of doesn't matter. A wooden sword with looting 3 and bane 4 will cost the same when you put it into an anvil as a diamond sword with the same enchants (both costing 23 levels)

2) Adding two like enchantments will give you an enchantment of the next level, as long as it doesn't go over the cap (knockback 1 + knockback 1 = knockback 2, but looting 3 + looting 3 = looting 3 still, since there is no looting 4)

3) When combining enchantments, the item in the first slot (left slot) will be the one that gets the enchantment. This also means that if a sword with sharpness 3 and looting 2 is in the first slot, and a sword with bane 2 and looting 2 in the second slot, the sword with sharpness will override the bane sword, giving the final sword sharpness 3 and looting 3. It also means, though, that if the order of the swords are switched (i.e. have bane in first slot and sharpness in second), the final sword would end up having bane 2 and looting 3

4) Every time an item is put through the anvil, 2 extra levels are added to it. This means that if a sharpness 4 sword is made using two sharpness 3 swords, it will cost 2 more levels than a 'pure' sharpness 4 sword would

5) The maximum level of items that can be put into an anvil is 40. Once past this, the anvil says it is too expensive and won't do anything to it. In creative, the amount of levels on an anvil is more than normal.

6) If the higher of the two items are put into the first slot, the second enchantment will cost less overall, but if the order is switched, the enchantment will cost more. This is based on Point 3 above

7) The order of the enchantments doesn't matter. A sword with sharpness 4, fire 2 and knockback 1 will cost the same as a sword with knockback 1, sharpness 4 and fire 2

First Slot
These points are for items placed in the first (left) slot of the anvil. There are tables at the end of the dot points for all the values you need

1) Each enchantment has a 'base' cost for the anvil. This is the cost for the first level of that enchantment. The cost of the enchantment is also based on the level. A bane 3 will cost more in the anvil than a bane 1

2) To find the total cost of an item in the anvil, add the cost of each enchantment and add an extra number (see Table 5 below) to it based on how many extra enchantments you have. By default, an item with 1 enchant has no extra enchants on it, while an item with 4 total enchants has 3 extra enchants on it.

3) The difference between the levels of an enchantment are constant. This means if a sword with only looting 1 costs 5 levels in the anvil, a looting 2 sword costs 9 levels (4 extra), a looting 3 sword will cost another 4 levels. This value of 4 levels per enchantment level varies between each enchantment (see table below)

These tables show how many levels each enchantment will cost

Swords:



Tools:



Armour:



Bows:



To calculate the total cost of an item, add up the cost of each enchantment on it, then add a value from this table based on how many extra enchantments it has:



You can calculate the number of levels you need to add by finding the nth triangular number, where n is the amount of extra enchants on an item.

Note: Items marks with an (*) are ones that can not be gotten (like sharpness 5). If one can get a pure enchantment like this, the values from the table (like 6 for sharpness 5) would be used, but since they have to be made, you have to add the amount of times it has been put in anvil before (see point 4 under section 'General Notes'). For example, to make a sharpness 5 using 2 pure sharpness 4 swords would cost 7 levels. If that sword is then put that into an anvil, instead of costing 6 levels for a pure sharpness 5 sword, it will cost 2 more levels than that, so 8 levels total. This means that for sharpness, efficiency and power 5, the minimum level in the anvil will be 8

Second Slot
These points are for the items in the second slot. This section here is incomplete, and needs more material added to it. Currently, this will work for items that have common links (for example, combining a sharpness 3, looting 2 sword with another looting 2 sword), but not when there are no common links between items.

Clarification: "Adding enchantment x onto an item with enchantments y", means that the first slot has an item with enchantments y, and the second slot has an item with enchantment x

1) The cost for adding an enchantment is fixed between the levels. Adding a sharpness 1 sword to another sword with sharpness 1 with other stuff will cost the same as adding a sharpness 4 sword to another sword with sharpness 4 with other stuff (such as knockback or looting)

2) Adding two enchantments at level cap (such as a looting 3 and looting 3) will add half the cost instead of the whole cost. For example, adding looting 1 with looting 1 or looting 2 with looting 2 costs 8 levels, but if you add a looting 3 to a looting 3, it will only cost 4 levels

3) As said in section 'General' point 4, whenever you make an item, it adds two extra levels in future. Because of this, if an item has been made in an anvil before, you should add 2 levels per time it's been through the anvil. Because of this, even though the cost for adding a sharpness sword is 2, making the cost of a sharpness 5 half of that (point 2 above), which is 1, because you had to make the sword using two sharpness 4 swords, the cost to add a sharpness 5 sword is actually 3. However, if one has a pure sharpness 5 sword from a previous version, you would only need to add 1 level

Here are the tables used for the second slot enchantments:

Swords:



Tools:



Armour:



Bows:



Note: Again, for the items marked with a (*), since they can not be made in the current versions, an extra two levels need to be added for each time it has been in the anvil

Example
Say we make a sword with sharpness 3, knockback 2 and looting 2. To calculate the level it will be when going into the anvil, one must use the tables from the 'First Slot' section. The base cost of sharpness 3 is 4, the base cost of knockback 2 is 5 and the base cost of looting 2 is 9. This sword has 2 extra enchantments on it, so by looking at the table above for the extra enchantments, it can be seen that we need to add an extra 3 levels to the cost. This means that when this sword is put it into the anvil, it should cost 4+5+9+3=21 levels. If another sword is then enchanted and gets sharpness 3 and looting 2 on it, these two items can be combined to get a sword with sharpness 4, looting 3 and knockback 2. To calculate how much this would cost, we need to look at the tables in the 'Second Slot' section. To add sharpness 3 costs 2 levels, and to add looting 2 costs 8 levels. This means, that if the first sword is in the first slot, thus starting with the 22 levels from before, to add the sharpness 4 and looting 2 sword would cost 21+2+8=31 levels

First sword in anvil. It costs 21 levels, as predicted



Second sword in the anvil



Final sword costing the amount predicted, with the enchantments predicted



铁砧机制