mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
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:
parent
c09d782503
commit
b54f256fea
@ -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()){
|
||||
|
Loading…
x
Reference in New Issue
Block a user