Couldn't the beacon light just appear? How to make the block appear or just the light (if possible) for only one player to see? or leave the blocks invisible and untouchable and only the light will appear PHP: private function startBeacon(Player $player): void{ $level = $player->getLevel(); $x = $player->getX(); $y = $player->getY(); $z = $player->getZ(); $block = $level->getBlockAt($x, $y, $z); $level->setBlock($block, BlockFactory::get(Block::BEACON), true, true); $pos = $block->getSide(0); for($blockX = $pos->x - 1; $blockX <= $pos->x + 1; $blockX++){ for($blockZ = $pos->z - 1; $blockZ <= $pos->z + 1; $blockZ++){ $baseBlock = $level->getBlockAt($blockX, $pos->y, $blockZ); $level->setBlock($baseBlock, BlockFactory::get(Block::IRON_BLOCK), true, false); } } return; }
You can spawn the beacon light to a location. Send BlockEntityDataPacket to the player you want to spawn the beacon to. Notice: This will send a ghost tile and will not be handled by Pocketmine. PHP: $pk = new BlockEntityDataPacket();$pk->x = $x;$pk->y = $y;$pk->z = $z;$pk->namedtag = new CompoundTag("", [ new StringTag("id", "Beacon"), new IntTag("x", $x), new IntTag("y", $y), new IntTag("z", $z)]);$player->dataPacket($pk); Make sure to set the variables x, y and z to the coordinates like this. PHP: $x = (int) 54;$y = (int) 72;$z = (int) 100;
This is old, BlockEntityDataPacket doesn't even exist anymore, not even this link works. What you did was ctrl + c ctrl + v.