The bug
No matter the location of a fox, they try to path towards the origin during a thunderstorm.
Steps to reproduce
Teleport around seventy blocks away from the center of the world:
/tp @s 0 100 70
Summon some foxes and set the weather to "thunder":
/weather thunder
Observed behavior
Foxes will always pathfind to the center of the world (0,0) during thunderstorms.
Expected behavior
Foxes would not pathfind to the center of the world during thunderstorms.
Code analysis
Code analysis can be found in this comment.
Attachments
Comments 15
The 0 0 of my world is ocean more than 20 blocks from the shore and always has 5-10 foxes in a huddle when I come by.
Code analysis (1.18.1 yarn mapping): (credit to Harley Speedthrust on YouTube and Aria on Fabricord, see the original analysis on YouTube comment)
FoxEntity$AvoidDaylightGoal
extends EscapeSunlightGoa
. EscapeSunlightGoa
defines three doubles for the target X/Y/Z coordinates, and is initialized to 0 by default. This is set by EscapeSunlightGoal#targetShadedPos
. However, this method will not be called if it is thundering; AvoidDaylightGoal#canStart
L1017 early-returns true if it is thundering, skipping the method call at the end of canStart
method. Since the target position is never set, it will always be 0, 0, 0
.
Confirmed