Use Item->isNull() more

This commit is contained in:
Dylan K. Taylor
2017-09-21 10:29:29 +01:00
parent 61cfdac6a1
commit ef6250967f
6 changed files with 10 additions and 10 deletions

View File

@ -135,7 +135,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
$d = $item->nbtSerialize($index);
if($item->getId() === Item::AIR or $item->getCount() <= 0){
if($item->isNull()){
if($i >= 0){
unset($this->namedtag->Items[$i]);
}

View File

@ -80,7 +80,7 @@ class FlowerPot extends Spawnable{
}
public function isEmpty() : bool{
return $this->getItem()->getId() === Item::AIR;
return $this->getItem()->isNull();
}
public function addAdditionalSpawnData(CompoundTag $nbt){

View File

@ -159,7 +159,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
$d = $item->nbtSerialize($index);
if($item->getId() === Item::AIR or $item->getCount() <= 0){
if($item->isNull()){
if($i >= 0){
unset($this->namedtag->Items[$i]);
}

View File

@ -45,7 +45,7 @@ class ItemFrame extends Spawnable{
}
public function hasItem() : bool{
return $this->getItem()->getId() !== Item::AIR;
return !$this->getItem()->isNull();
}
public function getItem() : Item{
@ -57,7 +57,7 @@ class ItemFrame extends Spawnable{
}
public function setItem(Item $item = null){
if($item !== null and $item->getId() !== Item::AIR){
if($item !== null and !$item->isNull()){
$this->namedtag->Item = $item->nbtSerialize(-1, "Item");
}else{
unset($this->namedtag->Item);