1.8.8 Make custom wither able to fly?

Discussion in 'Spigot Plugin Development' started by Didi1150, Jun 14, 2021.

  1. Ive done a custom wither recently, and made a custom pathfindergoal to make him stay in the player's attack range. However, if he is mid air, the custompathfinder doesnt apply to him and he just falls very slowly, until he is back on the ground, then the pathfinder applies again. How do I make him able to even chase flying players, or , make him able to fly through walls?

    My PathfinderGoal:
    Code (Text):

    private double speed;

        private EntityInsentient entity;

        private Location loc;

        private Navigation navigation;

        private long lastTimeUse;

        private long lastTimeSpawn;

        public NecronAggroPathFinder(double speed, EntityInsentient entity, Location loc)
        {
            this.entity = entity;
            this.loc = loc;
            this.navigation = (Navigation) this.entity.getNavigation();
            this.speed = speed;  
            this.lastTimeUse = System.currentTimeMillis();
            this.lastTimeSpawn = System.currentTimeMillis();
        }

        @Override
        public boolean a()
        {
            return true;
        }

        @Override
        public void c()
        {
            PathEntity pathEntity = this.navigation.a(loc.getX(), loc.getY(), loc.getZ());

            this.navigation.a(pathEntity, speed);
        }

        @Override
        public void e()
        {
            Player player = (Player) ((List<?>) Bukkit.getOnlinePlayers()).get(0);
            if (loc.distanceSquared(player.getLocation()) >= 4)
                this.loc = player.getLocation();
            PathEntity pathEntity = this.navigation.a(loc.getX(), loc.getY(), loc.getZ());

            this.navigation.a(pathEntity, speed);
       
            }
        }
     
     
  2. try do not delete default pathfinders
     
  3. But i made the custom pathfinder so he will stay in the player attack range. If i dont delete themy the wither will just snipe the player from a distance
     
  4. Hello?
     
  5. Sooo uhh, I cheated my way around it, I removed the wither's default flying and made the custom pathfinder set the withers velocity towards a random player. Next Question: How do I make this random system which chooses which player to target if multiple players are attacking the wither? Because it is kinda unfair if the wither is only targetting one player
     
  6. You can target the last one to hit and add a cooldown to it