Solved getHandle() not working

Discussion in 'Plugin Development' started by Ghilliedrone, Aug 13, 2013.

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

    Ghilliedrone

    I am using someone else's code for mob targeting but the getHandle() part of it isn't working. Here's the code
    Code:java
    1. le.getHandle().getNavigation().a(l.getX(), l.getY(), l.getZ(), 1.25F);

    Can someone suggest a fix or better solution?
     
  2. Ghilliedrone
    How is it not working? What's the problem?
     
  3. Offline

    Ghilliedrone

    getHandle() has a red line under it and adding casts won't fix it
     
  4. Offline

    Ghilliedrone

    Assist
    I've already done that
     
  5. So you have both craftbukkit.jar and bukkit.jar in your build path? What does the red line say?
     
  6. Offline

    Ghilliedrone

    Assist
    The method getHandle() is undefined for the type LivingEntity. I also added CraftBukkit but that doesn't fix it either
     
  7. Ghilliedrone
    Try this
    Code:
    ((EntityInsentient) ((CraftLivingEntity) le).getHandle()).getNavigation().a(l.getX(), l.getY(), l.getZ(), 1.25F);
     
  8. Offline

    Ghilliedrone

    Assist
    Still nothing :(. EntityInsentient cannot be resolved to a type. Same with CraftLivingEntity
     
  9. Offline

    Axe2760

  10. Offline

    Ghilliedrone

    Axe2760 I can't, they don't exist or eclipse can't find it.
     
  11. Offline

    xTrollxDudex

    Ghilliedrone
    They're NMS imports, import net.minecraft.server.v1_6_R2.<import>
     
    Ghilliedrone likes this.
  12. Offline

    Ghilliedrone

    Heres the whole function:
    Code:java
    1. public void walkTo(LivingEntity le, float speed, Player player) {
    2. Location l = e_attack.getLocation();
    3. le = e_hurt;
    4. ((EntityInsentient) ((CraftLivingEntity) le).getHandle()).getNavigation().a(l.getX(), l.getY(), l.getZ(), 1.25F);
    5. }


    The problem is gone now but the function doesn't work. Do i need to use a scheduler to make it work?

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

    xTrollxDudex

    Ghilliedrone
    You have extra parameters, and why are you assigning a new value to the parameter?
     
  14. Offline

    Ghilliedrone

    Woops, they were left over from when i was using someone else's stuff
     
Thread Status:
Not open for further replies.

Share This Page