1.14.4 Make Passive mobs attack

Discussion in 'Spigot Plugin Development' started by palamud, Jan 18, 2020.

  1. Hello everyone i am trying to make my custom sheep to attack any creature or monster nearby. i added couple of pathfinders. in game sheep approaches its target but after it attacks, server crashes due to 'IllegalStateException'. Any help would be great. Thanks in advance

    this is my sheep class mentioned

    Code (Text):
    public class CustomSheep extends EntitySheep{

        public CustomSheep(EntityTypes<? extends Entity> entitytypes, World world) {
            super(EntityTypes.SHEEP, world);
            Sheep customSheep = (Sheep) this.getBukkitEntity();
            this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 1.0D, true));
            this.targetSelector.a(0, new PathfinderGoalNearestAttackableTarget(this, EntityCreature.class, true));
            this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityMonster.class, true));

  2. You might want to consider adding the Stack-trace so that we can see where the error exactly happened.
    • Agree Agree x 1