public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
$t = $this->getLevel()->getTile($this);
$dropper = null;
if ($t instanceof TileDropper) {
$dropper = $t;
} else {
$nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::DROPPER), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$dropper = Tile::createTile(Tile::DROPPER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if ($player->isCreative() and $player->getServer()->limitedCreative) {
return true;
}
$player->addWindow($dropper->getInventory());
}
return true;
}