I downloaded the Minecraft Coder Pack and decompiled the source code for versions 1.0 and 1.1. Despite having practically no java experience, it did not take me more than a few minutes to find what had changed. In fact, the only difference was a single line, which had previously read j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt(j + 1);
and which now reads j = 1 + (j >> 1) + random.nextInt(j + 1);

It is immediately obvious that saying that they "decreased the randomness" means they literally went into the code and deleted one call to the function "random.nextInt". At this stage of the code, j is the number of book shelves around the enchantment table, and is capped at 30.

What this means is that the enchantment level is calculated by adding together 1, half the number of bookshelves (rounded down), and a random integer between 0 and the number of bookshelves. Later on in the code, a random integer between 0 and 4 is added to this. Previously, instead of using half the number of bookshelves, a second random integer between zero and half the number of bookshelves had been used.

This obviously skews the distribution of the offered enchantment levels toward the higher levels, but it also makes lower level enchantments impossible to obtain if you have too many bookshelves. This is not an issue, however, because adding and removing bookshelves is not at all difficult. The net result is that instead of requiring an average of 2480 attempts to be offered a level 50 enchantment as before, the user need only make an average of 155 attempts. This should take less than a couple of minutes to find for most players. The updated probability distributions are shown in Figure 1, with the original distributions shown as dotted lines. The sloping distribution in the upper and lower five levels of the range are caused by the additional random integer between 0 and 4 that is added on.

The more important relationship for the player is the one that tells the player the optimum number of bookshelves to use to obtain an enchantment of some desired level. The fact that higher levels are more likely has an interesting effect. Previously, the probability of obtaining lower levels was high enough that the bottom slot was almost always the most likely to offer the level you wanted, even if that level was much lower than the maximum available. After the update, however, the top and middle slots play a significant role, resulting in the optimum number of bookshelves having local minima at levels 26 and 34. The optimum number of bookshelves required is shown in Figure 2.

Figure 2: Optimum number of bookshelves to obtain a desired enchantment level

Thanks go to FifthWhammy for pointing out a small error. It has been corrected.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.

Total Pageviews

Unless otherwise specified, all original work contained in this blog, written or otherwise, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. You are free to do whatever you like with the content, as long as you (a) credit me as the original author, (b) do not make people pay for it, (c) make it available under the same licence, and (d) keep it away from the penguins.