getCapeData(); $capeImage = $capeData === "" ? new SkinImage(0, 0, "") : new SkinImage(32, 64, $capeData); $geometryName = $skin->getGeometryName(); if($geometryName === ""){ $geometryName = "geometry.humanoid.custom"; } return new SkinData( $skin->getSkinId(), json_encode(["geometry" => ["default" => $geometryName]]), SkinImage::fromLegacy($skin->getSkinData()), [], $capeImage, $skin->getGeometryData() ); } public function fromSkinData(SkinData $data) : Skin{ if($data->isPersona()){ return new Skin("Standard_Custom", str_repeat(random_bytes(3) . "\xff", 2048)); } $capeData = $data->isPersonaCapeOnClassic() ? "" : $data->getCapeImage()->getData(); $resourcePatch = json_decode($data->getResourcePatch(), true); if(is_array($resourcePatch) && isset($resourcePatch["geometry"]["default"]) && is_string($resourcePatch["geometry"]["default"])){ $geometryName = $resourcePatch["geometry"]["default"]; }else{ throw new InvalidSkinException("Missing geometry name field"); } return new Skin($data->getSkinId(), $data->getSkinImage()->getData(), $capeData, $geometryName, $data->getGeometryData()); } }