Talk:Enchantment mechanics

From Minecraft Wiki
Jump to: navigation, search

Min/Max Levels[edit source]

According to the page, the min and max range for bookshelves, b, seems a bit weird to me when b = 30. Even if that table is designed using the third slot, the formula itself gives me a minimum level of 16 to 50. If it was designed for the first slot, which sets s to 0.5, i get a range of 8 to 25 not the min of 9 shown there. On the off-hand chance of it being designed for the second slot, it gets a range for 11 to 33. Where is it that it's getting a minimum level of 9? Kalbintion 22:06, 7 June 2012 (UTC)

The maximum assumes the bottom slot is used, and the minimum uses the top slot. The problem is that the formula is not quite accurately described. Starting with
Base enchantment level available = (1..5 + (b/2) + 0..b)
where b is the number of bookshelves (as on the page currently), the top slot has
Actual level = (base / 2) + 1
and the middle slot has
Actual level = ((base * 2) / 3) + 1
All calculations are performed in integer arithmetic (all fractions round down). That '+ 1' is why the minimum level with 30 bookshelves is 9, rather than 8. Of course, all this may have changed in the latest snapshot releases. -- Orthotope 01:36, 8 June 2012 (UTC)
The base formula still seems wrong. With 15 bookshelves, you get a base of 1..5 + (15/2) + 0..15, thus the max level available would be 5 + 7 + 15 = 27 (and 5 with no bookshelves at all). Ord did I get something wrong ? --78.210.48.117 08:32, 2 September 2012 (UTC)
I got exactly the same answer in as the previous post using the formula as it is on the page. I also used the formula to calculate the minimum for b = 15. That gives me exactly 4.25, while this page says it should be 2 (rounded down). I also got the same answer for b = 0, so I think somethings wrong with this formula. --Creator13 18:40, 17 September 2012 (UTC)
This was changed in 1.3. New formulas:
Base level = (1..8 + (b/2) + 0..b)
Top slot level = max(base / 3, 1)
Middle slot level =  ((base * 2) / 3) + 1 (same as before)
Bottom slot level = max(base, b * 2)
-- Orthotope 02:18, 18 September 2012 (UTC)
Sorry for complaining more, but I don't understand some parts of the formula, like the "max" before the top and bottom slot formula; and in the top slot, I don't understand the comma between the 3 and the 1. Does this mean 3.1, or anything else of a higher mathematical level than I have :/ ? Please forgive me about asking this, but I'm writing a program where I need these formulas. By the way, may we ask things like this on the discussion page, if not, please tell me so I know it for the next time... --Creator13 19:48, 18 September 2012 (UTC)
max(a, b) picks the greater of the two numbers a and b. In the top slot, this ensures the level is at least 1 (with no bookshelves, base can be as low as 1, and in integer arithmetic 1/3 = 0). In the bottom slot, the level will always be at least twice the number of bookshelves. This is why it always gives a level 30 enchantment when you have 15 bookshelves nearby. -- Orthotope 03:02, 19 September 2012 (UTC)
Thanks, really, this helped me alot. Except that I now have to rewrite the code... Creator13 19:00, 19 September 2012 (UTC)

probability after 1.3.1[edit source]

Can anyone confirm these probability charts? According to the charts it is no longer possible to get efficiency 5 on a diamond pick.

- Also not possible to get Sharpness V on diamond sword and it's only 0.2% chance on a golden sword with level 30. 94.237.64.32 23:58, 19 August 2012 (UTC)

Move page[edit source]

I think this page should be merged with enchanting since it involves enchantments. 64.56.253.180 20:19, 6 December 2012 (UTC)

They originally were on the same page. This information was split off as it's rather technical, and players don't need to understand it in order to make use of enchantments. -- Orthotope 08:52, 7 December 2012 (UTC)
Actually it isn't technical, but not everyone can figure out the ideal enchantment level using math.71.35.109.25 21:16, 22 February 2015 (UTC)

How about books?[edit source]

Enchantability is clearly not an issue, but contra some rumors, I did see enchantments up to level 30 when I tried it (only once so far). Can anyone figure out how enchanted books pick their results? --Mental Mouse 21:32, 21 December 2012 (UTC)

I only did some experimenting in creative, but I noticed that books will only pick one enchantment. You can use up to 30 levels to enchant them, and the higher the level, the more likely for a higher level/better enchantment. I would assume that the algorithm is very much the same, only it picks 1 enchantment rather than allowing for multiples. I'd be interested to see what other people find as well. --Kahless61 21:37, 21 December 2012 (UTC)
Using Minecraft Coder Pack I've found out that enchantability value of the book item is 1, the same as for bow. --skupr [this was posted at 09:51, December 25, 2012]
Thanks! --Mental Mouse 12:17, 25 December 2012 (UTC)
I added a spreadsheet to the Enchant Probabilities Chart section at the bottom of the article. It includes the probabilities for enchantments on books. It's in an old Excel format, which I hope is acceptable. Teh chad 18:41, 8 January 2013 (UTC)
Perhapse you could decrypt the excel format with reguard to Silk Touch on a book. Being that the only legitimate method of obtaining webs is to aquire a silk touch book to enchant shears, discovering the most effective number of levels to apply has become a noteworthy challenge. Pestilencemage 1 Febuary 2013

Slot[edit source]

Please, explain what is meaning of word "slot" in this text. In the text of Enchantment_Table is used word "slot" for square to place an item. On the right side of slot there are 3 buttons for displaying cryptic runes. Is the "slot" meaning the "button" in the text of Enchantment_mechanics? Thanks. –Preceding unsigned comment was added by Bj9 (Talk|Contribs) 17:48, 4 January 2013 (UTC). Please sign your posts with ~~~~

Yes, they are using the word "slot" to mean the three buttons on the right side of the enchant display. They probably could have chosen a more specific word. Teh chad 18:38, 8 January 2013 (UTC)

Enchant Probability Update[edit source]

I created a test harness to test enchantment probabilities. It takes a list of all enchantable items and loops through all 30 possible levels spent on each enchantment. It does one million enchantments per item per experience level. This means that there are 30 million tests done per item type. I added a link to the spreadsheet at the bottom of the main article in the Enchantment Probability Chart section. The spreadsheet is in an older Excel format, so it should be able to be opened by open source spreadsheet programs. I included the aggregated raw data in the spreadsheet as well. It should provide a pretty interesting read. --Teh chad 17:47, 8 January 2013 (UTC)

Step 3 explanation[edit source]

I think there is too little information in step 3. It's about selecting the enchantments which will be applied to the item, but I don't actually see anything on how that actually happens. Also, I don't get the formula: what is "P(enchantment)"? Could anyone please help me with this? I need it for for a program I'm making, so... --Creator13 19:15, 21 March 2013 (UTC)

In plain english, that formula says the probability of any given enchantment being chosen is the weight of that enchantment divided by the sum of the weights of all possible enchantments for the item being enchanted. In code, this is usually done by generating a random integer less than that sum, and figuring out which weighted enchantment it corresponds to. For example, the tool enchantments have weights of 10, 1, 5, and 2, so you'd generate a random number in the range 0-17 inclusive: 0-9 would be Efficiency, 10 is Silk Touch, 11-15 for Unbreaking, and 16-17 is Fortune. Make sense? -- Orthotope 04:26, 22 March 2013 (UTC)
Wouldn't it be an idea to post this on the main page? 83.163.218.191 17:25, 22 March 2013 (UTC)

Step 1: Code or Text?[edit source]

It seems to be some inconsistency between the textual description and some of the formulas / pseudocode:

"Minecraft picks a number between 0 and half the enchantability, (actually 1/4 rounded down and multiplied by 2)"

vs

"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"


If the random number is between 0 and half enchantability, then results of a triangular distribution should be close to a quarter of enchantability, not half.

But then, pseudocode presents this:

int rand_enchantability = 1 + randomInt(enchantability_2 / 2 + 1) + randomInt(enchantability_2 / 2 + 1);

Which seems to be a triangular distribution between 0 and full enchantability (not half), which does make half enchantability results more likely.

So, what is the correct behavior? MestreLion 05:06, 5 July 2013 (UTC)

Note the previous line in the pseudocode: enchantability_2 = enchantability / 2. I changed the text to be a bit less confusing. -- Orthotope talk 06:37, 5 July 2013 (UTC)

Possible Mistake for 14 bookselves[edit source]

Given the formula

(base) = (1..8 + floor(b/2) + 0..b)

and

Bottom slot enchantment level = max (base, b × 2)

When b = 14 (14 bookcases), and assuming highest random number you get:

(base) = 8 + floor(14/7) + 14 = 29
b × 2 = 28

Thus

max (29, 28)  =  29

However, it is recorded that the highest level for 14 bookshelves is 28.

0pteron 17:43, 15 August 2013 (UTC)

Update desperately needed![edit source]

This page desperately needs to be updated to include the new enchants added in 1.6. (Fishing.) We now have 1.7 and they still haven't been added! 79.77.42.218 14:44, 21 February 2014 (UTC)

There should be information for the enchantability of a fishing rod.

75.165.49.48 04:34, 29 January 2015 (UTC)

Clarification for modified enchantment leve[edit source]

The article says that the level is multiplied by a random value from 0.85 to 1.15. How is this rounded?75.165.49.48 03:32, 28 January 2015 (UTC)

Quote from the article: "The modified enchantment level is multiplied by this value (so it could increase or decrease by up to 15%) and then rounded to the nearest integer." KnightMiner (t·c) 03:53, 28 January 2015 (UTC)

Fishing rod[edit source]

This page does not have the enchantability of a fishing rod. What is the enchantability of a fishing rod?71.35.109.25 21:13, 22 February 2015 (UTC)


It's 1. Source: http://i.imgur.com/vn4HV3r.png check near the bottom. --207.62.170.220 03:55, 2 December 2015 (UTC)

Enchantment probabilities w/preview[edit source]

I don't see it anywhere, but it would certainly be nice to have a chart for the probabilities of getting an enchantment level with the a priori knowledge of getting the enchantment class. For instance, at level 30, you have an 8.6% chance of getting Fortune III, and a 5.3% chance of getting Fortune II. But, from the preview I already know I'm getting Fortune X so in reality my chance of getting Fortune III is: 8.6 / (8.6 + 5.3) = 62% chance. At least on the console version, it only seems to show the enchantment from base level (30 < 33, so Fortune II) in the preview and the actual enchantment uses the full formula. 205.208.103.113 17:01, 31 March 2016 (UTC)

Cursed Enchantments[edit source]

I was hoping to update the table under the "Step Three" section with the new cursed enchantments, but am unaware of their weights. Does anyone know what they are, or how to find out? Thanks. DelboyDylan (talk) 18:07, 10 October 2016 (UTC)

They're both weight 1. If you can see into a decompiled 16w40a jar, in the aie.class, you can see at the bottom where it's registering all the enchantments, where the parameter is new aia( aia.a.d, ..., that it's using the same value for the curses as it does for Thorns, Silk Touch and Infinity. – Sealbudsman talk/contr 20:30, 10 October 2016 (UTC)

Sweeping Edge[edit source]

Anyone know if this is considered a treasure enchantment or not? –Preceding unsigned comment was added by 65.94.228.190 (talk) at 12:54, 10 January 2017 (UTC). Please sign your posts with ~~~~

Someone would need to check the code to find out. Orthotope? Anomie x? The BlobsPaper.png 16:07, 10 January 2017 (UTC)
It's not a treasure enchantment.
In the decompiled 1.11.2.jar, aiv.class corresponds to the Sweeping enchantment, and it does not override the default behavior of the Enchantment abstract class aii.class, which is that c() (a.k.a. in MCP 9.31 isTreasureEnchantment()) returns false. This is the method that returns true in the case of Frost Walker, Mending and both Curses.
Also for future reference, you can sort of tell that it's not a treasure enchantment: a treasure enchantment is one that "can never be created by an enchantment table," (see the paragraph at treasure enchantment) whereas Sweeping can be applied to swords on an enchantment table (see the entry at Sweeping Edge). But on the other hand, it never hurts to check! – Sealbudsman talk/contr 17:17, 10 January 2017 (UTC)
Before adding it, though, we need to know its weight. Then, it should be added to the table. The BlobsPaper.png 17:22, 10 January 2017 (UTC)

 Done. It has the same weight as Fire Aspect and Looting. – Sealbudsman talk/contr 17:24, 10 January 2017 (UTC)