Solved Entity navigation doesn't work

Discussion in 'Plugin Development' started by Zake., Mar 19, 2014.

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

    Zake.

    Hello everyone. I finally figured out how to make my entity walk to a location. Well what it does not do is that it doesn't walk to that location! (facepalm). It just stands there and has a normal zombie behavior. Some help please?

    That's how do i spawn it.

    Code:
    Location loc = player.getLocation();
    LivingEntity z = (LivingEntity) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);
    ((EntityInsentient) ((CraftLivingEntity) z).getHandle()).getNavigation().a((int) loc.getX() + 10, (int) loc.getY(), (int) loc.getZ() + 10, 1.25F);
    
    The result of that (^) is nothing. It has the same behavior as the other zombies. Some hints? Some help? Everything's welcome, thanks!
     
  2. Offline

    xTrollxDudex

    Zake.
    It probably targeted something else
     
  3. Offline

    Zake.

    Then how can i make it to don't target anything else? Like mobs or stuff.
     
  4. Offline

    xTrollxDudex

    Zake.
    Cancel TargetEvent?
     
    Zake. likes this.
  5. Offline

    Zake.

    Hmm... Well i moved to fast and i marked that as 'solved'. It isn't solved, the issue continues.

    Any ideeas?
    -bump-

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  6. Offline

    Noxyro

    Could you post the code of your entity movement so that we can see what you already coded and start on that?
     
  7. Offline

    Zake.

    Noxyro There you go. (( sorry for late answer ))

    Invoking class: (( comand ))
    Code:
    if(args.length == 1){
                            Location loc = player.getLocation();
                            LivingEntity z = (LivingEntity) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);
                            walkTo(z, (int) loc.getX() + 10, (int) loc.getY(), (int) loc.getZ() + 10, 55.25F);
                           
                        }
     
    public void walkTo(LivingEntity le, int x, int y, int z, float speed){
            ((EntityInsentient) ((CraftLivingEntity) le).getHandle()).getNavigation().a(x, y, z, speed);
        }
    Aaaaand that's my entity target event.

    Code:
    @EventHandler(priority = EventPriority.HIGHEST)
        public void onTarget(EntityTargetEvent e){
            System.out.println("canceling!"); // DEBUGGER
            e.setCancelled(true);
        }
     
  8. Offline

    Zake.

  9. Offline

    Hadenir

    I've got the same problem too. :(
     
  10. Offline

    Zake.

    solved.
     
  11. Offline

    toropov023

    Could you please tell us how you'v solved this issue?
     
Thread Status:
Not open for further replies.

Share This Page