Anvil

"Anvils!. Your sword can now be a "Dragon's Tooth" if you want, or you could just repair it a little."

- The Pretty Scary Update Promo Poster

Anvils are blocks that use the item repair interface to repair and rename items, and combine enchantments.

Obtaining
An anvil can be mined using any pickaxe. If mined without a pickaxe, it drops nothing.

Usage
Anvils can be used to repair tools and armor, enchant items with enchanted books, and rename items and blocks. All of their functions cost experience levels (earned by performing certain actions), and material costs.

Anvils are damaged by using it for repairing and will eventually be destroyed by such use. On average, an anvil will survive for 24 uses.

Anvils are affected by gravity similar to sand, gravel, and dragon eggs. A placed anvil cannot be pushed or pulled by pistons, but a falling anvil can. Falling anvils can do considerable amounts of damage to mobs or players, so they can be used in traps, and they also have a chance to be damaged by the fall.

Repairing and renaming
Anvils have two modes to repair items with durability:
 * A player can combine two items similar to the crafting grid, but the target will keep its enchantments, and may gain new ones from the sacrificed item.
 * Or a player can use materials respective to the item (iron ingots for iron items with durability, diamonds for diamond items with durability). One material can only repair 25% of the target's maximum durability.

In addition, the player can rename any item - not just items with durability - using an anvil.

Repairing


Repairing with materials works for the most part, but not with all items: As a rule of thumb, it works for items with their material in the default name, like iron pickaxe, so it can be done with various tools except for bows and shears. As a special case, chain armor can be repaired with iron ingots. The repair does not need to be complete; one material will only repair $1/4$ 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.

Note that in both cases the resulting durability will be limited to the item's maximum, and there is no discount for "over-repair".

As a subset of repairing one item with another, the anvil can transfer enchantments from the sacrifice to the target. Two Sharpness II swords can be combined to make a Sharpness III sword, or a pickaxe with Efficiency can be combined with one that has Unbreaking. This can produce enchantments and combinations that could not be made by using an enchanting table. But even so, some enchantments cannot be combined if it is similar, or contradicting, in context of what it does. If the target is damaged, you will pay for the repair as well as the transfer.

Transferring high-level enchantments is more expensive, and renaming an item has an additional surcharge. The anvil has a limit of 39 levels, beyond which it will refuse to repair altogether. This limit is not present in creative mode.

Renaming
Any item or stack of items can be renamed at a cost of one level plus any prior-work penalty. If only renaming, the maximum total cost is 39 levels. 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. Secondly, if a spawn egg is available (from creative mode or provided from 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), and then mined, it will lose its given name and will go back to its original one. The maximum length for renaming is 30 characters.

Enchanted books
Enchanted books themselves can be combined to create higher tiered books.

Falling anvils
When there are air blocks below anvils, they will fall. Anvils will make a metallic clanging sound when they land.

When anvils land on a non-solid block, they destroy the non-solid block rather than dropping as an item, unlike Gravel or Sand. When an anvil is dropped on pressure plates, boats, cobwebs, slabs, signs, cakes, lily pads, opened fence gates, or closed trapdoors that do not have a block beneath them, the anvil will drop itself as an item. When dropped on a mob head, the mob head will become the item form.

Falling anvils, when they fall on a player or mob, will damage them. Damage amount depends on fall distance: per block fallen after the first (e.g., an anvil that falls 4 blocks will deal  damage). The damage is capped at, no matter how far the anvil falls. Wearing a helmet will reduce the damage by $1/4$, but this costs durability on said helmet. When a player dies by an anvil falling on them, the chat will display this message: "Player was squashed by a falling anvil." However if a player is merely touched by an anvil entity, or falling anvil, no damage will result until the falling anvil becomes a solid anvil-block in the airspace where the player is located. Falling anvils can be manipulated by TNT cannons, and will pass right through a mob or player without damaging them.

Trivia

 * If a block is renamed, it will not keep its name after being placed.
 * 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 24 uses on average.
 * Armor reduces the amount of damage caused by falling anvils.
 * 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.
 * 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 an anvil falls on top of any non-solid block (except flowers) the block will be replaced by the anvil and will not drop itself.
 * Judging by the weight of iron and the volume of an anvil, an anvil from Minecraft in real life would weigh 6312 pounds, or 3.16 tons.