Is it possible to send a chest window to a player without setting chest block at the tile location? PHP: public function onCommand(CommandSender $issuer, Command $cmd, $label, array $args) { $issuer->sendMessage("DEBUG MESSAGE SPAWNING TILE"); //$issuer->getLevel()->setBlock($issuer->subtract(0, 2, 0), Block::get(Block::CHEST), true, true); $nbt = new CompoundTag('', [ new ListTag('Items', []), new StringTag('id', Tile::CHEST), new IntTag('x', floor($issuer->x)), new IntTag('y', floor($issuer->y) - 2), new IntTag('z', floor($issuer->z)) ]); /** @var Chest $tile */ $tile = Tile::createTile('Chest', $issuer->chunk, $nbt); $customInv = new ChestInventory($tile); $issuer->addWindow($customInv); $issuer->sendMessage("DEBUG: Custom Inventory sent."); } Didn't work. No errors. Source modifications are appreciated too.
If you dont want to setblock, then you need to send the block to the player, as without a block the client will not display the inventory PHP: $block = Block::get(54);$block->x = floor($issuer->x);$block->y = floor($issuer->y)-2;$block->z = floor($issuer->z);$block->level = $issuer->level;$issuer->level->sendBlocks([$issuer],[$block]);
Send a fake tile (packets) to the player and if that doesn't work then try sending a fake chest block and fake tile with packets. If you get it to work and see 'ghost blocks' (blocks that don't really exist but the client interprets as real) you'll have resend/update the blocks or you could just resend the chunk.