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

FallingSand

Discussion in 'Development' started by SavionLegendZzz, Feb 10, 2017.

  1. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    Hi i want to spawn a FallingSand entity but i am not sure if you can set its health/give it a nametag and you can use a block ID instead of a TileID?

    Code:
    PHP:
     /**
         * @param int $id
         * @param int $damage
         * @param Position $pos1
         * @param Position $pos2
         * @param MatchManager $match
         */
        
    public function spawnEgg($id 122$damage 0Position $pos1Position $pos2MatchManager $match){
            
    $block1 Entity::createEntity("FallingSand"$pos1->getLevel()->getChunk($pos1->>> 4$pos1->>> 4), new CompoundTag("", [
                
    "Pos" => new ListTag("Pos", [
                    new 
    DoubleTag(""$pos1->x),
                    new 
    DoubleTag(""$pos1->y),
                    new 
    DoubleTag(""$pos1->z)
                ]),
                
    "Motion" => new ListTag("Motion", [
                    new 
    DoubleTag(""0),
                    new 
    DoubleTag(""0),
                    new 
    DoubleTag(""0)
                ]),
                
    "Rotation" => new ListTag("Rotation", [
                    new 
    FloatTag(""0),
                    new 
    FloatTag(""0)
                ]),
                
    "TileID" => new IntTag("TileID"$id),
                
    "Data" => new ByteTag("Data"$damage),
            ]));
            foreach(
    $match->getPlayers() as $name){
                
    $p $this->getServer()->getPlayer($name);
                
    $block1->spawnTo($p);
            }
            
    $block1->setMaxHealth(100);
            
    $block1->setHealth(100);
            
    $block1->setNameTag(TF::AQUA."Team1 Egg");
            
    $block1->setNameTagAlwaysVisible(true);
            
    $block1->setNameTagVisible(true);
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Take a look at Slapper, you can set a nametag for sure. Not sure about the health.
     
  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.