Open realGWM opened 6 years ago
Without referring to Bukkit, what reasons would you expect? I suspect mod compatibility will be difficult here without appropriate PR's to forge.
Things that I can remember right now: Coming close enough to a mob (the most common one) Attacking pig zombies (as the reason for attacks from other pig zombies) Looking at enderman. Night as the reason for spiders to start attacking. And so on
My only suggestion would possibly to expose the AITasks that are re-targeting players/entities such that when an AITask is being run and it's told to target something, we can expose that as part of the context. It would provide you with an AITaskType, but I can't expose verbatim the enum that Bukkit provides since mods don't use that same type of API or understanding.
Bukkit has TargetReason which allows to check, why agent (entity) selected target (other entity). Sponge's SetAITargetEvent doesn't have such analog. It makes impossible to discover why entity selected other entity as target. Bukkit link: https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java#L79 Also, there is no EventContextKey for it. (Continuation of: https://github.com/SpongePowered/SpongeCommon/issues/1806 )