Hello, is there a 'way' to create a fake chest tile without getting one from a world? but the problem is that MCPE 0.14.0 detects how far is the tile, if it is farther then ? blocks, tile closes.. Thanks.
Code: "Could not pass event 'pocketmine\event\player\PlayerItemHeldEvent' to 'DrawMyThing vDev': Illegal offset type on PocketKiller\DrawMyThing\Loader PHP: private function getChest($p){ $info = new Chest($this->getServer()->getDefaultLevel()->getChunk(0 >> 4, 0>> 4), new Compound("VirtualChest", [ new Enum("Items", [Item::get(Item::WOOL, 0, 1) => 0, Item::get(Item::WOOL, 1, 1) => 1, Item::get(Item::WOOL, 2, 1) => 2, Item::get(Item::WOOL, 3, 1) => 3, Item::get(Item::WOOL, 4, 1) => 4, Item::get(Item::WOOL, 5, 1) => 5, Item::get(Item::WOOL, 6, 1) => 6, Item::get(Item::WOOL, 7, 1) => 7, Item::get(Item::WOOL, 8, 1) => 8, Item::get(Item::WOOL, 9, 1) => 9, Item::get(Item::WOOL, 10, 1) => 10, Item::get(Item::WOOL, 11, 1) => 11, Item::get(Item::WOOL, 12, 1) => 12, Item::get(Item::WOOL, 13, 1) => 13, Item::get(Item::WOOL, 14, 1) => 14, Item::get(Item::WOOL, 15, 1) => 15]), new String("id", Tile::CHEST), new Int("x", $p->x), new Int("y", $p->y + 2), new Int("z", $p->z) ])); $chest = new ChestInventory($info); return $chest; } [/code]
hmm maybe I should use this PHP: private function getChest($p){ $info = new Chest($this->getServer()->getDefaultLevel()->getChunk(0 >> 4, 0>> 4), new Compound("VirtualChest", [ new Enum("Items", []), new String("id", Tile::CHEST), new Int("x", $p->x), new Int("y", $p->y + 2), new Int("z", $p->z) ])); $chest = new ChestInventory($info); $chest->addItem(Item::get(Item::WOOL, 0, 1)); $chest->addItem(Item::get(Item::WOOL, 1, 1)); $chest->addItem(Item::get(Item::WOOL, 2, 1)); $chest->addItem(Item::get(Item::WOOL, 3, 1)); $chest->addItem(Item::get(Item::WOOL, 4, 1)); $chest->addItem(Item::get(Item::WOOL, 5, 1)); $chest->addItem(Item::get(Item::WOOL, 6, 1)); $chest->addItem(Item::get(Item::WOOL, 7, 1)); $chest->addItem(Item::get(Item::WOOL, 8, 1)); $chest->addItem(Item::get(Item::WOOL, 9, 1)); $chest->addItem(Item::get(Item::WOOL, 10, 1)); $chest->addItem(Item::get(Item::WOOL, 11, 1)); $chest->addItem(Item::get(Item::WOOL, 12, 1)); $chest->addItem(Item::get(Item::WOOL, 13, 1)); $chest->addItem(Item::get(Item::WOOL, 14, 1)); $chest->addItem(Item::get(Item::WOOL, 15, 1)); return $chest; }
delete the posts I finally deleted them, sorry it was my Internet lagging while accessing through HTTPS
no, MCPE 0.14.0 closes the opened tile when it goes farther then *idk* blocks, tested on singlePlayer with Minecarts with chest/hopper and on server a normal chest that is 14 blocks far
Ew. PHP: private function getChest($p){ $info = new Chest($this->getServer()->getDefaultLevel()->getChunk(0 >> 4, 0>> 4), new Compound("VirtualChest", [ new Enum("Items", []), new String("id", Tile::CHEST), new Int("x", $p->x), new Int("y", $p->y + 2), new Int("z", $p->z) ])); $chest = new ChestInventory($info); for($i = 0; $i < 15; $i++){ $chest->addItem(Item::get(Item::WOOL, $i, 1)); } return $chest; } Please.
correction: PHP: for($i = 0; $i <= 15; $i++){//the i is important! $chest->addItem(Item::get(Item::WOOL, $i, 1)); }
Woops, somehow forgot it(that happens when coding on phone xD) -> Edited. Though, if you use <= 15, it will also do 16, won't it?
If you know them, you would know that it is not off-topic at all. PHP 7 disallows the use of string and int as class names, and the PHP 7-compatible API changes all NBT tag class names,