Open MegaTophat opened 2 months ago
from what I recall there was a similar issue for this in the past which was a "won't fix", as the only real solution was a state shotgun
Yeah, I agree this should be a won’t fix. Use goal api if you wanna control this.
Expected behavior
When running the following code on a Player p:
I expect the anger/pendingTarget Goals of that Mob entity to be changed internally to also remove the target and their aggression from their memories. Below is an example of what I would expect the "anger" Goal of an Enderman to look like after this method is invoked: Notice that the "pendingTarget" field is null.
This stops the Mob from immediately becoming aggressive again for any anger based mob(Enderman, Pigman, Wolf, etc)
Observed/Actual behavior
The Enderman I was testing on all had their Enderman#getTarget() set to null, but did not have their targetSelector.pendingTarget set to null, meaning the next tick they would immediately re-aggro onto the same player.
Steps/models to reproduce
Go to the end/nether. Run this code on any given Player
Then give it a couple of ticks for the anger to fully settle in. Then run this method on the same Player
The mobs will stop attacking for one tick then most will immediately resume attacking on the next tick
Plugin and Datapack List
SandboxPlugin is the plugin I'm working on where this code is present
Paper version
Other
There appears to be infrastructure that could fix this somewhat simply, but would require work for every individual Mob. This is currently what the NMS setAggressive() method does
Maybe each extension of the Mob abstract class could override this method and invoke super.setAggressive(), then null out any pending aggression/universal anger goals?