Is it possible to freeze entities/mobs?

Discussion in 'Plugin Development' started by Anonomoose, Mar 30, 2014.

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

    Anonomoose

    Hi all,

    I've been looking around for a while now on ways to freeze entities, to stop them from moving. I've seen it other servers, so I know it's definitely possible some how.

    I tried looking for an EntityLiving movement method, an EntityMovement event, but couldn't find much about it. So, does anyone have any knowledge about this, or have you done it before somehow?

    Thanks!
     
  2. Offline

    hofma100

    Easiest way to do what you are asking would be just to give them a slowness effect.
     
  3. Offline

    Anonomoose

    Well, that would still make them able to be pushed around by other players, which is something I'd somehow need to prevent.
     
  4. Offline

    Azubuso

    Anonomoose
    Another way would just be repeatedly teleporting them to where they're standing whenever they move
     
  5. Offline

    Minnymin3

    There are server-intensive ways that you could do this

    Get the entity you want to track and create a runnable with that entity as a variable. Have a variable for the entity's position when you freeze it and then every tick make sure the location didn't change and if it did then teleport the entity back to that position.
     
  6. Offline

    Anonomoose

    That's exactly what I would do - if there was an EntityMoveEvent.

    Yeah, I'd rather it not be *that* server intensive, since there's probably going to be multiple entities.
     
  7. Offline

    Azubuso

    Anonomoose
    Right, you said entity not player, hmm.. ;)
     
  8. Offline

    ProGreenLt

    You can create scheduler timer for every 2 ticks or something like that, and teleport selected entities to selected place.
     
  9. Offline

    AoH_Ruthless

    Minnymin3
    Well the reason that's very server intensive is because you are calling it every tick. If you call it every 4 ticks, the performance will be 4x as good :). I find that for these kind of things, 3-5 ticks is an optimal number.
     
    Minnymin3 likes this.
  10. Offline

    RawCode

    you should open sources of cbukkit and check how objects are pushed around and what field\method controls it.

    since you never attempted to perform original research you dont know - not every entity is pushable, lit TNT and fireballs ignore collision completely and not pushing each other, players dont push eachother, ender crystals completely immovable.

    i already stated directly what entity you shoud check and get thing that make that entity special.
     
Thread Status:
Not open for further replies.

Share This Page