Hi. I tried to spawn a temporary chest. With my code I only set a chest block. I saw some posts about chest tiles but they weren't working for me. My code: PHP: $player->getLevel()->setBlock(new Vector3($p->x, $p->y - 2, $p->z), Block::get(54), true, true); Then I want to get the inventory and open it to the player using addWindow ()
So instead you only show one line of code? Why not showing the whole code that didn't work including errors! Put some effort in it or stop making plugins.
There are no errors. This code only creates a chest. But I want to reset the block when the inventory is closed. PHP: public function onClick(PlayerInteractEvent $e) {$player = $e->getPlayer();if($e->getBlock()->getId() == 1) {$chest = $player->getLevel()->setBlock(new Vector3($player->x, $player->y - 2, $player->z), Block::get(54), true, true);$inv = $chest->getInventory();$player->addWindow($inv);}}
Create a window? PHP: $inventort = $player->getLevel()->getTile($p)->getInventory();$player->addWindow($inventort);