Vexes do not actively attack iron golems when vexes are spawned by spawn egg, monster spawner, trial spawner or "/summon" command.
But will take the active to attack the players.
Code Analysis
Code Analysis done by @unknown
Currently the Vex has no NearestAttackableTargetGoal for villager. wandering trader and iron golem. Addind a goel for each fixes this bug.
Current Code
net/minecraft/world/entity/monster/Vex.java
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(4, new Vex.VexChargeAttackGoal());
this.goalSelector.addGoal(8, new Vex.VexRandomMoveGoal());
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F));
this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F));
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, Raider.class)).setAlertOthers());
this.targetSelector.addGoal(2, new Vex.VexCopyOwnerTargetGoal(this));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, true));
}
Fixed Code
net/minecraft/world/entity/monster/Vex.java
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(4, new Vex.VexChargeAttackGoal());
this.goalSelector.addGoal(8, new Vex.VexRandomMoveGoal());
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F));
this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F));
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, Raider.class)).setAlertOthers());
this.targetSelector.addGoal(2, new Vex.VexCopyOwnerTargetGoal(this));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, true));
//Add an attackable target goal for iron golem to fix MC-110424
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
}
Linked issues
is duplicated by 2
relates to 2
Attachments
Comments 6
The instance with the Iron Golem is probably a bug, however Vexes not attacking Villagers and Wandering Traders is absolutely intended so that raids are not impossible because Vexes can attack the Villagers through walls, because that would make it extremely difficult to hide them and keep the raid going.
Can confirm in 21w03a.