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

When a villager is struck by lightning, it is logged

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.20.6, 1.21 Pre-Release 4
    • None
    • Unconfirmed
    • (Unassigned)

      The Bug

      When a villager is struck by lightning, the event is logged to the console, despite this being unnecessary.

      The log message is logged with log level INFO, and is something like this (it will vary):

      Villager cmk['Villager'/189, l='ServerLevel[New World]', x=13.32, y=-59.64, z=12.55] was struck by lightning btm['Lightning Bolt'/193, l='ServerLevel[New World]', x=13.11, y=-60.00, z=12.11].

      Is there a need to do this? In the case of MC-165985 (Villager deaths are logged), it was (and still is) used to catch the bug of MC-153904.

      How to Reproduce

      1. Summon a villager.
      2. Strike it with lightning using a trident enchanted with Channeling, or by summoning a lightning bolt near it.
      3. When it turns into a witch, look into the game logs.
      4. Note how the event is logged.

      Code Analysis

      First time doing an code analysis; please correct any mistakes!

      Decompiled source code of Minecraft 1.20.6 using Yarn mappings.

      In the function onStruckByLightning in VillagerEntity.class located in /net/minecraft/entity/passive on line 756:

      LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);

      Removing this line of code should fix the issue.

      Additional Notes

      Related to MC-165985.

      Also, I'm not sure if this has been reported yet or not. I'm reporting it just in case.

            Unassigned Unassigned
            Viradex Viradex
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: