Hello PocketMine-MP Forums. I have an issue, my goal is to fill the container's inventory with a stone block but unfortunately that did not happen. This is the code i used: PHP: /* @var Player $this->player *//* @var Vector3 $this->pos */$pk1 = new ContainerOpenPacket();$pk1->windowId = WindowTypes::MINECART_CHEST;$pk1->type = WindowTypes::CONTAINER;$pk1->x = $this->pos->x;$pk1->y = $this->pos->y;$pk1->z = $this->pos->z;$this->player->sendDataPacket($pk1);$pk2 = new InventoryContentPacket();$pk2->windowId = WindowTypes::MINECART_CHEST;$pk2->items = array_fill(0, 2, Item::get(Item::AIR, 0, 0));$pk2->items[3] = Item::get(Item::STONE, 0, 4);$this->player->sendDataPacket($pk2); Does anyone know why this is? Thanks in advanced.
What exactly are you trying to do? If you are using packets for those things, then you'll need to handle ContainerClosePacket and InventoryTransactionPacket yourself. You may end up writing what's already written in the pocketmine core.
Because it's what Muqsit said. What you are making is a tile, but you send it to the player with packets and not functions. Using tiles will make your life easier. InventoryContentPacket did not work for me too though. After a small re-search, I see that this might be useful: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/inventory/BaseInventory.php#L456