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

No entity pushing

Comments in 'Plugin Development' started by MyNameIsTriXz, Aug 23, 2016.

  1. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Is there any event where I can cancel the pushing of entities?
  2. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    What pushing are you talking about? By pistons? Or by hitting them?
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    I assume by colliding.
    MyNameIsTriXz likes this.
  4. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    PocketMine doesn't implement entity pushing by collision. It's only client-side.
    PocketKiller likes this.
  5. dktapps
    Offline

    dktapps Active Member

    Joined:
    Jul 25, 2016
    Posts:
    101
    You can prevent this by setting the DATA_NO_AI flag on entities you don't want to be pushable (is that the right word?)

    Code:
    $entity->setDataProperty(Entity::DATA_NO_AI, Entity::DATA_TYPE_BYTE, true);
    
    Then to allow movement again, just set the flag to false.

    (Fun fact: if you set that flag on a player it will disable the controls and stop the player moving. :p)
  6. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Thx
    dktapps likes this.
  7. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Finally I know what NO_AI means :D
    ImagicalGamer and Muqsit like this.
  8. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    Client-side evaluated movement.
  9. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Sounds like a better way to freeze a player :)
  10. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    This method is mod-vulnerable. You probably need to use this as a client-side method, in addition to handling PlayerMoveEvent. You just can't trust everything the client says, or have fun with mods. And we trust everything the client says about movement, so we have players flying everywhere.

Share This Page

Advertisement