Added a hack to cut down on excess skin geometry bloat

there are further ways this can be debloated, but non-pretty-printing it cuts the size down by ~70-80%.
This commit is contained in:
Dylan K. Taylor 2017-10-01 16:49:56 +01:00
parent c09d782503
commit b54f256fea

View File

@ -2018,12 +2018,23 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return true;
}
/* Mojang, some stupid reason, send every single model for every single skin in the selected skin-pack.
* Not only that, they are pretty-printed. This decode/encode is to get rid of the pretty-print, which cuts down
* significantly on the amount of wasted bytes.
* TODO: find out what model crap can be safely dropped from the packet (unless it gets fixed first)
*/
$geometryJsonEncoded = base64_decode($packet->clientData["SkinGeometry"] ?? "");
if($geometryJsonEncoded !== ""){
$geometryJsonEncoded = json_encode(json_decode($geometryJsonEncoded));
}
$skin = new Skin(
$packet->clientData["SkinId"],
base64_decode($packet->clientData["SkinData"] ?? ""),
base64_decode($packet->clientData["CapeData"] ?? ""),
$packet->clientData["SkinGeometryName"],
base64_decode($packet->clientData["SkinGeometry"] ?? "")
$geometryJsonEncoded
);
if(!$skin->isValid()){