Hi, i need help. I have 2 packets: One to open chest interact; One add item entity; PHP: public function defCaixa(PlayerInteractEvent $ev){ $block = $ev->getBlock(); if($ev->getPlayer()->getLevel()->getName() == "9"){ if($block->getId() == 54){ $ev->setCancelled(); $pk = new BlockEventPacket(); $pk->x = $block->x; $pk->y = $block->y; $pk->z = $block->z; $pk->case1 = 1; $pk->case2 = 2; $level = $ev->getPlayer()->getLevel(); $level->addChunkPacket($block->x >> 4, $block->z >> 4, $pk); $this->spawnTo($ev->getPlayer(), $block->x, $block->y, $block->z); $pk = new AddItemEntityPacket(); $pk->x = $block->x + 0.5; $pk->y = $block->y + 1; $pk->z = $block->z + 0.5; $pk->item = Item::get(1,0,1); $p->dataPacket ($pk); } } } How to close chest and remove item?? Sorry for my bad english
https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/inventory/ChestInventory.php#L96 Store the id of the new entity you are adding and do $this->getServer()->findEntity($id)->flagForDespawn(); Not sure why the BlockEventPacket works (it should show errors in the console), but nevermind, good luck!