All hostile mobs that want to attack the player only can see the target in a short distance.
Some mobs can see further than 16 block radius like ghasts but it isn't the max attack distance.
Steps to reproduce:
Summon a mob(e.g. husk, ghast)
/gamemode survival
Run 16 blocks away and the mob cannot follow you.
Observed Results:
Mobs stop following the target if they outer 16 blocks. It causes ghasts to not expect the player, vexes cannot chase the target and you can see this bug in many other mobs.
Expected Results:
Mobs should follow the target a little bit farther than 16 blocks.
Code Analysis:
This comment.
Videos:
https://drive.google.com/open?id=1pnx2w6YvCHnyPH4nS-Ihgulpt1GsLeQC]
https://drive.google.com/open?id=1P6WJ1mgt9jwMtOSI2-n3eB2ofy5HiHyN
Linked issues
is duplicated by
relates to
Attachments
Comments


But it is actually broken. I tried it with ghasts and they only can see 16 blocks in the beta. I also create some addons and my mobs should attack in 32 block radius but in the beta is 16.

Please do not mark unreleased versions as affected.
You don't have access to them yet.

its likely intended to be 28, 82 wouldn't work on a default sim distance of 4 chunks. That being said, it could easily be upped to 50~ blocks range, which would work well for bedrock.

I've been studying the .json files and documentation, as well as NBT data, and I think the problem with targeting ranges may be due to contradictions between minecraft:follow_range, attack_radius (within minecraft:behavior.ranged_attack), max_dist (within minecraft:behavior.nearest_attackable_target), and a lack of any specification for persist_time (also within minecraft:behavior.nearest_attackable_target).
Ghasts
follow_range = 64
attack_radius = 64
max_dist = 28
Comment: these values make it look like Ghasts are supposed to be able to follow and attack players from 64 blocks away, but that range is defeated by their inability to target beyond 28. Since the default persist_time is 0, even if they acquire targets within 28 blocks, they immediately drop those targets if they are > 28 blocks away.
In Java Edition ghasts target players at 64 blocks away, but only when they are also within 4 blocks vertical. That can be done in Bedrock Edition by using the following lines in "minecraft:behavior.nearest_attackable_target"
:"max_dist": 64
(within the player filter)"target_search_height": 4
See here for the Java code analysis.
Ravagers
follow_range = 64
max_dist = 16
These values make it look like Ravagers are supposed to follow targets up to 64 blocks away, but they can only select targets 16 blocks away. Like Ghasts, with no persist_time, they immediately drop targets beyond 16 blocks. However, Ravagers do have a max_dist of 64 under the hurt_by_target component, so they can target a player/mob that hurts their rider from that distance.
Java parity would be a max_dist = 32.
Zombies/Husks/Drowned/Zombified Piglins
<no follow_range specified>
max_dist = 35 (20 for drowned)
Zombie variants default to follow_range = 16, which defeats their targeting range. The reason some do pursue targets that are farther than 16 blocks away is that they can get a RandomSpawnBonus multiplier to the default range. Here is an example:
Husks also have a within_radius = 25 (in nearest_attackable_target). According to the updated documetation for 1.16, this is supposed to specify how far away a target can be followed if follow_range is not specified. I'm not sure how this is supposed to work; the way it reads to me is that in conjunction with the default persist_time = 0, within_radius would defeat any higher max_dist targeting range for melee attacks. In actual gameplay it seems to be defeated by the default follow_range.
Endermen
follow_range = 32
search_radius 64 (within minecraft:lookat, for aggro at players)
max_dist = 64 (for endermites)
Endermen agrro and target from 64 blocks, but this is defeated by their lower follow range. Related to MCPE-35306.
Blazes (MCPE-35647)
follow_range = 48
attack_radius = 16
max_dist = 48
Blazes should be able to target and attack from 48 blocks (see MC-51266 and MC-112013), but this is defeated by their attack radius. You can see them aggro when they target at > 16 blocks because they flame up and start to float but then quickly stop.

Confirmed for 1.16.0

Confirmed for 1.16.1

Not fixed in 1.16.100.50

affecting 1.16.100.54

affecting 1.16.100.56

@Panda4U: that version number was already added to the ticket by the OP before you commented. Please avoid spam comments.

Affects 1.17.0.52

Affects 1.17.0.52

Zombies have a "max_dist" of 35 which can be lowered and works fine. If you increase it though, it will still be targeting from 35.
This seems to happen for all entities. "max_dist" seems to be capped at its default.
For Skeletons, "max_dist" is 16. If you increase it and get in its new range (greater than 16), the Skeleton will start an animation glitch.

Armand: the animation glitch is because if you give a mob that has an animation for a ranged attack a greater targeting max_dist than the mob's follow_range, then it gets into a loop of finding and dropping the target over and over.

Affects 1.19.40
Works as intended. According to Minecraft WIKI:
"Most mobs are aware of players within 16 blocks of them, but some can see farther. Conversely, most mobs can be heard by players up to 16 blocks away "