Ejemplo n.º 1
0
 public function spawn($pos, $name)
 {
     if (!$this->isEnabled()) {
         return mc::_("ShopKeeper functionality disabled");
     }
     if (!isset($this->keepers[$name])) {
         return mc::_("ShopKeeper %1% not found", $name);
     }
     $trader = TraderNpc::spawnNpc($this->keepers[$name]["displayName"], $pos, TraderNpc::class, ["skin" => $this->keepers[$name]["skin"], "slim" => $this->keepers[$name]["slim"], "shop" => ["String", $name]]);
     $trader->spawnToAll();
     $pos->y = $trader->getFloorY() - 2;
     if ($pos->getY() <= 0) {
         $pos->y = 1;
     }
     $nbt = new Compound("", ["id" => new String("id", "Chest"), "x" => new Int("x", $pos->getX()), "y" => new Int("y", $pos->getY()), "z" => new Int("z", $pos->getZ()), "CustomName" => new String("CustomName", $name), "Items" => new Enum("Items", [])]);
     $pos->getLevel()->setBlock($pos, Block::get(Block::CHEST));
     $chest = new Chest($pos->getLevel()->getChunk($pos->getX() >> 4, $pos->getZ() >> 4), $nbt);
     return "";
 }
Ejemplo n.º 2
0
 public function spawn($pos, $name)
 {
     if (!$this->isEnabled()) {
         return mc::_("ShopKeeper functionality disabled");
     }
     if (!isset($this->keepers[$name])) {
         return mc::_("ShopKeeper %1% not found", $name);
     }
     $trader = TraderNpc::spawnNpc($this->keepers[$name]["displayName"], $pos, TraderNpc::class, ["skin" => $this->keepers[$name]["skin"], "slim" => $this->keepers[$name]["slim"], "shop" => ["String", $name]]);
     $trader->spawnToAll();
     return "";
 }