Exemple #1
0
 public function saveNBT()
 {
     $this->namedtag->Items = new Enum("Items", []);
     $this->namedtag->Items->setTagType(NBT::TAG_Compound);
     for ($index = 0; $index < $this->getSize(); ++$index) {
         $this->setItem($index, $this->inventory->getItem($index));
     }
 }
 public function onClose(Player $who)
 {
     if (count($this->getViewers()) === 1) {
         $pk = new BlockEventPacket();
         $pk->x = $this->right->getHolder()->getX();
         $pk->y = $this->right->getHolder()->getY();
         $pk->z = $this->right->getHolder()->getZ();
         $pk->case1 = 1;
         $pk->case2 = 0;
         if (($level = $this->right->getHolder()->getLevel()) instanceof Level) {
             $level->addChunkPacket($this->right->getHolder()->getX() >> 4, $this->right->getHolder()->getZ() >> 4, $pk);
         }
     }
     parent::onClose($who);
 }