Hallo, meine Frage wäre wie ich es schaffe, dass wenn der Spieler mehr als 10 Blöcke vom Entity/Tier entfernt ist, das sich das Tier zum Spieler teleportiert.

final Chicken c = (Chicken)p.getWorld().spawnCreature(loc, CreatureType.CHICKEN);   

    plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable(){
        @Override
        public void run() {
if(c.getLocation().distanceSquared(p.getLocation()) < 20)  {
followPlayer(c, p, 1.3);
}else{
c.teleport(p.getLocation());
}
       

public void followPlayer(Creature creature, Player p, double speed) {
    Location location = p.getLocation();
    ((CraftCreature) creature).getHandle().getNavigation().a(location.getX(), location.getY(), location.getZ(), speed);
}

Das funktionier so lala. Das Chicken portet sich zwar aber schon nach 5 blöcken und nicht 20;