1.17 enchanting table gives lower efficiency to diamond tools?

I don't know if it's a bug or a new system but I've created a world in 1.17 (Java Win10) and my enchantment table gives lower efficiency levels to my diamond tools. When I put my iron axe, pickaxe etc. table gives efficiency IV but right after when I put diamond versions of the same tools it only gives efficiency III ??? It's not like that in the 1.16, enchantment table gives same enchantment and same levels to same in whether it's iron or diamond or even wooden. Is anyone know a solution or experiencing the same problem????


Solution 1:

It's nothing new, and you just got a bad luck.

It's a matter of Enchantability - different materials (and item types) have different 'cost' for the enchantment.

In particular iron tools and weapons have enchantability of 14, while diamond ones - 10.

Minecraft picks a number between 0 and half the enchantability, then adds that number plus one to the enchantment level. This random value follows a triangular distribution (like rolling a pair of dice and adding) so results close to a quarter of the enchantability are much more likely than results at the extremes. [...] B + R1 + R2 + 1 [...] Division is rounded down.

So iron tools will get enchantability bonus of 1-5 with most frequent value of 3 (after rounding 10/4 down, the range of the random factor is is 0-2, so between 1+0+0 and 1+2+2) and diamond tools - 1-7, with 4 most frequent. (from floor(14/4) = 3, so between 1+0+0 and 1+3+3).

That means diamond tools are likely to receive better enchantments than iron ones - but this is still random and you may get unlucky, and e.g. get an enchantability bonus of 5 on your iron pick, and 1 on your diamond one, and after applying other modifications, arrive at score of 'enchantment level' of 32 for the iron pick (allowing for Efficiency IV), and 28 for diamond (only allowing Efficiency III).

Since the ranges of enchantment levels are rather long (so hitting the edge just as you did is rare) and the random distribution is biased towards middle of the ranges (so diamond will very rarely get lower bonus than iron), the situation you've encountered is quite rare, but it has been in the game for ages.