The Bug
If a villager trades a totem of undying, and the player holds the item used to buy it and kills it while it offers the totem in its main hand, the totem is consumed and revives the villager. However, when continuing to hold the item needed to buy the totem, the totem does not appear in the villager's main hand again (even after switching your offer and trading with the villager), unless the world is reloaded or the villager is unloaded by going out of its simulation distance.
Jingy has also stated in their comment that the totem can additionally show up again if the villager walks far enough away from the player/loses focus on them.
It would be expected that the villager does not consume/use a totem if offering/holding one, or immediately shows the totem in its hand again.
How to Reproduce
Place a command block and a lever next to it, and in the command block, paste in the command below.
/summon minecraft:villager ~ ~ ~ {VillagerData: {profession: "minecraft:librarian", level: 2, type: "minecraft:plains"}, Offers: {Recipes: [{maxUses: 12, sell: {count: 1, id: "minecraft:totem_of_undying"}, buy: {count: 1, id: "minecraft:emerald"}, priceMultiplier: 0.05f}]}, Health:20.0f}
Once the command has been pasted in, flick the lever. A villager should spawn on the top of the command block. Verify that it has the totem of undying trade.
Run the command below to be able to trigger the totem of undying in one hit:
/effect give @s minecraft:strength 60 9 true
Now, while holding emeralds in your main hand, punch the villager. Note how the totem is consumed and disappears from the villager's hand.
If you try to switch inventory slots from and back to the totem, the villager will not show another totem in its hand. It does not show the totem again even after trading with it. The only ways (I found) to make it show again is to close and re-open the world, or unload the villager and reload it by going out of its simulation distance.
Additional Notes
Related to MC-255829 (fixed issue).
- relates to
-
MC-255829 Villager trades air if it has a totem of undying trade and uses the held totem
- Resolved