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 away from the player/loses focus on them.
Steps to Reproduce
Place a command block and a lever next to it, and in the command block, paste in the command:
/summon minecraft:villager ~ ~1 ~ {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:1.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.
Punch the villager while holding the emerald in your main hand.
Observed Results
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 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.
Expected Results
The villager does not consume/use a totem if offering/holding one or immediately shows the totem in its hand again.
Additional Notes
Related to MC-255829.
Linked issues
relates to 1
Attachments
Comments 6
It may be because the villager is holding the item while offering it to you, thus killing it would result in it being used.
Can confirm. The totem can alo show back up if the villager walks far enough away from the player/loses focus on them.