How to prevent an entity from moving.

Discussion in 'Plugin Development' started by rj3824, Feb 22, 2017.

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

    rj3824

    So I want to spawn a villager and make it so that it does not move at all, I don't want to use slowness potions or anything like that, I want it to be coded so that there is no movement at all.

    Does anyone know how?
     
  2. Offline

    Zombie_Striker

    @rj3824
    Villager#setAI(false);
     
  3. Offline

    rj3824

    I tried it, it didnt work
     
  4. @rj3824
    Why don't you just make it ride an invisible armorstand? That's what I do for vanilla adventure maps
     
  5. Offline

    rj3824

    That could work, however i don't want to have to set that up every time I want to place a villager, I want to be able to use an Entity Spawn Event cast the entity to a villager and then prevent the villager from moving once it has spawned.
     
  6. Offline

    Zombie_Striker

    @BananaPuncher714
    Why not? Because that is just a hack and is not efficient.

    @rj3824
    What do you mean by "Didn't work"? If it has no Ai, can't move. It's velocity does not get updated. How could that not work?

    Does it still move around? Have you tried debugging to make sure its ai is set to false?
     
  7. Offline

    rj3824

    The villager just moved anyway, and no I haven't tried debugging it, I'll try that
     
Thread Status:
Not open for further replies.

Share This Page