Fixed NBT parsing on false properties

This commit is contained in:
Shoghi Cervantes
2015-04-20 13:57:16 +02:00
parent 6ed63edd89
commit f88aed1208
14 changed files with 37 additions and 39 deletions

View File

@ -142,7 +142,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
if($hotbarSlot !== -1){
$item = $this->inventory->getItem($hotbarSlot);
if($item->getId() !== 0 and $item->getCount() > 0){
$this->namedtag->Inventory[$slot] = new Compound(false, [
$this->namedtag->Inventory[$slot] = new Compound("", [
new Byte("Count", $item->getCount()),
new Short("Damage", $item->getDamage()),
new Byte("Slot", $slot),
@ -152,7 +152,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
continue;
}
}
$this->namedtag->Inventory[$slot] = new Compound(false, [
$this->namedtag->Inventory[$slot] = new Compound("", [
new Byte("Count", 0),
new Short("Damage", 0),
new Byte("Slot", $slot),
@ -166,7 +166,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
//$slotCount = (($this instanceof Player and ($this->gamemode & 0x01) === 1) ? Player::CREATIVE_SLOTS : Player::SURVIVAL_SLOTS) + 9;
for($slot = 9; $slot < $slotCount; ++$slot){
$item = $this->inventory->getItem($slot - 9);
$this->namedtag->Inventory[$slot] = new Compound(false, [
$this->namedtag->Inventory[$slot] = new Compound("", [
new Byte("Count", $item->getCount()),
new Short("Damage", $item->getDamage()),
new Byte("Slot", $slot),
@ -178,7 +178,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
for($slot = 100; $slot < 104; ++$slot){
$item = $this->inventory->getItem($this->inventory->getSize() + $slot - 100);
if($item instanceof ItemItem and $item->getId() !== ItemItem::AIR){
$this->namedtag->Inventory[$slot] = new Compound(false, [
$this->namedtag->Inventory[$slot] = new Compound("", [
new Byte("Count", $item->getCount()),
new Short("Damage", $item->getDamage()),
new Byte("Slot", $slot),