Spawn stationary mob/entity ???

Discussion in 'Plugin Development' started by Hadenir, Feb 7, 2014.

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

    Hadenir

    Hi!
    How can I spawn mob/entity and set it can't move???

    Thank you for all answers!
     
  2. Offline

    Maurdekye

  3. Offline

    Alshain01


    Hadenir Pretty much this is all you have. They won't be completely immobile, but it will take them a long time to get anywhere. There is no way to see/cancel mob movement (if you thought the PlayerMoveEvent fired a lot of times.... this would be a server owners nightmare)
     
  4. Offline

    Maurdekye

    Alshain01 No, at a high enough slowness level mobs just stop moving. Same thing with the player.
     
  5. Offline

    Hadenir

    Maurdekye But particles will appear? I won't it.
     
  6. Offline

    Maurdekye

    Hadenir Unless you want to edit the nms (which even I am having trouble with), there's not much else you can do.
     
  7. Offline

    Hadenir

    What's NMS ?
     
  8. Offline

    LordVakar

    Hadenir
    Net Minecraft Server

    It's internal server code.
    You can use it by importing craftbukkit into your build path.
     
  9. Offline

    Hadenir

  10. Offline

    RawCode

    remove pathfind goals from entity (NMS)
     
  11. Offline

    Hadenir

    @RawCode :O What? I'm not understand very well.
     
  12. Offline

    sockmonkey1

    Here, Here, and ... here. Happy reading.
    EDIT: Where you set the pathfinders just set them to nothing.
     
  13. Offline

    Maurdekye

    Hadenir Not the third one; the third one's outdated. The first one is a replacement for the third one. You may also want to look at this as well.
     
  14. Offline

    Hadenir

    Thank you a lot!
     
  15. Offline

    Zarko

    just check if the mob has moved and teleport it back to its defined pos,you made everything look so hard :p
     
  16. Offline

    Maurdekye

    Zarko Honsetly, I need help with this as well. And just teleporting the mob is very inefficient, as well as kind of ugly. I'd work through hours of obfuscated nms just to get this functionality rather than cheese something simple in.
     
  17. Offline

    Zarko

    Maurdekye well if you place a timer that checks for the location pretty rapidly it wont look bad

    for the slowness now try something like this:
    Code:java
    1. private Set<Integer> lepot = new HashSet<Integer>();
    2. private void addPotionEffect(Player p, PotionEffect pe) {
    3. lepot.add(pe.getType().getId());
    4. Packet41MobEffect pm = new Packet41MobEffect();
    5. pm.a = p.getEntityId();
    6. pm.b = (byte)pe.getType().getId();
    7. pm.c = (byte)pe.getAmplifier();
    8. pm.d = (short)pe.getDuration();
    9. ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(pm);
    10. pm = null;
    11. }

    Maurdekye

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

    tylersyme

    Even if you remove all the AI, players would still be able to push it, so you would have to find where that code is located and override it
     
  19. Offline

    Maurdekye

    In my game, players should be able to know the entity off a hill, and then have it try to get back again. Just keeping it in one place isn't quite as preferable.
     
  20. Offline

    Hadenir

    Oh no! New error! How can I fix it:
    Code:java
    1. net.minecraft.server.v1_7_R1.World nmsWorld = ((CraftWorld) loc.getWorld()).getHandle();
     
  21. Offline

    ShearsSheep

    Try this code out. But first you would need to add the Remote Entities LIB : https://forums.bukkit.org/threads/l...-1-6-4-1-7-2-compatible-partly-broken.110304/

    After importing the LIB, Try this code out.

    Code:java
    1. public void onEnable() {
    2.  
    3. getServer().getPluginManager().registerEvents(this, this);
    4.  
    5. for(Entity e : Bukkit.getWorld("[AddWorldName]").getEntites()){
    6. if(e instanceof [MobName]){
    7. e.remove();
    8. }
    9. }
    10.  
    11. ourEntities();
    12. }
    13.  
    14. public void ourEntities(){
    15.  
    16. Location loc = new Location(Bukkit.getWorld("[AddWorldName]"), Cords, Cords, Add your Cords);
    17.  
    18. EntityManager manager = RemoteEntities.createManager(this);
    19. RemoteEntity entity = manager.createEntity(RemoteEntityType.[Mobname], loc, false);
    20. entity.setStationary(true);
    21. entity.setPushable(false);


    I'm Preety sure this would work, If not, Click this link again.
    https://forums.bukkit.org/threads/l...-1-6-4-1-7-2-compatible-partly-broken.110304/
     
  22. Offline

    Hadenir

  23. Offline

    mrouie

    You can also use the Summon command and make a stationary mob by doing this command. /summon <mob> ~ ~ ~ {Attributes:[{Name:generic.movementSpeed,Base:0.0}]}

    Make sure that the mob name is capitalized correctly, they are case sensitive! and the "~ ~ ~" is referring the relative coordinates and it's signifying that you want to spawn it at your location.
     
Thread Status:
Not open for further replies.

Share This Page