hasTag(self::TAG_SKULL_TYPE, ByteTag::class)){ $nbt->setByte(self::TAG_SKULL_TYPE, 0, true); } if(!$nbt->hasTag(self::TAG_ROT, ByteTag::class)){ $nbt->setByte(self::TAG_ROT, 0, true); } parent::__construct($level, $nbt); } public function setType(int $type){ $this->namedtag->setByte(self::TAG_SKULL_TYPE, $type); $this->onChanged(); } public function getType() : int{ return $this->namedtag->getByte(self::TAG_SKULL_TYPE); } public function addAdditionalSpawnData(CompoundTag $nbt) : void{ $nbt->setTag($this->namedtag->getTag(self::TAG_SKULL_TYPE)); $nbt->setTag($this->namedtag->getTag(self::TAG_ROT)); } 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("Rot", $rot); } }