mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Merge branch 'stable'
# Conflicts: # resources/vanilla # src/pocketmine/Player.php
This commit is contained in:
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\convert;
|
||||
|
||||
use pocketmine\entity\InvalidSkinException;
|
||||
use pocketmine\entity\Skin;
|
||||
|
||||
use pocketmine\network\mcpe\protocol\types\SkinData;
|
||||
@ -58,12 +59,11 @@ class LegacySkinAdapter implements SkinAdapter{
|
||||
|
||||
$capeData = $data->isPersonaCapeOnClassic() ? "" : $data->getCapeImage()->getData();
|
||||
|
||||
$geometryName = "";
|
||||
$resourcePatch = json_decode($data->getResourcePatch(), true);
|
||||
if(isset($resourcePatch["geometry"]["default"]) && is_string($resourcePatch["geometry"]["default"])){
|
||||
$geometryName = $resourcePatch["geometry"]["default"];
|
||||
}else{
|
||||
//TODO: Kick for invalid skin
|
||||
throw new InvalidSkinException("Missing geometry name field");
|
||||
}
|
||||
|
||||
return new Skin($data->getSkinId(), $data->getSkinImage()->getData(), $capeData, $geometryName, $data->getGeometryData());
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\convert;
|
||||
|
||||
use pocketmine\entity\InvalidSkinException;
|
||||
use pocketmine\entity\Skin;
|
||||
use pocketmine\network\mcpe\protocol\types\SkinData;
|
||||
|
||||
@ -38,6 +39,7 @@ interface SkinAdapter{
|
||||
|
||||
/**
|
||||
* Allows you to convert skin data to a skin entity.
|
||||
* @throws InvalidSkinException
|
||||
*/
|
||||
public function fromSkinData(SkinData $data) : Skin;
|
||||
}
|
||||
|
Reference in New Issue
Block a user