Enchanting



Enchanting is a game mechanic that involves using an Enchantment Table to add special bonuses to tools, weapons or armor. To enchant an item, you need the required Experience level for the enchantment and an Enchantment Table. Each spell costs the player experience levels but in turn allows the player to enchant armor, swords and tools with one or several random bonus attributes as well as making the items glow with a brilliant hue.

Enchanting basics
To enchant an item, craft an Enchantment Table, place it on the ground, right-click on it and drag an enchantable item from your inventory onto the square under the book icon. Three randomly chosen enchantments will appear on the menu on the right. Enchantments that you can apply to an item will be highlighted, whereas unavailable enchantments will be greyes out.

The only thing you can know for sure about enchantments are their levels, which appear as a number; the foreign text is random. You can take the item off and place it on the table again for a different set of enchantments. Or, you can attempt to replace the item on the table with a stack of two or more of any other item from your inventory.

Once you choose an enchantment, it will be applied to your item, giving it a glow and one of the special powers detailed below, and you will lose a number of experience levels equal to the level of the enchantment. Enchantments cannot be undone and an item can only be enchanted once, although the item may receive multiple enchantments during one instance of enchanting, determined randomly.

Whenever you place an eligible item on the table, the enchantment levels available are randomly generated for each slot using the formula below. The enchantment level is dependent upon the number of nearby bookshelves (capped at 30) and a "slot factor" of 0.50 for the topmost enchantment slot, 0.66 for the middle slot, and 1.00 for the bottom slot. (If the number of bookshelves is 0, the second two random integers will always be zero. When placing bookshelves around the Enchanting Table they CANNOT be touching the table or the table will not change from 5.)


 * Enchantment level available = (1..5 + (b/2) + 0..b) &times; s,

where b is the number of nearby bookshelves (maximum of 30), s is the slot factor for the given enchantment slot, and x..y generates a uniformly distributed random integer between x and y inclusive. The lowest level available is equal to half the number of book shelves used.

Prior to version 1.1, the (b/2) term in the above equation was 0..(b/2), resulting in more randomness, and making the search for high level enchantments an extremely time consuming process. Prior to 1.1, the lowest level available was 1, regardless of the number of bookshelves used.

Bookshelf placement
Nearby bookshelves raise the available enchantment levels. As of Beta 1.9 Pre-release 4, no enchantments costing above five Experience levels are available unless you place bookshelves near but not touching the Enchantment Table. In order to have an effect, a bookshelf must be placed exactly 2 blocks, laterally, of the enchantment table and be on the same level or one block height above the table, and the space between the bookshelf and table must be Air (even a torch or snow cover will block the effect), where “between” is as shown in the following diagrams (the white spaces are air, and the do not matter):

An enchantment table can be surrounded by 30 bookshelves by placing them in a square around the table, with each wall measuring 5 blocks wide and 2 blocks high, with a 2 block high doorway. This arrangement gives the maximum possible boost. (While it is possible to get two more bookshelves in "range", they do not add, as the boost is capped.)

An easy way to limit the maximum level of enchantment available, if you want to do a lower-level enchantment, is to put torches on the bookshelves so that they aren't recognized by the enchantment table. That way you can still have the entire 'ring' of bookshelves around the table, but get lower-level enchantments when you need them. Breaking the torches will restore the maximum level to its original amount.

An important thing to put into mind is to keep the area between the enchanting table and the bookshelves completely clear. Things like snow can cancel out the effect of all the bookshelves, and will render them useless until the snow is cleared. A safe bet is to completely clear the workspace unless you are intentionally doing so to obtain lower level enchantments.

Enchantments
Enchantment names are randomly constructed from the following list of words. Three to five words are chosen from the list and appended to each other, then displayed in the Standard Galactic Alphabet. Note that the names have no meaning and are not saved on the enchanted item (meaning they will tell you nothing about what the resulting spell will be), they are only displayed in the Enchantment Table interface.

"scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet elder ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale"

Repairing an enchanted weapon/tool will remove the enchantment on it.

When an enchanted weapon deals bonus damage to a mob, circular blue particles fly off of that mob, similar to getting a critical hit.

There are several levels on most enchants, and when you enchant you can get several enchants on each weapon/tool/armor.

Enchantable Items
Items such as swords, shovels, pickaxes, axes, bows, and every part of armor of any material can be enchanted. Hoes, shears, fishing rods and flint and steel are not enchantable.

Enchantment Types
EID is the item's Effect Identification Number in the game code.

{| class="wikitable" style="text-align: center; width: 100%" ! EID ! style="width: 15em;" |Enchantable item ! Name ! Effect ! Max. Enchantment Power ! On level up ! Notes ! colspan=7 |

Armor Enchantments
! 0 ! 1 ! 2 ! 3 ! 4 ! 5 ! 6 ! colspan=7 |
 * - align="center"
 * Protection
 * Makes giant butts attack giant balls cuz PENUS
 * IV
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Fire Protection
 * Burns ur PENUS
 * IV
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Feather Falling
 * Less fall damage
 * IV
 * +1 to reduction of falling damage (half a heart)
 * This is great for preventing falling damage from ender pearl teleportations.
 * - align="center"
 * - align="center"
 * Blast Protection
 * Protection against explosions
 * IV
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Projectile Protection
 * Protection against projectile entities (e.g. arrows)
 * IV
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Armor with this enchantment cannot receive any other type of Protection
 * - align="center"
 * Respiration
 * Decreases the rate of air loss underwater; increases time between damage while suffocating
 * III
 * Underwater breathing time +15 seconds; time between suffocation damage +1 second
 * - align="center"
 * - align="center"
 * - align="center"
 * Aqua Affinity
 * Increases underwater mining rate
 * I
 * I

Weapon Enchantments
! 16 ! 17 ! 18 ! 19 ! 20 ! 21 ! 48 ! 49 ! 50 ! 51 ! colspan=7 |
 * - align="center"
 * Sharpness
 * Extra damage
 * V
 * Up to 1.5 hearts extra damage per level
 * Extra damage is random for every hit, but will always be at least 0.5 heart. A Sword with this enchantment cannot receive Smite or Bane of Arthropods.
 * - align="center"
 * - align="center"
 * Smite
 * Extra damage to Bananananananananas
 * V
 * Up to 2 hearts extra damage per level
 * Extra damage is random for every hit, but will always be at least 0.5 heart. A Sword with this enchantment cannot receive Sharpness or Bane of Arthropods.
 * - align="center"
 * - align="center"
 * Bane of Arthropods
 * Extra damage to spiders, cave spiders and silverfish
 * V
 * Up to 2 hearts extra damage per level
 * Extra damage is random for every hit, but will always be at least 0.5 heart. A Sword with this enchantment cannot receive Sharpness or Smite.
 * - align="center"
 * - align="center"
 * Knockback
 * Knocks butts up da butts cuz da butts are butty
 * II
 * Does not stack with knockback caused by attacking while sprinting.
 * - align="center"
 * Does not stack with knockback caused by attacking while sprinting.
 * - align="center"
 * Fire Aspect
 * Fire Aspect
 * Lights the target on fire
 * II
 * Affects duration of burning.
 * Will cook meat if mob is killed by the fire damage
 * - align="center"
 * Looting
 * Mobs have a chance to drop more loot
 * III
 * +1 to max loot drop per level
 * - align="center"
 * - align="center"
 * - align="center"
 * Power
 * Extra damage
 * V
 * Extra damage is dealt
 * Multiplies base damage by 1.5 at Power I; additional levels increase the multiplier by .25 each, for a maximum of 2.5 at Power V. A Power V enchantment will one-shot many mobs when fully charged. (11-12.5 hearts damage)
 * - align="center"
 * - align="center"
 * Punch
 * Knockback effect on mobs
 * II
 * Mobs are knocked back further.
 * - align="center"
 * - align="center"
 * - align="center"
 * Flame
 * Sets arrows and mobs on fire.
 * I
 * Sets arrows on fire when shot, and mobs when hit.
 * - align="center"
 * Sets arrows on fire when shot, and mobs when hit.
 * - align="center"
 * Infinity
 * Gives infinite shots with a single arrow.
 * I
 * This can be extremely useful against the Ender Dragon when fighting it in The End, since the player can no longer return for more arrows to use. Additionally, arrows fired by a bow with this enchantment cannot be retrieved, similar to the arrows fired by Skeletons. In Creative, all bows have this ability by default, although they are not enchanted.
 * This can be extremely useful against the Ender Dragon when fighting it in The End, since the player can no longer return for more arrows to use. Additionally, arrows fired by a bow with this enchantment cannot be retrieved, similar to the arrows fired by Skeletons. In Creative, all bows have this ability by default, although they are not enchanted.
 * This can be extremely useful against the Ender Dragon when fighting it in The End, since the player can no longer return for more arrows to use. Additionally, arrows fired by a bow with this enchantment cannot be retrieved, similar to the arrows fired by Skeletons. In Creative, all bows have this ability by default, although they are not enchanted.

Tool Enchantments
! 32
 * - align="center"
 * Rape Master
 * Allows extreme rape
 * V
 * +10% mining speed
 * Most blocks break instantly at levels IV and V.
 * Most blocks break instantly at levels IV and V.

The speed increase applies to all blocks mined, not just the ones the tool is appropriate for. ! 33 ! 34 ! 35
 * - align="center"
 * Silk Touch
 * Silk Touch
 * Blocks mined will drop themselves, even if it should drop something else (e.g. Stone will drop stone, not Cobblestone).
 * I
 * Allows the collection of normally unobtainable blocks such as Ores, Mycelium, Double Slabs and Huge Mushrooms. (Regardless of the tool used as of 1.0)
 * - align="center"
 * - align="center"
 * Unbreaking
 * At each use, there's a chance the tool's durability will not decrease.
 * III
 * For example, an Unbreaking III item has a chance to use up a use of (100/(3+1))% = (100/4)% = 25%, so Unbreaking III should, on average, make a tool last 4 times as long.
 * - align="center"
 * For example, an Unbreaking III item has a chance to use up a use of (100/(3+1))% = (100/4)% = 25%, so Unbreaking III should, on average, make a tool last 4 times as long.
 * - align="center"
 * Fortune
 * Fortune
 * Can multiply the drop rate of items from blocks
 * III
 * I: 30% * 2 (30% more)

II: 25% * 2, 25% * 3 (75% more)

III: 20% * 2, 20% * 3, 20% * 4 (120% more)


 * Only applies to item drops such as coal, diamond, redstone, lapis lazuli and nether wart. When used on wheat, only the seeds' drop rate is affected. Increases the chance for gravel to drop flint instead of itself, up to 100% at III. It doesn't affect clay ball drop rates (it is always 4).
 * }

How Enchantments Are Chosen
"Enchantment level" is the cost of the enchantment in experience levels (the green number on the button). "Enchantment power" is the strength of the particular enchantment. For example, "Sharpness IV" has power 4. The enchantment algorithm uses a three-step process.

Step One - Applying modifiers to the enchantment level
The first thing that Minecraft does is apply two modifiers to the base enchantment level. Each modifier is restricted to a certain range, with numbers close to the middle of the range more common than those near the ends.

The first modifier is based on the item's "enchantability," which depends on the material and the type of the item (see the table below). Minecraft picks a number between 0 and the enchantability, then adds that number plus one to the enchantment level. Bows have an enchantability of 1 for this purpose. This random value follows a triangular distribution (like rolling a pair of dice and adding) so results close to half the enchantability are much more likely than results at the extremes.

Next, Minecraft picks a value between 0.75 and 1.25, again with a triangular distribution. The modified enchantment level is multiplied by this value (so it could increase or decrease by up to 25%) and then rounded to the nearest integer.

Step 1 pseudocode
/* Returns a uniformly distributed random number between [0,n) */ function randomInt(n);

/* returns a uniformly distributed random number between [0,1) */ function randomFloat;

int j = item_enchantability int i = chosen_enchantment_level int j2 = 1 + randomInt(j/2 + 1) + randomInt(j/2 + 1); int k = j2 + i; float f = (randomFloat + randomFloat - 1) * 0.25; int final_level = (int)((float)k * (1.0 + f) + 0.5); Source:

Step Two - Find possible enchantments


Now, based on the modified level, Minecraft makes a list of all enchantment types that can be applied to the target item along with the power that each enchantment will have.

The power of each enchantment type is determined by the level and the values in the table below. For each power value of an enchantment type, there is a minimum and maximum level that can produce the enchantment at that power. If the modified enchantment level is within the range, then the enchantment will be assigned that power. If the level is within two overlapping ranges for the same enchantment type, the higher power value is used.

The minimum values are all calculated using a linear function y = kx+m 	where y is the calculated minimum value, x is the current enchantment power level and k and m varies between different enchantments. The maximum values are all the minimum values plus a constant that varies for each enchantment.

Source:

Note: that extremely high modified enchantment levels can fall outside the ranges of all valid enchantments for the item. If this happens, the item is left un-enchanted, but you are not charged any experience levels and can try enchanting it again.



Step Three - Select a set of enchantments from the list
Now that it's got a list of the possible enchantments for the item, Minecraft has to pick some of them that will actually be applied.

You always get at least one enchantment. The first enchantment is picked from a list of statistical "weights" - the enchantment with the higher weight has a higher chance of being selected.

After the first element is selected, there is a chance of receiving more, based on this algorithm:


 * 1) Divide the modified level in half, rounded down. (This does not affect the possible enchantments themselves, because they were all pre-calculated in Step Two.)
 * 2) With probability (modified level + 1) / 50, keep going. Otherwise, stop picking bonus enchantments.
 * 3) Remove from the list of possible enchantments anything that conflicts with previously-chosen enchantments.
 * 4) Pick one enchantment from the remaining possible enchantments (based on the weights, as before) and apply it to the item.
 * 5) Repeat from step 1.

Conflicting Enchantments
Some enchantments conflict with other enchantments and thus both can't be enchanted into the same item, Effectively taking down the possibility for one to get an overpowered weapon.

The rules for enchantment conflicts are:
 * Every enchantment conflicts with itself. (So you can't get a tool with two copies of the Efficiency enchantment.)
 * All protection enchantments conflict with each other, so an item can only have one at a time. (In the code, Feather Fall is implemented as a protection enchantment, but it doesn't conflict with the others.)
 * All damage enchantments (Sharpness, Smite, and Bane of Arthropods) conflict with each other.
 * Silk Touch and Fortune also conflict with each other. (The Silk Touch enchantment has no effect on a pickaxe that also has Fortune, such as could be obtained in a 1.9 prerelease or with an inventory editor, since a Silk Touch pickaxe cannot mine resources such as diamonds or coal—only their ore blocks.)

Examples

 * A level 50 diamond pickaxe would have a 16.10% chance to have 3 enchantments, a 48.09% chance to have exactly 2 enchantments and a 35.80% chance to have exactly 1 enchantment. The resulting enchantments would have a 75.43% chance to include Efficiency (9.26% for 3, 39.97% for 4 and 26.21% for 5), a 54.85% chance to include Unbreaking 3, a 28.88% chance to include Fortune (27.22% for 2 and 1.66% for 3) and a 15.06% chance to include Silk Touch 1.
 * A level 30 iron pickaxe would have a 6.34% chance to have 3 enchantments, a 34.65% chance to have exactly 2 enchantments and a 59.00% chance to have exactly 1 enchantment. The resulting enchantments would have a 68.08% chance to include Efficiency (22.60% for 2, 41.59% for 3 and 3.89% chance for 4), a 65.53% chance to include Unbreaking (57.98% for 2, 7.55% for 3), a 21.05% chance to include Fortune (5.36% for 1, 13.08% for 2, 2.60% for 3) and a 10.72% chance to include Silk Touch 1.
 * A level 1 stone pickaxe would have a 6.04% chance to have 2 enchantments and a 93.73% chance to have exactly 1 enchantment. The resulting enchantments would have a 84.84% chance to include Efficiency 1 and a 18.86% chance to include Unbreaking 1.
 * A level 50 diamond helmet would have a 0.28% chance to have 3 enchantments, a 35.03% chance to have exactly 2 enchantments and a 64.70% chance to have exactly 1 enchantment. The resulting enchantments would have a 83.09% chance to include Protection (66.43% for 3 and 16.66% for 4), a 5.05% chance to include Fire Protection (5.03% for 3 and 0.02% for 4), a 38.33% chance to include Respiration 3, a 0.96% chance to include Aqua Affinity 1 and a 0.32% chance to include Blast Protection 4.  It would also have a 6.65% chance of being left "un-enchanted" (see note above).
 * A level 37 diamond helmet would have a 0.32% chance to have 3 enchantments, a 37.05% chance to have exactly 2 enchantments and a 62.63% chance to have exactly 1 enchantment. The resulting enchantments would have a 64.44% chance to include Protection (40.93% for 2, 21.14% for 3 and 2.37% for 4), a 17.59% chance to include Fire Protection (10.93% for 3 and 6.65% for 4), a 43.00% chance to include Respiration (42.88% for 2 and 0.12% for 3), a 11.66% chance to include Aqua Affinity 1, a 4.55% chance to include Blast Protection 4 and a 1.84% chance to include Projectile Protection 4.

How Enchantments Are Attached to an Item
The Enchantments of an item are determined by an extra set of data attached to the item.

The extra data is a "compound" labeled "tag"; Which contains a "list" of data named "ench"; in which is a series of "compound"[s] (one compound for each enchantment); Each of the "compound"[s] contains a pair of "short"[s] named "id" and "lvl";

The "id" short represents the EID of the enchantment and the "lvl" short represents the level of the enchantment.

Hacking Enchantments
It is possible to edit enchantments via an external program such as NBTEdit by using a process such as that shown here, or by installing Mods/TooManyItems and editing TooManyItems.txt so that your enchanted items can be accessed in game whenever you need them, or easier by using an enchantment editor like this one.

Standard Galactic Alphabet
The enchantments are written in the Standard Galactic Alphabet which is a simple alphabet substitution cipher used in the Commander Keen series of computer games (see that page for the code key).

This is something that may help you decode the language (but will not give leads on the enchanting result):

History
Notch first tweeted about the Enchantment Table on September 30th 2011. Notch stated that Enchanting will work in three stages and the benefits will be based on the spell you choose, but a random loot element will be included as well.

Enchanting was added to the game in 1.9 prerelease 2. However, enchanting was not the same in the 1.9 prerelease 2. Enchanting did NOT require bookshelves to get maximum enchantments. Also, many enchantments were not added back then. Enchantments are labeled in the enchanting table as random words in the Standard Galactic Alphabet.

In 1.1, four bow enchantments (Power, Flame, Punch and Infinity) were added to the game.

As of snapshot 12w05a, enchanting no longer requires experience in creative mode.

As of snapshot 12w06a, Iron Swords, Golden Swords, and Bows have a small chance of being already enchanted when dropped by their respective mobs.

Bugs

 * Using the "Silk Touch" enchantment, it is possible to obtain either Redstone Ore or Glowing Redstone Ore, depending on the block's state when broken. These are different blocks and do not stack with each other, but appear to be identical in the user's inventory.
 * In multiplayer, players can only see their own enchantment auras, and not those of other players. [reference needed ?]
 * In multiplayer, breaking a Storage Minecart containing enchanted items will remove the enchantments on all enchanted items.
 * This also happens with other containers.