Solved Make passive mobs follow player

Discussion in 'Plugin Development' started by iBecameALoaf, Aug 7, 2014.

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

    iBecameALoaf

    Alright, so I'm working on making a pet plugin for my server, and I'm having a bit of trouble making this work.

    So far, I have this code firing on a command ('/pet')

    Code:
            final Pig pig = (Pig) player.getWorld().spawnEntity(
                            player.getLocation(), EntityType.PIG);
     
                    new BukkitRunnable() {
     
                        public void run() {
                            ((EntityInsentient) ((CraftEntity) pig).getHandle())
                                    .getNavigation().a(player.getLocation().getX(),
                                            player.getLocation().getY(),
                                            player.getLocation().getZ(), 0.25F);
                        }
                    }.runTaskTimer(plugin, 0, 2);
    The pig that I'm spawning just looks at the player, but doesn't actually walk. Any suggestions?

    Thanks.

    EDIT: Actually, the problem was that the speed was too low...
     
Thread Status:
Not open for further replies.

Share This Page