Steps to reproduce
/summon vindicator ~~~ minecraft:promote_to_patrol_captain
/summon pillager ~~~ minecraft:promote_to_patrol_captain
/summon villager
Expected result
The illagers attack the villager
Actual result
The vindicator ignores the villager. The pillager charges its crossbow but never attacks.
Last time when a vindicator patrol captain naturally spawned, they were hostile
when spawned by commands they are neutral, this is really weird seeing them not attacking and it confuses me, and vindicator followers are always hostile
vindicator patrol captains have behavior issues
Expected Result: Vindicator patrol captains should be hostile
Observed Result: They are Neutral
Reproduce Steps:
1. wait for a vindicator patrol captain spawned
2. spawn a villager
3. spawn a vindicator patrol captain with a command
4. spawn a villager
see that it won't attack
Linked issues
relates to
Comments

Another special case of MCPE-48587

I'll become a new reporter? Need to add affected versions for it since he is no longer active

Affects 1.17.0.54 Beta spawning a Vindicator captain with commands creates a broken and corrupted mobs usually a parity bug
Whoops! you got the wrong reporter there, my Username was called SlimySpeck
He has no status in his profile and won't update the report
This bug is a consequence of the following:
The vindcator's targeting behavior components are only given within its
minecraft:default_targeting
andminecraft:vindicator_johnny
component groups. Likewise, the pillager's ranged attack behavior component is only given within itsminecraft:ranged_attack
component group.The vindicator's
minecraft:default_targeting
group is only added by theminecraft:stop_johnny
andminecraft:entity_spawned
events. Likewise, the pillager'sminecraft:ranged_attack
component group is only added by itsminecraft:entity_spawned
andminecraft:ranged_mode
events.Running a
/summon
command with an event argument causes the defaultminecraft:entity_spawned
event to be skipped. So in this case,/summon vindicator ~~~ minecraft:promote_to_patrol_captain
or/summon vindicator ~~~ minecraft:promote_to_illager_captain
or/summon vindicator ~~~ minecraft:spawn_as_illager_captain
spawns a vindicator captain with no targeting behavior component. Likewise, pillagers spawned with those events have no ranged attack behavior component (except for spawn_as_illager_captain, which adds ranged_attack, probably as the fix for MCPE-44987).I am not sure if the
/summon
behavior here is a bug or not, but the particular issue with captains could easily be fixed by copying the vindicator's targeting behavior from itsdefault_targeting
group, and the pillager's ranged attack behavior from itsranged_attack
group, into their respective "components" sections. That's exactly how theminecraft:buoyant
component is set up in the boat.json entity file, for example--it's in the "components" section as a default and also in a component group so that it can be added and removed when needed.However, copying these components into the main "componenets" sections ruins the patrol pillagers'
"hold_ground"
behavior. On the other hand, that behavior has its own problem, MCPE-117328.