Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-268592

A game event is not emitted when a non-player activates a totem of undying

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.4, 24w07a, 1.21, 24w37a
    • None
    • Confirmed
    • Game Events
    • Low
    • Gameplay

      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.

            Unassigned Unassigned
            haykam haykam
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              CHK: