public function onActivate(Item $item, Player $player = null) { if ($player instanceof Player) { if ($player->isCreative()) { return true; } $player->addWindow(new AnvilInventory($this)); } return true; }
public function onActivate(Item $item, Player $player = null) { if ($player instanceof Player) { //TODO lock if ($player->isCreative()) { return true; } if (($t = $this->getLevel()->getTile($this)) instanceof TileBrewingStand) { $player->addWindow(new BrewingInventory($t)); } } return true; }
public function onActivate(Item $item, Player $player = null) { if ($player instanceof Player) { $top = $this->getSide(1); if ($top->isTransparent() !== true) { return true; } $t = $this->getLevel()->getTile($this); $chest = null; if ($t instanceof TileChest) { $chest = $t; } else { $nbt = new Compound("", [new Enum("Items", []), new String("id", Tile::CHEST), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z)]); $nbt->Items->setTagType(NBT::TAG_Compound); $chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt); } if (isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof String) { if ($chest->namedtag->Lock->getValue() !== $item->getCustomName()) { return true; } } if ($player->isCreative()) { return true; } $player->addWindow($chest->getInventory()); } return true; }
public function onActivate(Item $item, Player $player = null) { if ($player instanceof Player) { $t = $this->getLevel()->getTile($this); $furnace = false; if ($t instanceof Furnace) { $furnace = $t; } else { $nbt = new Compound("", [new Enum("Items", []), new String("id", Tile::FURNACE), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z)]); $nbt->Items->setTagType(NBT::TAG_Compound); $furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt); } if (isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof String) { if ($furnace->namedtag->Lock->getValue() !== $item->getCustomName()) { return true; } } if ($player->isCreative()) { return true; } $player->addWindow($furnace->getInventory()); } return true; }