skullType = $nbt->getByte(self::TAG_SKULL_TYPE, self::TYPE_SKELETON, true); $this->skullRotation = $nbt->getByte(self::TAG_ROT, 0, true); } protected function writeSaveData(CompoundTag $nbt) : void{ $nbt->setByte(self::TAG_SKULL_TYPE, $this->skullType); $nbt->setByte(self::TAG_ROT, $this->skullRotation); } public function setType(int $type){ $this->skullType = $type; $this->onChanged(); } public function getType() : int{ return $this->skullType; } protected function addAdditionalSpawnData(CompoundTag $nbt) : void{ $nbt->setByte(self::TAG_SKULL_TYPE, $this->skullType); $nbt->setByte(self::TAG_ROT, $this->skullRotation); } protected static function createAdditionalNBT(CompoundTag $nbt, Vector3 $pos, ?int $face = null, ?Item $item = null, ?Player $player = null) : void{ $nbt->setByte(self::TAG_SKULL_TYPE, $item !== null ? $item->getDamage() : self::TYPE_SKELETON); $rot = 0; if($face === Vector3::SIDE_UP and $player !== null){ $rot = floor(($player->yaw * 16 / 360) + 0.5) & 0x0F; } $nbt->setByte(self::TAG_ROT, $rot); } }