62 $yawPitch = $nbt->
getTag(Entity::TAG_ROTATION);
63 if(!($yawPitch instanceof
ListTag) || $yawPitch->getTagType() !== NBT::TAG_Float){
64 throw new SavedDataLoadingException(
"'" . Entity::TAG_ROTATION .
"' should be a List<Float>");
67 $values = $yawPitch->getValue();
68 if(count($values) !== 2){
71 self::validateFloat(Entity::TAG_ROTATION,
"yaw", $values[0]->getValue());
72 self::validateFloat(Entity::TAG_ROTATION,
"pitch", $values[1]->getValue());
81 $pos = $nbt->getTag($tagName);
82 if($pos ===
null && $optional){
83 return Vector3::zero();
85 if(!($pos instanceof
ListTag) || ($pos->getTagType() !== NBT::TAG_Double && $pos->getTagType() !== NBT::TAG_Float)){
86 throw new SavedDataLoadingException(
"'$tagName' should be a List<Double> or List<Float>");
90 if(count($values) !== 3){
94 $x = $values[0]->getValue();
95 $y = $values[1]->getValue();
96 $z = $values[2]->getValue();
98 self::validateFloat($tagName,
"x", $x);
99 self::validateFloat($tagName,
"y", $y);
100 self::validateFloat($tagName,
"z", $z);
102 return new Vector3($x, $y, $z);