61 $generic = $nbt->
getTag(Entity::TAG_ROTATION);
62 if(!($generic instanceof
ListTag) || ($yawPitch = $generic->cast(FloatTag::class)) ===
null){
63 throw new SavedDataLoadingException(
"'" . Entity::TAG_ROTATION .
"' should be a List<Float>");
65 $values = $yawPitch->getValue();
66 if(count($values) !== 2){
69 self::validateFloat(Entity::TAG_ROTATION,
"yaw", $values[0]->getValue());
70 self::validateFloat(Entity::TAG_ROTATION,
"pitch", $values[1]->getValue());
79 $generic = $nbt->getTag($tagName);
80 if($generic ===
null && $optional){
81 return Vector3::zero();
83 if(!($generic instanceof
ListTag) || ($pos = $generic->cast(DoubleTag::class) ?? $generic->cast(FloatTag::class)) ===
null){
84 throw new SavedDataLoadingException(
"'$tagName' should be a List<Double> or List<Float>");
87 if(count($values) !== 3){
91 $x = $values[0]->getValue();
92 $y = $values[1]->getValue();
93 $z = $values[2]->getValue();
95 self::validateFloat($tagName,
"x", $x);
96 self::validateFloat($tagName,
"y", $y);
97 self::validateFloat($tagName,
"z", $z);
99 return new Vector3($x, $y, $z);