__construct() public method

public __construct ( pocketmine\level\format\FullChunk $chunk, CompoundTag $nbt )
$chunk pocketmine\level\format\FullChunk
$nbt pocketmine\nbt\tag\CompoundTag
コード例 #1
0
 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     parent::__construct($chunk, $nbt);
     $this->inventory = new FurnaceInventory($this);
     if (!isset($this->namedtag->Items) or !$this->namedtag->Items instanceof Enum) {
         $this->namedtag->Items = new Enum("Items", []);
         $this->namedtag->Items->setTagType(NBT::TAG_Compound);
     }
     for ($i = 0; $i < $this->getSize(); ++$i) {
         $this->inventory->setItem($i, $this->getItem($i));
     }
     if (!isset($this->namedtag->BurnTime) or $this->namedtag["BurnTime"] < 0) {
         $this->namedtag->BurnTime = new Short("BurnTime", 0);
     }
     if (!isset($this->namedtag->CookTime) or $this->namedtag["CookTime"] < 0 or $this->namedtag["BurnTime"] === 0 and $this->namedtag["CookTime"] > 0) {
         $this->namedtag->CookTime = new Short("CookTime", 0);
     }
     if (!isset($this->namedtag->MaxTime)) {
         $this->namedtag->MaxTime = new Short("BurnTime", $this->namedtag["BurnTime"]);
         $this->namedtag->BurnTicks = new Short("BurnTicks", 0);
     }
     if ($this->namedtag["BurnTime"] > 0) {
         $this->scheduleUpdate();
     }
 }
コード例 #2
0
 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     parent::__construct($chunk, $nbt);
     $this->inventory = new BrewingInventory($this);
     if (!isset($this->namedtag->Items) or !$this->namedtag->Items instanceof Enum) {
         $this->namedtag->Items = new Enum("Items", []);
         $this->namedtag->Items->setTagType(NBT::TAG_Compound);
     }
     for ($i = 0; $i < $this->getSize(); ++$i) {
         $this->inventory->setItem($i, $this->getItem($i));
     }
 }
コード例 #3
0
ファイル: Spawnable.php プロジェクト: TylerAndrew/Steadfast2
 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     parent::__construct($chunk, $nbt);
     $this->spawnToAll();
 }