The Bug:
I was playing minecraft in a regular world a while back, and at one point, I had gotten a librarian villager, and said villager would trade me an enchanted book with Bane of Arthropods on it(Can't remember the specific enchantment level of the book, though I think it was II), at it's novice level. I believe that the villager wanted 15 or 16 emeralds in exchange for the enchanted book(note: the villager also wanted a regular book as a part of the trade, but that's not important here). I leveled the villager up to the apprentice level. That's where things started to get strange, as the villager wanted to sell me another enchanted book at a cost 3 or so more than the one sold at it's novice level. Problem was, though, the new enchanted book was the same as the one being sold at the novice level. It was even the same enchantment level as well, and I hadn't seen that before, though it was plausible that it could happen.
Possible Cause:
Although I haven't looked at the code for the villagers' trades myself, I can say with some certainty that there is a Math.random() portion to generate the enchantment type and level, for this to occur. As such, it's possible that the same villager could generate the same enchanted book as a different trade, though the chances of that are pretty low for that to happen. In this case, however, it did happen.
My idea to potentially patch the glitch:
If the code used to generate the villager's trade is also a part of the same file used to generate the villager itself, then maybe add a list of different enchantments to test for to see if the said villager has the trades; possibly in an arraylist if it's a java file. If so, then use the said array or arraylist to check the new enchanted book coming in to see if it matches any pre-existing enchanted books in the same villager. If it does match, then set the enchantment to be of a different type than that of the original enchanted book, or at least a different level, if possible.
Further notes:
Again, I haven't looked at the code itself for the villager's information, but seeing as I'm learning java, this might be the most likely scenario under the given circumstances. I may eventually add a video as a bit of proof if there is insufficient information to be contained, but it might take me a while. I still have the original world, but the villager may have died at some point. Note: any pre-existing villager affected by this bug may not be fixed when this issue is patched, but it will prevent it from occurring again.
Comments 2
Thank you for your report!
We're tracking this issue in MC-71354, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as working as intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
We only accept reports on the latest release and the most recent snapshot