Make My Spawned Mob Frozen - Help

Discussion in 'Plugin Development' started by 123ang, Jul 24, 2014.

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

    123ang

    I have my code where on the server reload it spawns a villager at a custom location on the map. I want to know if there is a way of making that mob 'frozen'. I've tried walk speed but it doesn't work with entities. Could someone please help me!

    Code so Far:

    Code:java
    1. public void onEnable()
    2. {
    3.  
    4. Location myeloc = new Location(Bukkit.getServer().getWorld("test"), 34, 5, -1616);
    5.  
    6. Bukkit.getServer().getWorld("test").spawnEntity(myeloc, EntityType.VILLAGER);
    7.  
    8.  
    9. }


    By the way my code works fine so far :)!

    Thanks in advance!
     
  2. Offline

    jimbo8

    Give it either a speed-effect that is a waaay to high or a negative number. That should freeze it :)
     
  3. Offline

    123ang

    How would I do it if my method for spawning the villager is not a variable?
     
  4. Offline

    123ang

    teozfrank Looking for something that is answered. Any other suggestions?
     
  5. Offline

    Gamesareme

    Are you asking how to put the villager into something so you can call it?
     
  6. Offline

    123ang

    Gamesareme yes so I can do something like v.addPotionEffect(PotionEffectType.SLOWNESS, int1, in2);
     
  7. Offline

    fireblast709

    123ang create a field for the villager
     
  8. Offline

    Gamesareme

    If you do not understand that he is meaning something like this.
    Code:
    Villager v = (Villager) player.getWorld().spawn(loc, Villager.class);
     
  9. Offline

    fireblast709

    Gamesareme since he wants to reference it outside the method scope, in the class would be perfect
     
  10. Offline

    123ang

    fireblast709 that works fine but is there any alternative to adding slowness to make the villager frozen?
     
  11. Offline

    Code0

    When he moves, cancel it? :p
     
  12. Offline

    123ang

    Code0 Whats the method? or if statement name?
     
  13. Offline

    fireblast709

    Code0 since when is there an event that is fired for Entity movement ;).
     
  14. Offline

    123ang

  15. Offline

    xTigerRebornx

  16. Offline

    123ang

    xTigerRebornx then how would I cancel the entity move event?
     
  17. Offline

    xTigerRebornx

    123ang There is no EntityMoveEvent. You need to take other approaches to this. Teleport the entity to itself repeatedly (probably the most laggiest), Override the mob using NMS (not noob friendly), Slowness (it works), and others that I have probably missed.
     
  18. Offline

    123ang

    xTigerRebornx Okay thanks! I know that the slowness works (I've tried), I only asked because it was EXTREMELY laggy so I tried to find another option. But, I guess not.

    Thanks for your help.
     
Thread Status:
Not open for further replies.

Share This Page