I'm wondering whether anyone knows how to detect when a mob targets a player?
What I mean by this is am I able to detect when a mob (like a zombie for example) sees the player and decides to chase them.
I'm assuming that this is tracked by minecraft through a NBT tag, there must be some way that minecraft knows which mob is chasing which player, right? But sadly I could find nothing. Everything was either non-vanilla (using bukkit or mods) or really really old (like a post from 2013, when of course map makers ability was way more limited).
If alternatively there is no way to detect this directly, is there any way to indirectly detect it.
I know that the player is needed to be within a certain range and be in line-of-sight of a mob to be targeted by it. Could it be possible to use this knowledge to tell when a mob begins targeting a player?
Or is none of this possible? I have seen lots of amazing stuff on these forums, so I hope one of you can help.
So to sum this all up, I want:
A design of a command block contraption / command that can detect when a mob targets a player. Preferably using a target-selector (eg: @e[ ..... ])