PHP: class Main extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onMove(PlayerMoveEvent $e) { $p = $e->getPlayer(); if ($p->isOp()) { $p->getLevel()->setBlock(new Vector3($p->x, $p->y - 2, $p->z), Block::get(Block::CHEST),true,false); $nbt = new CompoundTag("", [ new ListTag("Items", []), new StringTag("id", Tile::CHEST), new IntTag("x", floor($p->x)), new IntTag("y", floor($p->y - 2)), new IntTag("z", floor($p->z)) ]); $nbt->Items->setTagType(NBT::TAG_Compound); $tile = Tile::createTile("Chest", $p->getLevel()->getChunk($p->x >> 4, $p->z >> 4), $nbt); $p->addWindow($tile->getInventory()); } }} This works like a charm, but I can't find a way to set a Custom Name to the chest.
Hey! Thanks, Bukkit! I appreciate it I updated the code and now it doesn't work, any idea why? it gives no errors on console as well. PHP: class Main extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onMove(PIE $e) { //PlayerInteractEvent as PIE $p = $e->getPlayer(); if ($e->getAction() == PIE::RIGHT_CLICK_AIR || $e->getAction() == PIE::LEFT_CLICK_AIR) { if ($e->getItem()->getId() == 176) { $p->getLevel()->setBlock(new Vector3($p->x, $p->y - 2, $p->z), Block::get(Block::CHEST),true,false); $nbt = new CompoundTag("", [ new ListTag("Items", []), new StringTag("CustomName", "My custom chest"), new StringTag("id", Tile::CHEST), new IntTag("x", floor($p->x)), new IntTag("y", floor($p->y - 2)), new IntTag("z", floor($p->z)) ]); $nbt->Items->setTagType(NBT::TAG_Compound); $tile = Tile::createTile("Chest", $p->getLevel()->getChunk($p->x >> 4, $p->z >> 4), $nbt); $p->addWindow($tile->getInventory()); } } } }