Renamed NBT tags to have Tag in the name

This commit is contained in:
Shoghi Cervantes
2015-08-12 21:30:15 +02:00
parent 34dc6ea0d6
commit 7f8b39a63c
58 changed files with 791 additions and 791 deletions

View File

@ -26,11 +26,11 @@ use pocketmine\inventory\PlayerInventory;
use pocketmine\item\Item as ItemItem;
use pocketmine\utils\UUID;
use pocketmine\nbt\NBT;
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\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\ShortTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\network\Network;
use pocketmine\network\protocol\AddPlayerPacket;
use pocketmine\network\protocol\RemovePlayerPacket;
@ -111,14 +111,14 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
$this->setNameTag($this->namedtag["NameTag"]);
}
if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof Compound){
if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof CompoundTag){
$this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Slim"] > 0);
}
$this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());
}
if(isset($this->namedtag->Inventory) and $this->namedtag->Inventory instanceof Enum){
if(isset($this->namedtag->Inventory) and $this->namedtag->Inventory instanceof ListTag){
foreach($this->namedtag->Inventory as $item){
if($item["Slot"] >= 0 and $item["Slot"] < 9){ //Hotbar
$this->inventory->setHotbarSlotIndex($item["Slot"], isset($item["TrueSlot"]) ? $item["TrueSlot"] : -1);
@ -150,7 +150,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
public function saveNBT(){
parent::saveNBT();
$this->namedtag->Inventory = new Enum("Inventory", []);
$this->namedtag->Inventory = new ListTag("Inventory", []);
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
if($this->inventory !== null){
for($slot = 0; $slot < 9; ++$slot){
@ -159,19 +159,19 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
$item = $this->inventory->getItem($hotbarSlot);
if($item->getId() !== 0 and $item->getCount() > 0){
$tag = NBT::putItemHelper($item, $slot);
$tag->TrueSlot = new Byte("TrueSlot", $hotbarSlot);
$tag->TrueSlot = new ByteTag("TrueSlot", $hotbarSlot);
$this->namedtag->Inventory[$slot] = $tag;
continue;
}
}
$this->namedtag->Inventory[$slot] = new Compound("", [
new Byte("Count", 0),
new Short("Damage", 0),
new Byte("Slot", $slot),
new Byte("TrueSlot", -1),
new Short("id", 0),
$this->namedtag->Inventory[$slot] = new CompoundTag("", [
new ByteTag("Count", 0),
new ShortTag("Damage", 0),
new ByteTag("Slot", $slot),
new ByteTag("TrueSlot", -1),
new ShortTag("id", 0),
]);
}
@ -193,9 +193,9 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
}
if(strlen($this->getSkinData()) > 0){
$this->namedtag->Skin = new Compound("Skin", [
"Data" => new String("Data", $this->getSkinData()),
"Slim" => new Byte("Slim", $this->isSkinSlim() ? 1 : 0)
$this->namedtag->Skin = new CompoundTag("Skin", [
"Data" => new StringTag("Data", $this->getSkinData()),
"Slim" => new ByteTag("Slim", $this->isSkinSlim() ? 1 : 0)
]);
}
}