Getting an EntityCreature from a bukkit entity?

Discussion in 'Plugin Development' started by Jnorr44, Sep 26, 2012.

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

    Jnorr44

    Hey, I am trying to use the PathfinderGoalMoveTowardsTarget, but I need an EntityCreature, and I need some way to cast it from a Bukkit Entity. Any ideas on how to do this, and if not, and better ways on how to actually set a target. (And no, setTarget() doesn't work)
     
  2. Offline

    CorrieKay

    you should be able to just cast it straight up from the bukkit entity.
     
  3. Offline

    Comphenix

    If you cast it to a CraftEntity, you'll be able to call the CraftEntity.getHandle() method. Then you can cast the result to an net.minecraft.server.EntityCreature (if needed).
     
  4. Offline

    Jnorr44

    Aha okay, that makes sender Comphenix

    CorrieKay I tried that, it thre a ClassCastException
     
  5. Offline

    skore87

    This is what I use on one of my plugins:

    Code:
    Entity entity = e.getEntity();
    net.minecraft.server.Entity mcEntity = ((CraftEntity) entity).getHandle();
     
  6. Offline

    kyle1320

    Jnorr44
    If you get this figured out, could you send me some code? I've been trying to figure out how to add pathfinding goals to a creature, but since their goal selector isn't visible, I haven't been able to figure out how.
    Thanks
     
  7. Offline

    Jnorr44

    kyle1320 It's as skore87 said. I just remembered how to send packets to players, and it's the same thing.
     
  8. Offline

    kyle1320

    Well I knew how to get an EntityCreature and what not, but actually setting their pathfinding goals eludes me.
     
  9. Offline

    Jnorr44

    you create a new pathfindergoal, with the entitycreature as an argument in the new instance
     
Thread Status:
Not open for further replies.

Share This Page