SpongeAPI icon indicating copy to clipboard operation
SpongeAPI copied to clipboard

Feature Request: Analog of TargetReason (from Bukkit)

Open realGWM opened this issue 7 years ago • 3 comments

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 )

realGWM avatar Feb 19 '18 07:02 realGWM

Without referring to Bukkit, what reasons would you expect? I suspect mod compatibility will be difficult here without appropriate PR's to forge.

ryantheleach avatar Dec 06 '18 16:12 ryantheleach

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

realGWM avatar Dec 06 '18 16:12 realGWM

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.

gabizou avatar Dec 10 '18 20:12 gabizou