Setting the target of a zombie

Discussion in 'Plugin Development' started by handyhacker, Oct 18, 2013.

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

    handyhacker

    Hi,

    i'm currently writing a plugin with controls the zombies, and now i want that a zombie walks to a certain location.

    I already tried:
    Code:java
    1. public void setZombieTargetTo(Entity entity, Location moveTo, float speed)
    2. {
    3. EntityLiving nmsEntity = ((EntityInsentient)((CraftLivingEntity) entity).getHandle());
    4. PathEntity path = ((EntityInsentient) nmsEntity).getNavigation().a(moveTo.getX(), moveTo.getY(), moveTo.getZ());
    5. ((EntityInsentient) nmsEntity).getNavigation().a(path, speed);
    6. }
    7. // Other method
    8. Location ZombieSpawn1 = new Location(getServer().getWorld(WORLD), ZOMBIESPAWN1X, ZOMBIESPAWN1Y, ZOMBIESPAWN1Z);
    9. Location ZombieWalk1 = new Location(getServer().getWorld(WORLD), ZOMBIEWALK1X, ZOMBIESPAWN1Y, ZOMBIEWALK1Z);
    10. Zombie z1 = (Zombie) getServer().getWorld(WORLD).spawnEntity(ZombieSpawn1, EntityType.ZOMBIE);
    11. z1.setMaxHealth(getRound() * 0.5);
    12. z1.setHealth(getRound() * 0.5);
    13. setZombieTargetTo(z1, ZombieWalk1, 1);
    14.  
    15.  

    But it doesen't seem to do anything? :confused:
     
Thread Status:
Not open for further replies.

Share This Page