Interactive-Modding / Jurassic-Reborn

GNU Lesser General Public License v2.1
13 stars 24 forks source link

Fix Null Pointer Exception crash for Dinosaur Wandering #76

Open Sniffity opened 6 months ago

Sniffity commented 6 months ago

The following Pull Request attempts to fix the crash related to Dinosaur Wander AI (incorrectly but commonly referred to by the non-specific name "Ticking Entity Crash" in JWR's Discord discussions).

The fix implements a loading check on the startExecuting() method in DinosaurWanderEntityAI. As much as the original X, Y, Z vector and corresponding block position are null checked above, the position being passed into the Navigator's tryMoveToXYZ method has been slightly offset by a random function. This new position has not been checked for loading. This PR implements a check for that.

Additionally, previous unsuccesful fix attempts are reverted in this Pull Request, so as to keep the code base clean.

Of note: If this PR does not fix the aforementioned issue, it will be important for users experiencing the crash to provide the new crash report, as the NPE may have changed. It is important to mention that this is a minor fix to a specific NPE issue: Creautre pathfiding may still cause other, perhaps unrelated, issues.

The updated code base has been tested and does correctly runClient in a dev environment.

Sniffity commented 6 months ago

Slight fix to WalkNodeProcessor adding another null check to prevent crash.