CitizensDev / Citizens2

Citizens - the premier plugin and API for creating server-side NPCs in Minecraft.
https://citizensnpcs.co
Open Software License 3.0
589 stars 313 forks source link

Entity targeting no longer works in latest few builds #2393

Closed mcmonkey4eva closed 3 years ago

mcmonkey4eva commented 3 years ago

Versions and background:

Issue is present in Citizens version: Citizens version 2.0.27-SNAPSHOT (build 2186) and Citizens version 2.0.27-SNAPSHOT (build 2188), but not in Citizens version 2.0.27-SNAPSHOT (build 2185).

Testing with Spigot version: This server is running CraftBukkit version git-Spigot-a19903d-e1ebdd9 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT), but has also been reported by Sentinel users with with This server is running Tuinity version git-Tuinity-"8056d13" (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)

Based on a Sentinel issue report @ https://github.com/mcmonkeyprojects/Sentinel/issues/355 and one on Discord, but tested myself to verify and gather details.


Problem: Any path with a distance more than a few blocks fails to complete. Only very short (5 block or less) paths still function.

This has been noticed originally with Sentinel NPCs that will not move towards a target to attack it until that target is very very close to the NPC, but can has been replicated with Citizens alone using the /npc pathto command.

When testing pathto, I notice the NPC twitches forward slightly before stopping and giving up. With Sentinel, no twitch was observed.


Cause tracing:

This commit: https://github.com/CitizensDev/Citizens2/commit/810441c17b127ea3cbfd69fe900c7d691f9b6433 breaks pathfinding. I believe the cause is that the new setPath method never sets the path to the fallback field.

mcmonkey4eva commented 3 years ago

Fixed in https://github.com/CitizensDev/Citizens2/commit/b4943a0e8469c2ece3af1ab8a43bde6e64346067