Mob Pathfinding

Discussion in 'Plugin Development' started by FunnyItsElmo, May 20, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    FunnyItsElmo

    Hey!
    I have a little problem and i hope someone can help me.
    I want a zombie run to a location but when i use the navigator like here:
    Code:
    public void moveTo(LivingEntity entity, Location moveTo, float speed)
        {
            EntityLiving nmsEntity = ((CraftLivingEntity) entity).getHandle();
            PathEntity path = nmsEntity.getNavigation().a(moveTo.getX(), moveTo.getY(), moveTo.getZ());
            nmsEntity.getNavigation().a(path, speed);
        }
    the path object is always empty so the zombie does not move.
    So what can i do?

    If i define the path manually like here:
    Code:
    public void moveTo(Zombie z, Location moveTo, float speed) {
                EntityLiving nmsEntity = ((CraftLivingEntity) z.getBukkitEntity()).getHandle();
                PathPoint[] pp = { new PathPoint((int)moveTo.getX(), (int)moveTo.getY(), (int)moveTo.getZ())};
                PathEntity path = new PathEntity(pp);
                System.out.println(path.d());
                nmsEntity.getNavigation().a(path, speed);
            }
    the zombie does move but he runs against obstructions.

    Can someone help me?

    Thanks!
     
Thread Status:
Not open for further replies.

Share This Page