Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Enchanting table mechanics

From SAS Gaming Wiki
File:Enchanting Table GUI.png
Enchanting interface Template:In
File:Enchanting Table GUI BE.png
Enchanting interface Template:In

This article is about the mechanics of Minecraft:enchanting with Minecraft:enchanting tables.

Bookshelf placement

Nearby Minecraft:bookshelves raise the experience cost, which increases the value of the offered enchantments. The maximum number of active bookshelves is 15, and further bookshelves are ignored.

In order to have an effect, the bookshelves must be placed exactly two blocks from the Minecraft:enchanting table along one horizontal axis, up to two blocks along the other, and on the same height as the table or one block higher. Additionally, the bookshelf must not be blocked, the exact definition of which differes between the Template:Els.

Bedrock Edition

The 2-high space between the bookshelf and table must be Minecraft:air (even a torch, snow cover or carpet blocks the effect), where "between" is as shown in the following diagrams (the blank spaces are air, and the Template:BlockSprite do not matter):

Like this from the top: or
and like this from the side: or

Java Edition

The space between the bookshelf and table at the height of the bookshelf must be a block in the tag Template:Tag link like Minecraft:air, Minecraft:snow and Minecraft:short grass. For corner bookshelves, the space between is 1 block diagonal from the enchanting table; for all other bookshelves, the gap must be to the side of the enchanting table. This is illustrated in the following diagrams (the blank spaces are air, and the Template:BlockSprite do not matter):

Like this from the top: or
and like this from the side: or

The glyph particles, which fly from bookshelves, follow different rules and may appear even if the bookshelves are not enhancing the table.

There are many possible bookshelf arrangements that can reach the enchantment limit. A simple method is to surround the enchanting table with a 1-block high square of bookshelves with an empty space anywhere on the perimeter: Template:BlockGrid Another alternative that is now available is to build a 'library corner' where each bookshelf is two blocks high, as in the plan below. This arrangement gives space for 16 shelves, which is one more than needed, so if the corner bookshelf column cannot be seen, removing one of the two bookshelves in that does not have any effect, either technically or visually. Template:BlockGrid

With a Minecraft:data pack, it's possible to replace the bookshelf with a block in the tag Template:Tag link.

Requirements

For an item to be enchanttable, it must fulfill these conditions:

If the item meets the conditions but has no available enchantments, it will be possible to select the slot at the enchanting table, but nothing will happen.

Experience cost

When an item is placed in an Minecraft:enchanting table, the Minecraft:experience cost of each enchantment slot is selected depending on the slot and the number of nearby Minecraft:bookshelves, which is capped at 15.

For each slot, a base experience cost is calculated as:

<math>xpBase\gets 1+\text{randInt}\left(7\right)+\left\lfloor\frac{\min\left(15,bookshelves\right)}2\right\rfloor+\text{randInt}\left(\min\left(15,bookshelves\right)\right)</math>
where <math>\text{randInt}</math> generates a random integer in range <math>0</math> to <math>n</math> (both included).

The final experience cost is then calculated depending on the slot:

Top slot: <math>xpCost\gets \left\lfloor\max\left(1,\frac{xpBase}3\right)\right\rfloor</math>
Middle slot: <math>xpCost\gets \left\lfloor\frac{2\cdot xpBase}3\right\rfloor+1</math>
Bottom slot: <math>xpCost\gets \left\lfloor\max\left(xpBase,2\cdot bookshelves\right)\right\rfloor</math>
Bookshelves 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Experience cost of top slot 1–2 1–3 1–3 1–4 1–4 1–5 1–5 1–6 1–6 1–7 2–7 2–8 2–8 2–9 2–9 2–10
Experience cost of middle slot 1–6 1–7 2–8 2–9 3–10 3–11 3–12 3–13 4–14 4–15 5–16 5–17 5–18 5–19 6–20 6–21
Experience cost of bottom slot 1–8 2–9 4–11 6–12 8–14 10–15 12–17 14–18 16–20 18–21 20–23 22–24 24–26 26–27 28–29 30

Enchantment selection

This section describes how enchantments for an item are selected for a given experience cost.

This process is used by various mechanics:

Enchantment cost

For each slot, the enchantment cost, which is not shown in game, is calculated depending on the item's enchantability and the experience cost:

<math>eCost\gets \text{round}\left(\left(xpCost+1+\text{randInt}\left(\left\lfloor\frac{enchantability}4\right\rfloor\right)+\text{randInt}\left(\left\lfloor\frac{enchantability}4\right\rfloor\right)\right)\cdot\left(1+\text{randTri}\left(n\right)\right)\right)</math>
where <math>\text{randInt}\left(n\right)</math> generates a random integer in range <math>0</math> to <math>n</math> (both included)
and <math>\text{randTri}\left(n\right)</math> generates a random number in range <math>-n</math> (included) to <math>n</math> (excluded) with Template:W:
<math>\text{randTri}\left(n\right)\mapsto\left(\text{randFloat}\left(\right)+\text{randFloat}\left(\right)-1\right)\cdot n</math>
where <math>\text{randFloat}\left(\right)</math> generates a random number in range <math>0</math> (included) to <math>1</math> (excluded).

Template:Anchor Template:IN, an item's enchantability is stored in the Template:DCL item component.

Item Enchantability <math>\left\lfloor\frac{enchantability}4\right\rfloor</math>
Template:ItemLink 25 6
Template:ItemLink 22 5
Template:ItemLink
Template:ItemLink
Template:ItemLink
Template:ItemLink
Template:ItemLink
15 3

Template:ItemLink

14 3

Template:ItemLink

13 3
Template:ItemLink 12 3
Template:ItemLink
Template:ItemLink
10 2
Template:ItemLink
Template:ItemLink
9 2
Template:ItemLink 8 2
Template:ItemLink 5 1
Template:Collapse 1 0

Candidates

Template:IN, the initial candidates are:

In vanilla, this means that all non-treasure enchantments are initially candidates, and that for Minecraft:generated loot and Minecraft:fishing, Minecraft:Curse of Binding, Minecraft:Curse of Vanishing, Minecraft:Frost Walker, and Minecraft:Mending are also initial candidates.

If the item to enchant is not a Minecraft:book, all enchantments to which the item is not a primary item are removed.

Finally, the level for each enchantment is determined. The enchantment's highest level for which the enchantment cost falls within its cost range is the candidate, and if the cost is not within any of its ranges, the enchantment is removed.

Template:IN, enchantments, including which other enchantments they're exclusive with, what items are primary to them, and the cost ranges of their levels are defined in Minecraft:enchantment definition. Books being primary to all enchantments is hardcoded.

Selection

The selection uses repetition, in which it selects one of the candidate enchantments and has a chance to repeat and add additional enchantments. The change of the enchantment cost in this final stage does not retroactively change the set of candidate.

  1. A random candidate is selected based on weights, meaning the chance of a candidate being selected is its weight divided by the total weight of the current candidates.
  2. The selected candidate and incompatible ones are removed from the set of candidates, and if no candidates remain, the selection ends.
  3. If a chance of <math>\frac{eCost+1}{50}</math> is fails, the enchantment selection ends.
  4. The enchantment cost (<math>eCost</math>) is divided by two and rounded down, and the process returns to step 1.

Finally after the loop, if the item is a Minecraft:book, an Minecraft:enchanting table is used, and multiple enchantments were selected, a random one is removed.

Storing enchantments

If the item being enchanted is a Minecraft:book, it will be turned into an Minecraft:enchanted book and Template:In the enchantments are stored in the Template:DCL component.

Template:IN, for all other items, the enchantments are stored in the Template:DCL component.

Enchanting seed

The Minecraft:enchantments that Minecraft:enchanting tables offer are determined using the enchanting seed that is stored under Template:Code in each player's data. After enchanting an item, the player's seed is regenerated, resulting in different enchantments.

This means enchanting tables with the same number of nearby bookshelves will offer the same enchantments for all items with the same enchantability and the same possible enchantments (same item-type or one of pickaxes, shovels or hoes) until an item is enchanted.

Initial seed

Template:Exclusive When joining a world for the first time, the seed is initialized to Template:Code, however when joining a world with an already present enchanting seed of Template:Code, it will be regenerated.<ref>Template:Bug</ref>

This meaning leaving and rejoining a world for the first time gives new enchantments without enchanting an item, and the first enchantment before ever leaving a world will always give the same enchantment for the same item-bookshelves-combination,such as Minecraft:Looting III and Minecraft:Unbreaking III for a Minecraft:Netherite Sword with 15 bookshelves.

Receivable enchantments

The given cost-ranges are the effective ranges.<ref>In the games code, there are overlaps between some ranges and some other ranges have negative sizes, however in cases of overlaps the higher level always wins, and negative ranges make the level impossible to receive, so the overlaps and negative ranges have been removed for simplicit, which does not affect outcomes in any way.</ref>

Item Enchantment Compatibility Weight Level I
cost
Level II
cost
Level III
cost
Level IV
cost
Level V
cost
Template:ItemLink Minecraft:Aqua Affinity 2 1–41
Minecraft:Respiration 2 10–19 20–29 30–60
Minecraft:ThornsTemplate:Only 1 10–29 30–49 50–100
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Blast Protection Template:Tc 2 5–12 13–20 21–28 29–37
Minecraft:Fire Protection 5 10–17 18–25 26–33 34–42
Minecraft:Projectile Protection 5 3–8 9–14 15–20 21–27
Minecraft:Protection 10 5–12 13–20 21–28 29–37
Template:ItemLink Minecraft:Thorns 1 10–29 30–49 50–100
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Blast Protection Template:Tc 2 5–12 13–20 21–28 29–37
Minecraft:Fire Protection 5 10–17 18–25 26–33 34–42
Minecraft:Projectile Protection 5 3–8 9–14 15–20 21–27
Minecraft:Protection 10 5–12 13–20 21–28 29–37
Template:ItemLink Minecraft:ThornsTemplate:Only 1 10–29 30–49 50–100
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Blast Protection Template:Tc 2 5–12 13–20 21–28 29–37
Minecraft:Fire Protection 5 10–17 18–25 26–33 34–42
Minecraft:Projectile Protection 5 3–8 9–14 15–20 21–27
Minecraft:Protection 10 5–12 13–20 21–28 29–37
Template:ItemLink Minecraft:Feather Falling 5 5–10 11–16 17–22 23–29
Minecraft:ThornsTemplate:Only 1 10–29 30–49 50–100
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Blast Protection Template:Tc 2 5–12 13–20 21–28 29–37
Minecraft:Fire Protection 5 10–17 18–25 26–33 34–42
Minecraft:Projectile Protection 5 3–8 9–14 15–20 21–27
Minecraft:Protection 10 5–12 13–20 21–28 29–37
Minecraft:Depth Strider Template:Tc 2 10–19 20–29 30–45
Template:ItemLink Minecraft:Fire Aspect 2 10–19 20–80
Minecraft:Knockback 5 5–24 25–75
Minecraft:Looting 2 15–23 24–32 33–83
Minecraft:Sweeping EdgeTemplate:Only 2 5–13 14–22 23–38
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Bane of Arthropods Template:Tc 5 5–12 13–20 21–28 29–36 37–57
Minecraft:Sharpness 10 1–11 12–22 23–33 34–44 45–65
Minecraft:Smite 5 5–12 13–20 21–28 29–36 37–57
Template:ItemLink Minecraft:Fire Aspect 2 10–19 20–80
Minecraft:Knockback 5 5–24 25–75
Minecraft:Looting 2 15–23 24–32 33–83
Minecraft:Lunge 5 5–12 13–20 21–41  
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Bane of Arthropods Template:Tc 5 5–12 13–20 21–28 29–36 37–57
Minecraft:Sharpness 10 1–11 12–22 23–33 34–44 45–65
Minecraft:Smite 5 5–12 13–20 21–28 29–36 37–57
Template:ItemLink Minecraft:CleavingTemplate:Only 2 5–24 25–44 45–65  
Minecraft:Efficiency 10 1–10 11–20 21–30 31–40 41–91
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Fortune Template:Tc 2 15–23 24–32 33–83  
Minecraft:Silk Touch 1 15–65      
Minecraft:Bane of ArthropodsTemplate:Only Template:Tc 5 5–12 13–20 21–28 29–36 37–57
Minecraft:SharpnessTemplate:Only 10 1–11 12–22 23–33 34–44 45–65
Minecraft:SmiteTemplate:Only 5 5–12 13–20 21–28 29–36 37–57
Template:ItemLink
Template:ItemLink
Template:ItemLink
Minecraft:Efficiency 10 1–10 11–20 21–30 31–40 41–91
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Fortune Template:Tc 2 15–23 24–32 33–83  
Minecraft:Silk Touch 1 15–65      
Template:ItemLink Minecraft:Flame 2 20–50
Minecraft:Power 10 1–10 11–20 21–30 31–40 41–56
Minecraft:Punch 2 12–31 32–57    
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Infinity Template:Tc 1 20–50    
Template:ItemLink Minecraft:Quick Charge   5 12–31 32–50    
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Multishot Template:Tc 2 20–50      
Minecraft:Piercing 10 1–10 11–20 21–30 31–50
Template:ItemLink Minecraft:Luck of the Sea   2 15–23 24–32 33–83   
Minecraft:Lure   2 15–23 24–32 33–83   
Minecraft:Unbreaking 5 5–12 13–20 21–71
Template:ItemLink Minecraft:Impaling 2 1–8 9–16 17–24 25–32 33–53
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Channeling Template:Tc 1 25–50  
Minecraft:Loyalty 5 12–18 19–25 26–50  
Minecraft:Riptide Template:Tc 2 17–23 24–30  31–50   
Template:ItemLink Minecraft:Fire Aspect 2 10–19 20–80
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Wind Burst 2 15–23 24–32 33–83
Minecraft:Breach Template:Tc 2 15–23 24–32 33–41 42–92 
Minecraft:Density 5 5–12 13–20 21–28 29–36  37–57
Template:ItemLink Minecraft:Aqua Affinity 2 1–41
Minecraft:Efficiency 10 1–10 11–20 21–30 31–40 41–91
Minecraft:Feather Falling 5 5–10 11–16 17–22 23–29
Minecraft:Fire Aspect 2 10–19 20–80
Minecraft:Flame 2 20–50
Minecraft:Impaling 2 1–8 9–16 17–24 25–32 33–53
Minecraft:Knockback 5 5–24 25–75
Minecraft:Looting 2 15–23 24–32 33–83
Minecraft:Luck of the Sea   2 15–23 24–32 33–83   
Minecraft:Lunge 5 5–12 13–20 21–41  
Minecraft:Lure   2 15–23 24–32 33–83   
Minecraft:Power 10 1–10 11–20 21–30 31–40 41–56
Minecraft:Punch 2 12–31 32–57    
Minecraft:Quick Charge   5 12–31 32–50    
Minecraft:Respiration 2 10–19 20–29 30–60
Minecraft:Sweeping EdgeTemplate:Only 2 5–13 14–22 23–38
Minecraft:Thorns 1 10–29 30–49 50–100
Minecraft:Unbreaking 5 5–12 13–20 21–71
Minecraft:Wind Burst 2 15–23 24–32 33–83
Minecraft:Bane of Arthropods Template:Tc 5 5–12 13–20 21–28 29–36 37–57
Minecraft:Breach 2 15–23 24–32 33–41 42–92 
Minecraft:CleavingTemplate:Only 2 5–24 25–44 45–65  
Minecraft:Density 5 5–12 13–20 21–28 29–36  37–57
Minecraft:Sharpness 10 1–11 12–22 23–33 34–44 45–65
Minecraft:Smite 5 5–12 13–20 21–28 29–36 37–57
Minecraft:Blast Protection Template:Tc 2 5–12 13–20 21–28 29–37
Minecraft:Fire Protection 5 10–17 18–25 26–33 34–42
Minecraft:Projectile Protection 5 3–8 9–14 15–20 21–27
Minecraft:Protection 10 5–12 13–20 21–28 29–37
Minecraft:Channeling Template:Tc 1 25–50  
Minecraft:Loyalty 5 12–18 19–25 26–50  
Minecraft:Riptide Template:Tc 2 17–23 24–30  31–50   
Minecraft:Depth Strider Template:Tc 2 10–19 20–29 30–45
Minecraft:Fortune Template:Tc 2 15–23 24–32 33–83  
Minecraft:Silk Touch 1 15–65      
Minecraft:Infinity Template:Tc 1 20–50    
Minecraft:Multishot Template:Tc 2 20–50      
Minecraft:Piercing 10 1–10 11–20 21–30 31–50

History

Template:HistoryTable

References

Template:Reflist

External links

Navigation

Template:Navbox gameplay

Minecraft:cs:Princip očarování Minecraft:es:Mecánicas de encantamiento Minecraft:it:Meccaniche del tavolo per incantesimi Minecraft:ja:エンチャントの仕組み Minecraft:ko:마법 작동 원리 Minecraft:lzh:淬靈 Minecraft:pt:Mecânica de encantamento Minecraft:th:กลไกการร่ายมนตร์ Minecraft:zh:附魔(物品修饰)