Commit 3225740a authored by Bailey's avatar Bailey 🚟

Pigmen are now affraid of Zombie Pigmen

parent 04e6b561
......@@ -18,6 +18,7 @@ import net.minecraft.entity.MobEntity;
import net.minecraft.entity.Pose;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.goal.AvoidEntityGoal;
import net.minecraft.entity.ai.goal.HurtByTargetGoal;
import net.minecraft.entity.ai.goal.LookAtGoal;
import net.minecraft.entity.ai.goal.LookRandomlyGoal;
......@@ -31,6 +32,7 @@ import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
import net.minecraft.entity.monster.CreeperEntity;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.ZombiePigmanEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
......@@ -70,9 +72,10 @@ public class MeleePigmanEntity extends MonsterEntity
this.targetSelector.addGoal(3, (new HurtByTargetGoal(this).setCallsForHelp()));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, MobEntity.class, 5, false, false, (mob) ->
{
return mob instanceof IMob && !(mob instanceof CreeperEntity);
return mob instanceof IMob && !(mob instanceof CreeperEntity) && !(mob instanceof ZombiePigmanEntity);
}));
this.goalSelector.addGoal(1, new AvoidEntityGoal<ZombiePigmanEntity>(this, ZombiePigmanEntity.class, 8.0F, 0.6D, 0.8D));
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, false));
}
......
......@@ -27,10 +27,12 @@ import net.minecraft.entity.ai.brain.schedule.Activity;
import net.minecraft.entity.ai.brain.schedule.Schedule;
import net.minecraft.entity.ai.brain.sensor.Sensor;
import net.minecraft.entity.ai.brain.sensor.SensorType;
import net.minecraft.entity.ai.goal.AvoidEntityGoal;
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.merchant.villager.AbstractVillagerEntity;
import net.minecraft.entity.merchant.villager.VillagerData;
import net.minecraft.entity.merchant.villager.VillagerTrades;
import net.minecraft.entity.monster.ZombiePigmanEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
......@@ -93,6 +95,8 @@ public class PigmanEntity extends AbstractVillagerEntity
protected void registerGoals()
{
super.registerGoals();
this.goalSelector.addGoal(1, new AvoidEntityGoal<ZombiePigmanEntity>(this, ZombiePigmanEntity.class, 8.0F, 0.6D, 0.8D));
}
@Override
......
......@@ -19,6 +19,7 @@ import net.minecraft.entity.MobEntity;
import net.minecraft.entity.Pose;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.goal.AvoidEntityGoal;
import net.minecraft.entity.ai.goal.HurtByTargetGoal;
import net.minecraft.entity.ai.goal.LookAtGoal;
import net.minecraft.entity.ai.goal.LookRandomlyGoal;
......@@ -32,6 +33,7 @@ import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
import net.minecraft.entity.monster.CreeperEntity;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.ZombiePigmanEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.ProjectileHelper;
......@@ -76,9 +78,10 @@ public class RangedPigmanEntity extends MonsterEntity implements IRangedAttackMo
this.targetSelector.addGoal(3, (new HurtByTargetGoal(this).setCallsForHelp()));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, MobEntity.class, 5, false, false, (mob) ->
{
return mob instanceof IMob && !(mob instanceof CreeperEntity);
return mob instanceof IMob && !(mob instanceof CreeperEntity) && !(mob instanceof ZombiePigmanEntity);
}));
this.goalSelector.addGoal(1, new AvoidEntityGoal<ZombiePigmanEntity>(this, ZombiePigmanEntity.class, 8.0F, 0.6D, 0.8D));
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, false));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment