mojira.dev
MC-273119

When a villager is struck by lightning, it is logged

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.

Linked issues

Comments 2

[Mod] ManosSef

This is intentional. It is also a measure taken to help find the cause of MC-153904, since villagers being struck by lightning and turning into witches is also something that makes villagers disappear, just like death.

[MOD] Greymagic27

Thank you for your report!
We're tracking this issue in MC-165985, so this ticket is being resolved and linked as a duplicate.

That ticket has already been resolved as working as intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.

If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.

Quick Links:
πŸ““ Bug Tracker Guidelines – πŸ’¬ Community Support – πŸ“§ Mojang Support (Technical Issues) – πŸ“§ Microsoft Support (Account Issues)
πŸ““ Project Summary – ✍️ Feedback and Suggestions – πŸ“– Game Wiki

Viradex

(Unassigned)

Unconfirmed

(Unassigned)

1.20.6, 1.21 Pre-Release 4

Retrieved