skullType = SkullType::SKELETON(); parent::__construct($world, $pos); } public function readSaveData(CompoundTag $nbt) : void{ if($nbt->hasTag(self::TAG_SKULL_TYPE, ByteTag::class)){ try{ $this->skullType = SkullType::fromMagicNumber($nbt->getByte(self::TAG_SKULL_TYPE)); }catch(\InvalidArgumentException $e){ //bad data, drop it } } $rotation = $nbt->getByte(self::TAG_ROT, 0); if($rotation >= 0 and $rotation <= 15){ $this->skullRotation = $rotation; } } protected function writeSaveData(CompoundTag $nbt) : void{ $nbt->setByte(self::TAG_SKULL_TYPE, $this->skullType->getMagicNumber()); $nbt->setByte(self::TAG_ROT, $this->skullRotation); } public function setSkullType(SkullType $type) : void{ $this->skullType = $type; } public function getSkullType() : SkullType{ return $this->skullType; } public function getRotation() : int{ return $this->skullRotation; } public function setRotation(int $rotation) : void{ $this->skullRotation = $rotation; } protected function addAdditionalSpawnData(CompoundTag $nbt) : void{ $nbt->setByte(self::TAG_SKULL_TYPE, $this->skullType->getMagicNumber()); $nbt->setByte(self::TAG_ROT, $this->skullRotation); } }