Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Why EntityMoveEvent deprecated?

Comments in 'Plugin Development' started by Sergey_D, Oct 24, 2014.

  1. Sergey_D
    Offline

    Sergey_D Active Member

    Joined:
    Jan 19, 2014
    Posts:
    75
    Minecraft User:
    CLILLZ
    When my server started and load my plugin with EntityMoveEvent,in console I have message "Plugin <my_plugin> register listener for ED(name of function with EntytyMoveEvent) but this event deprecated"
    Why EntityMove deprecated
  2. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
    PEMapModder and Jon like this.
  3. Sergey_D
    Offline

    Sergey_D Active Member

    Joined:
    Jan 19, 2014
    Posts:
    75
    Minecraft User:
    CLILLZ
    I ask why it is outdated, and not on what event to replace him
  4. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    Why u ask this question?
    If u look... shogship had code simple auth and he is the main coder of pocketmine... that the player can move for login is not really a problem... so wait... he will do it if he have time for it...

    Ps if u dint want wait
    its open source and u can edit it by yourselft like lambo said
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I think it's likely because developers are using EntityMoveEvent as an event to check if exclusively player has moved. Why is this a problem? Because EntityMoveEvent supposedly applies to all entity motion and not just player entities. If other entities went to call the event, plugins with listeners that didn't actually check they were getting a Player would cause a fatal error. Basically, it is to allow the implementation of a true EntityMoveEvent when mobs are added.
    iksaku, Dutok and Minetox like this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    This is not the main reason. As @shoghicp loves to say, it is plugin developers' "own fault" to do that incorrectly. For example, he wouldn't add code to warn when registering EntityDamageByEntityEvent listeners.

    The real reason is the code efficiency. Entity move is rarely checked by plugins. Instead, most plugins only use that for players. Therefore, since firing entity move events will drop TPS greatly as it is run a few thousand times per tick (if there is mob AI even more), he deprecated entity move events and only lets plugin handle player move events, which is fired much less. You know, behind PluginManager->fireEvent(), there is so much code. If it is called so many times, every microsecond counts. To maximize efficiency, we have to make it be called for less times. And to make it be called less, the best method is to avoid calling it.
    Falk and Minetox like this.

Share This Page

Advertisement