Talk:Enchanting mechanics

Min/Max Levels
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)


 * 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
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
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)

How about books?
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
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&#124;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
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
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?
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: . I changed the text to be a bit less confusing. -- Orthotope talk 06:37, 5 July 2013 (UTC)