38 private const TAG_SKULL_TYPE =
"SkullType";
39 private const TAG_ROT =
"Rot";
40 private const TAG_MOUTH_MOVING =
"MouthMoving";
41 private const TAG_MOUTH_TICK_COUNT =
"MouthTickCount";
43 private MobHeadType $mobHeadType = MobHeadType::SKELETON;
44 private int $rotation = 0;
46 public function readSaveData(
CompoundTag $nbt) :
void{
47 if(($skullTypeTag = $nbt->
getTag(self::TAG_SKULL_TYPE)) instanceof
ByteTag){
48 $mobHeadType = MobHeadTypeIdMap::getInstance()->fromId($skullTypeTag->getValue());
49 if($mobHeadType ===
null){
52 $this->mobHeadType = $mobHeadType;
54 $rotation = $nbt->getByte(self::TAG_ROT, 0);
55 if($rotation >= 0 && $rotation <= 15){
56 $this->rotation = $rotation;
61 $nbt->setByte(self::TAG_SKULL_TYPE,
MobHeadTypeIdMap::getInstance()->toId($this->mobHeadType));
62 $nbt->
setByte(self::TAG_ROT, $this->rotation);
65 public function setMobHeadType(MobHeadType $type) : void{
66 $this->mobHeadType = $type;
69 public function getMobHeadType() : MobHeadType{
70 return $this->mobHeadType;
73 public function getRotation() : int{
74 return $this->rotation;
77 public function setRotation(
int $rotation) : void{
78 $this->rotation = $rotation;
82 $nbt->setByte(self::TAG_SKULL_TYPE,
MobHeadTypeIdMap::getInstance()->toId($this->mobHeadType));
83 $nbt->
setByte(self::TAG_ROT, $this->rotation);