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

Remove falling

Discussion in 'Development' started by alexwolf_dev, Oct 2, 2017.

  1. alexwolf_dev

    alexwolf_dev Spider Jockey

    Messages:
    43
    GitHub:
    Frago9876543210
    Hi guys. How to remove fall down of entity?
    [​IMG]
    PHP:
    <?php

    declare(strict_types=1);

    namespace 
    test;


    use 
    pocketmine\entity\Creature;
    use 
    pocketmine\network\mcpe\protocol\AddEntityPacket;
    use 
    pocketmine\Player;

    class 
    Firework extends Creature
    {

        const 
    NETWORK_ID 72;

        public function 
    spawnTo(Player $player)
        {
            
    $pk = new AddEntityPacket();
            
    $pk->entityRuntimeId $this->getId();
            
    $pk->type self::NETWORK_ID;
            
    $pk->position $this->asVector3();
            
    $pk->motion $this->getMotion();
            
    $pk->yaw $this->yaw;
            
    $pk->pitch $this->pitch;
            
    $pk->metadata $this->dataProperties;
            
    $player->dataPacket($pk);

            
    parent::spawnTo($player);
        }

        public function 
    getName(): string
        
    {
            return 
    "Firework";
        }
    }
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Elaborate?
     
  3. alexwolf_dev

    alexwolf_dev Spider Jockey

    Messages:
    43
    GitHub:
    Frago9876543210
    What?
     
  4. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    It means to explain more clearly.
     
  5. alexwolf_dev

    alexwolf_dev Spider Jockey

    Messages:
    43
    GitHub:
    Frago9876543210
    I want remove fall of entity. See gif.
    [​IMG]
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Overwriting Entity::tryChangeMovement() with nothing may work, I haven't tested.
    PHP:
    protected function tryChangeMovement(){
    }
     
  7. alexwolf_dev

    alexwolf_dev Spider Jockey

    Messages:
    43
    GitHub:
    Frago9876543210
    And now the entity does not move.
     
  8. themestl

    themestl Spider Jockey

    Messages:
    39
    GitHub:
    themestl
    Try override method onUpdate (maybe, I forgot it name) and when your entity get a negative motion remove it.
     
  9. svile

    svile Spider

    Messages:
    14
    https://github.com/pmmp/PocketMine-...9f1582c/src/pocketmine/entity/Entity.php#L561
     
  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.