From 529f9b148bd6bcda2085376f5d60cfc2664334fd Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Fri, 24 Apr 2015 17:05:00 +0200 Subject: [PATCH] Save/reload skin on Human based entities --- src/pocketmine/entity/Human.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index b6407a57c..1fc5bd258 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -29,6 +29,7 @@ use pocketmine\nbt\tag\Byte; use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Enum; use pocketmine\nbt\tag\Short; +use pocketmine\nbt\tag\String; use pocketmine\network\Network; use pocketmine\network\protocol\AddPlayerPacket; use pocketmine\network\protocol\RemovePlayerPacket; @@ -114,6 +115,10 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ } } + if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof Compound){ + $this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Slim"] > 0); + } + parent::initEntity(); } @@ -187,6 +192,12 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ } } } + + + $this->namedtag->Skin = new Compound("Inventory", [ + "Data" => new String("Data", $this->getSkinData()), + "Slim" => new Byte("Slim", $this->isSkinSlim() ? 1 : 0) + ]); } public function spawnTo(Player $player){