Entity Move Event

Discussion in 'Plugin Development' started by 1928i, Aug 17, 2014.

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

    1928i

    Is there an event or something that I can use to prevent an entity from moving so they act like an NPC? I would like help with this.
     
  2. Offline

    xTigerRebornx

    1928i There are a few routes you can take with this:
    - Extremely high slowness
    - Scheduler
    - Overriding the Entity

    All 3 have their (dis)advantages, the 1st, while achieving what you want, seems more like a cheap workaround. The 2nd, can be laggy depending on how its done and is also a cheap workaround. The 3rd, requires understanding NMS, which isn't an easy thing for "new developers".
    You can find out how to do all of these on the forums, wiki, and google-ing.
     
  3. Offline

    1928i

    xTigerRebornx What if one were to constantly check the entity's location and if it strayed it would teleport it back?
     
  4. Offline

    Gabum

    use slowness. It's the best solution. If you combine it with PlayerInteractEntityEvent and EntityDamageByEntityEvent, it's really like they are just standing around and looking around. The problem is just that they are always looking to you if it is an aggressive NPC.
     
  5. Offline

    1928i

    xTigerRebornx I can't find anything about this "NMS" except something discontinued called "RemoteEntities." Is there anywhere I can go for help on this? I can't find anything.
     
  6. Offline

    1928i

    Bump!
     
  7. Offline

    Lactem

    I heard that extreme jump boost + extreme speed = no movement, but I can't confirm that.
     
  8. Offline

    _LB

    I'm pretty sure you can combine positive slowness with negative speed.
     
  9. Offline

    Lactem

    Hmm. I'm testing it on singleplayer and it's not working.

    Slowness 255 stops you from moving unless you jump, though.

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

    _LB

    Lactem The range of valid values is from -127 to +128, as Minecraft's save format uses a single signed byte.
     
  11. Offline

    Lactem

    _LB Yeah no. I'm talking about the amplifier, which can go up to 255. /effect <effect> <seconds> <amplifier> --> /effect 8 60 255
     
  12. Offline

    _LB

    Lactem I was also talking about the amplifier.
     
  13. Offline

    Lactem

    Well then I'm sorry to tell you that you're flat-out wrong. Go in-game and try using an amplifier of 255. It works just fine. Then try 256. It will actually tell you that the maximum value is 255. There's nothing about positive 128. Just try that command I told you: /effect 8 60 255 in vanilla.
     
  14. Offline

    _LB

    Lactem Try logging out and back in again and you will see a very different story.
     
  15. Offline

    Lactem

    _LB It just continues the potion effect like normal...
     
  16. Offline

    _LB

    Lactem Did you happen to notice the level of the poiton?

    Lactem OK, so I tested with 1.7.10 and you are right - I tested with older versions and I am right, so it's a version difference.

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

    Lactem

    _LB Ah okay makes sense why we would have two different facts. :p
     
  18. Offline

    MOMOTHEREAL

    _LB Pretty sure it was changed to 255 when they actually made the max build limit to 256 (version 1.2.1 snapshot 12w07a).
     
  19. Offline

    DevilMental

    1928i What about making a new Custom Entity which adapts to all kinds of entity, that contains method "addToEventListener()" that calls the EntityMoveEvent? I'll see if I can make some code for you ;)
     
  20. DevilMental Erm. No offence, an EntityMoveEvent is a terrible idea. If you're going to use custom entites to keep track of entities that move, it's best to do so directly rather than through the use of events.
     
  21. Offline

    DevilMental

    AdamQpzm I know but what if the EntityMoveEvent is only called when you register an entity ?
     
  22. DevilMental Then you're still tracking it with custom entities. As I said, it's easier to just handle it with the entity itself, rather than fire an unnecessary event, since most plugins that use custom entities do so for their own purpose, rather than a to be shared with another plugin.
     
  23. Offline

    SmooshCakez

    You can use high speed and jump boost, but you can still walk into the entity and push it around.
     
  24. Offline

    _LB

    Is this rumored "high speed and jump boost" thing a bug in CraftBukkit? It certainly doesn't freeze the entity in place in Vanilla.
     
Thread Status:
Not open for further replies.

Share This Page