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

Spawn block and link it to player

Discussion in 'Facepalm' started by Khome, Jun 30, 2017.

  1. Khome

    Khome Spider Jockey

    Messages:
    44
    Hi,

    How would I go about doing this: Spawn a stone block under player, set player to invisible and make the stone block follow the player as if the player is morphed to it.

    Any help would be greatly appreciated.
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    You can make a task that regularly remove the previous stone and set a new stone
    but i think using fake block packets would be more efficient
    there's also using falling sand as another block id but it dosent grip into the grid
     
  3. Khome

    Khome Spider Jockey

    Messages:
    44
    I know how to create entities and make them follow a player but how would I do it for a tile? As a block would be considered a tile not an entity
     
  4. Khome

    Khome Spider Jockey

    Messages:
    44
    So for example this is how I would spawn an entity to a player.

    PHP:
    public function spawnTo(Player $player) {
            
    parent::spawnTo($player);
            
    $pk = new AddEntityPacket();
            
    $pk->entityRuntimeId $this->getId();
            
    $pk->type $this->getNetworkId();
            
    $pk->$this->x;
            
    $pk->$this->y;
            
    $pk->$this->z;
            
    $pk->speedX $pk->speedY $pk->speedZ 0.0;
            
    $pk->yaw $this->yaw;
    $pk->metadata = [ 15 => [0,1], 20 => [2,86] ];
    $pk->$this->0.6;

            
    $pk->pitch $this->pitch;
            
    $pk->metadata $this->dataProperties;
            
    $player->dataPacket($pk);
        }
    How would I do this with a block. forexample a book shelf
     
  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.