Hey people! Whenever i spawn a tile, like TILE_CHEST it spawns, but it is invisible. When i spawn a normal block, like WOODEN_PLANKS they are visible. Now, i thought that this is a PocketMine Bug, so I had to come up with another idea. How can i open a chest interface with things in it when i tap on a NETHER REACTOR CORE? I know how to set the chests stuff. Just tell me how I can achieve the above. Thanks. Codes used: To remove the chests on the map (works fine) PHP: $level = $this->api->level->get("SG"); $level->setBlock(new Vector3($tile->x, $tile->y, $tile->z, $level), $air); $tilee = $tile; To spawn the tiles: PHP: public function newChests($amount, $tile){ for ($i = 1; $i <= $amount; $i++) { $teleport = $tile->level->getSafeSpawn(new Vector3(rand(0, 255),rand(0, 127),rand(0, 255))); $tile->level->setBlock($teleport, BlockAPI::get(54, 0, 1)); $this->log($teleport->getX()." ".$teleport->getY()." ".$teleport->getZ()); } }
I am not sure, but look at this: PHP: $packet = new ContainerOpenPacket;$id = $player->windowCnt = $packet->windowid = max(2, $player->windowCnt % 99);$packet->type = WINDOW_CHEST;$packet->slots = is_array($player->windows[$id]) ? CHEST_SLOTS << 1 : CHEST_SLOTS;$packet->x = $tile->x;$packet->y = $tile->y;$packet->z = $tile->z; // dunno what this is for$player->dataPacket($packet);$slots = array(BlockAPI::getItem(0), BlcokAPI::getItem(1), BlockAPI::getItem(2)); // blah blah blah$packet = new ContainerSetContentPacket;$packet->windowid = $id;$packet->slots = $slots; // is_array($slots) equals to true$player->dataPacket($packet);
Whenever you want to make a chest interface I think. I'm not sure, I just extracted and modified this from the PocketMine source at Tile.php
Or can't I just send the Packet, that new chests have spawned, to all players? But idk how to do that..
That was what i thought to go around that glitch. Just a few minutes ago, i saw some function (idk where) "spawntoallplayers", so something like that would also work. I just need visible chests, or chest inventories that can be updated.
I've just realized... Although furnace is also a tile (definition: a block with information other than id and damage), it doesn't use a model (look at the texture packs for definition). I think we have something to do with this.