41 $capeData = $skin->getCapeData();
42 $capeImage = $capeData ===
"" ?
new SkinImage(0, 0,
"") : new
SkinImage(32, 64, $capeData);
43 $geometryName = $skin->getGeometryName();
44 if($geometryName ===
""){
45 $geometryName =
"geometry.humanoid.custom";
50 json_encode([
"geometry" => [
"default" => $geometryName]], JSON_THROW_ON_ERROR),
51 SkinImage::fromLegacy($skin->getSkinData()), [],
53 $skin->getGeometryData()
58 if($data->isPersona()){
59 return new Skin(
"Standard_Custom", str_repeat(random_bytes(3) .
"\xff", 4096));
62 $capeData = $data->isPersonaCapeOnClassic() ?
"" : $data->getCapeImage()->getData();
64 $resourcePatch = json_decode($data->getResourcePatch(),
true);
65 if(is_array($resourcePatch) && isset($resourcePatch[
"geometry"][
"default"]) && is_string($resourcePatch[
"geometry"][
"default"])){
66 $geometryName = $resourcePatch[
"geometry"][
"default"];
68 throw new InvalidSkinException(
"Missing geometry name field");
71 return new Skin($data->getSkinId(), $data->getSkinImage()->getData(), $capeData, $geometryName, $data->getGeometryData());