mojira.dev
MC-271598

Killing a villager while it offers a Totem of Undying uses the totem and removes it from its hand

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

  1. 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}
  2. 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.

  3. 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

Attachments

Comments 6

Can confirm. The totem can alo show back up if the villager walks far enough away from the player/loses focus on them.

It may be because the villager is holding the item while offering it to you, thus killing it would result in it being used.

It also affects the version 1.21.6 Release Candidate 1

[media]

Can confirm it in version 1.21.6

But no, I'm sorry, I just made a slightly different mistake.

Viradex

(Unassigned)

Confirmed

Platform

Low

Trading

trade

1.20.6, 24w18a, 24w19b, 24w20a, 24w21b, ..., 25w05a, 25w06a, 1.21.5, 1.21.6 Release Candidate 1, 1.21.7

Retrieved