Both players and non-players (such as foxes) can activate totems of undying when they would otherwise die. Doing so for players emits the minecraft:item_interact_finish
game event, which has a vibration frequency of 3, but this behavior is not replicated for non-players. As a result, detecting a non-player activating a totem of undying in the same way as a player activating a totem of undying is impossible.
Relates to MC-261427, but only affects non-players.
Steps to reproduce
1. Place a calibrated sculk sensor that receives an input power of 3.
2. Summon a fox near the calibrated sculk sensor:
/summon minecraft:fox ~ ~ ~ {Silent: 1, NoAI: 1}
3. Give the fox a totem of undying:
/item replace entity @n[type=minecraft:fox] weapon.mainhand with minecraft:totem_of_undying
4. Damage the fox to death:
/damage @n[type=minecraft:fox] 100 minecraft:fall
5. Observe that the calibrated sculk sensor does not activate.
Expected behavior
The calibrated sculk sensor with an input power of 3 would activate when a nearby mob activates a totem of undying.
Actual behavior
The calibrated sculk sensor does not activate.
Code analysis (Yarn mappings)
The LivingEntity#tryUseTotem
method calls the Entity#emitGameEvent
method within an instanceof ServerPlayerEntity
condition, which is not needed unlike for statistics that do not apply to non-players. A possible fix is to move this method call outside of the condition.
I did everything and the calibrated sculk sensor activates.