1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Stop entity moving for few sceond

Discussion in 'Development' started by Nora1903, Jul 19, 2018.

  1. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    I'm using PureEntitiesX and I still wonder how to stop entity moving for few seconds ? I tried to use setImmobile but not working :(( please help me ....
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    setImmobile() won't do anything unless you use it on a player (P.S. if you are using it on a player, don't forget to cancel PlayerMoveEvent accordingly) or an entity with client sided AI such as an Item (item entities automatically fall downwards regardless of server-sided movement movement unless you set it immobile).

    You should look into what method is causing that behavior and override it. From what it looks like, maybe override the WalkingEntity::updateMove() method.
    PHP:
    public function updateMove($tickDiff){
        if(
    some condition){
            return 
    null//stops movement
        
    }
        return 
    parent::updateMove($diff);
    }
     
  3. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    is it able to stop entity movement for few seconds ?
     
  4. Saiini14 TV

    Saiini14 TV Silverfish

    Messages:
    15
    GitHub:
    saini14
    yes, because return is null. trust me, muqsit never leaves you UnAnswerd
     
    Muqsit likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.