Anvil

An Anvil is a block that uses the item repair interface to repair and rename items, and combine enchantments. The anvil uses a complex XP cost system, where the way the tools are positioned and how many times they are repaired affect their cost. For full details, see anvil mechanics.

Usage
Anvils can be used to repair tools and armor, enchant items with enchanted books, and rename items and blocks. All their functions cost experience levels and some have material costs as well.

Also, anvils are damaged by normal use (also by falling, see below.) and will eventually be destroyed by such use. With each normal use anvils have a 12% chance to be damaged. The first two times an anvil is damaged, its texture will change, and (if picked up) its tooltip will identify it as "slightly damaged" the first time, or "very damaged" the second. If a "very damaged" anvil is again damaged, it will disappear. If it was being used, the GUI will close and the forged item will be dropped on the ground as the anvil disappears. On average, an anvil will survive for 24 uses; pro-rating the 31 iron ingots used to make it, gives an average cost of 1.24 iron ingots per use. Anvils are affected by gravity like sand, gravel, and dragon eggs: If the block under them is removed, or if they are placed over open space, they will fall. A placed anvil cannot be pushed or pulled by pistons, but a falling anvil (entity) can. A falling anvil can do considerable damage to mobs or players, so they can also be used in traps. An anvil has a chance to be damaged by the fall, equal to (5 + Distance&times;5)%.

Repairing and renaming
Anvils have two modes of repair. They can combine two items like the crafting grid, but the target will keep its enchantments, and may gain new ones from the sacrificed item. A player can also use materials like leather and iron ingots to repair tools and armor; each represents 25% of the item's maximum durability. The player can also rename any item - not just tools or armor - using an anvil. Renaming an item removes the penalty paid for repairing the same item multiple times.

How to repair


Place the "target" item on the left slot. On the right, place either a matching item (the "sacrifice"), or one or more pieces of the item's raw material. The anvil will then tell you how many levels this repair will cost. Also, the "result" slot will show the item as it would be repaired, including tooltips showing its enchantments and (in {key+F3}}+{key|H} mode,the resulting durability.) To actually do the repair, remove the result item from the result slot and put it in your inventory. (Naturally, you can't do this unless you have enough levels, or are in creative mode.) Both input items will vanish when you take the result item.

Repairing with materials works for most but not all items: as a rule of thumb, it works for items with their material in the default name, e.g. Iron Pickaxe, so it can be done with swords, pickaxes, armor, etc., but not bows and shears. As an special case, Chain armor can be repaired with iron ingots. The repair need not be complete; each unit of material will repair 25% of the item's maximum durability.

Repairing with a matching item works for any item with durability including bows, shears and so on. The items must match in type: you cannot combine a golden pickaxe with an iron one. When sacrificing an item for repair, the sacrifice's remaining durability will be added to the target, along with a bonus of 12% of the item's durability.

Note that in both cases the resulting durability will be limited to the item's usual maximum, and there is no discount for "over-repair": you pay levels per unit of material used, or according to the sacrifice durability, regardless of the resulting durability, even if it would exceed 100%.

As a subset of repairing one item with another, the anvil can transfer enchantments from the "sacrifice" item to the target. Two Sharpness II swords can be combined to make a Sharpness III sword, or a pick with Efficiency can be combined with one that has Unbreaking. This can produce enchantments and combinations that could not be made at an enchanting table but even so, some enchantments cannot be combined (such as Sharpness and Smite). If the target is damaged, you will pay for the repair as well as the transfer.

Work on items with expensive materials (diamond) or many / high-level enchantments is more expensive. Transferring enchantments can add even more cost, and renaming an item has an additional surcharge. To boot, repeatedly repairing an item gives a cumulative penalty (which can be avoided by renaming the item). Unfortunately the anvil has a limit of 39 levels, beyond which it will refuse the job altogether. This limit is not present in Creative mode. In some cases it may be possible to do things piecewise (rename, repair, then transfer enchantments) but some heavily-enchanted items may just be too expensive to work with. For full details of the anvil's costs and restrictions, see the Anvil mechanics page.

Renaming
Any item or stack of items can be renamed at a cost of seven levels if the item has durability (tool, weapon, or armor) and five levels otherwise. Renamed tools and renamed mobs (from renamed spawn eggs) will show in death messages. Renamed mobs will show their name when your cursor is on them. Renamed command blocks will use their name instead of "[@]". This feature is also used, in two different ways, to produce a named monster: Firstly, it is the only way to assign the desired name for a Name Tag (introduced in 1.6). Secondly, if a Spawn Egg is available (from creative mode or provided for an adventure map), any name given to the spawn egg will be kept by the mob it produces. If a renamed block is placed on the ground (or anywhere in the world) then is mined and picked up, it will lose its new name and will go back to its original name.

Enchanted books
Enchanted books are used with an anvil to enchant an item, with the book acting as the sacrifice (second slot). The regular enchanting rules still apply but with significant discount to the cost. In creative mode any item can be enchanted this way (e.g., a Silk Touch Stick), but even then, incompatible enchantments may not be combined, and the maximum levels for the various enchantments still can not be exceeded. In creative mode, enchanted books themselves can be combined to create higher-level or multi-spell books.

Falling anvils
If there is no block below an anvil it will fall. An anvil will make a metallic clanging sound when it lands.

When an anvil lands on a non-solid block like a torch or rail, or on a flower pot, it will destroy that item instead of dropping it. When an anvil is dropped on a pressure plate, a boat, cobwebs, a slab, a sign, a cake, a lily pad, closed trapdoor that doesn't have a block beneath or opened fence gate, the anvil itself will drop as an item. When dropped on a trophy head decoration, the head is dropped as an item.

A falling anvil will also damage mobs and players. Damage amount depends on fall distance: × MIN(Distance × 2, 10). Wearing a helmet will reduce the damage by 45%. A player dying by an anvil falling on them will receive this message: "player was squashed by a falling anvil." However if a player is touched by an anvil entity, or falling anvil, no damage will result until the anvil becomes a block in the gridspace where the player is. So anvils can be shot with a TNT Cannon, and pass right through a player, and not damage them. In addition, if the player jumps at the correct time, the player will not be in the gridspace where the anvil is, negating player damage; however, this can be difficult.

An anvil has a chance to be damaged by the fall. Damage chance also depends on fall distance and is equal to (5 + Distance*5)%

Trivia

 * If a block is renamed it will not keep its name after being placed.
 * It takes a total of 31 iron ingots to craft an anvil.
 * The falling ability of the anvil is a reference to the common cartoon trope.
 * The anvil has the same blast resistance as obsidian and the enchantment table.
 * If you rename a material, such as diamonds, it will not stack with unnamed or differently-named items.
 * An anvil will last about 25 uses on average.
 * Armor reduces the amount of damage caused by falling anvils.
 * The high blast resistance and transparency of the block makes for a good blast-proof window.
 * If a falling anvil lands on a pressure plate, it will damage any mob standing on the pressure plate, and drop as an item.
 * For unenchanted items, "unit repair" can easily cost more material than just crafting a new item or combining damaged items. The exception is armor, where you can use less material at the cost of experience levels.  Also, the choice between unit repair and sacrifice repair depends very much on the details (how damaged is the target, and the proposed sacrifice?  How many enchantments?), especially when dealing with diamond items.
 * If placed on top of exploding TNT blocks, the explosion won't affect the surrounding area.
 * This is because the Anvil falls into the space the TNT entity is occupying, and since the TNT's explosion power is not high enough to destroy the anvil, no blocks are destroyed.
 * Anvils are also commonly used as a guillotine because of its ability to kill mobs/players as a controlled entity.
 * No action sounds are given while stepping on or jumping on an anvil.
 * If an anvil is placed on top of a chest, you are still able to open the chest.
 * If two anvils are placed in a corner fashion like so |_ (the lines are the anvils) you are able to walk through the anvils if you are at the right angle.
 * Renaming a mob "Dinnerbone" or "Grumm" (by either method) will cause the mob to spawn upside-down.
 * Although anvils are made of iron, which requires a stone pickaxe to break, anvils only require a wooden pickaxe to be broken.
 * Whilst using third party mods and/or software, making an Anvil into an entity (similar to how a TnT block acts when activated) cause it to take on the guise of a heavily damaged anvil, regardless of how much damage it has taken previously. Placing it again usually returns it to its previous state.