More use of Item->isNull()

This commit is contained in:
Dylan K. Taylor 2017-09-27 11:05:40 +01:00
parent c47f1f572c
commit 4b63a22f8c
2 changed files with 4 additions and 4 deletions

View File

@ -242,7 +242,7 @@ abstract class BaseInventory implements Inventory{
/** @var Item[] $slots */
$itemSlots = [];
foreach($slots as $slot){
if($slot->getId() !== 0 and $slot->getCount() > 0){
if(!$slot->isNull()){
$itemSlots[] = clone $slot;
}
}
@ -299,7 +299,7 @@ abstract class BaseInventory implements Inventory{
/** @var Item[] $slots */
$itemSlots = [];
foreach($slots as $slot){
if($slot->getId() !== 0 and $slot->getCount() > 0){
if(!$slot->isNull()){
$itemSlots[] = clone $slot;
}
}

View File

@ -1519,7 +1519,7 @@ class Level implements ChunkManager, Metadatable{
$itemTag = $item->nbtSerialize();
$itemTag->setName("Item");
if($item->getId() > 0 and $item->getCount() > 0){
if(!$item->isNull()){
$itemEntity = Entity::createEntity("Item", $this, new CompoundTag("", [
new ListTag("Pos", [
new DoubleTag("", $source->getX()),
@ -1682,7 +1682,7 @@ class Level implements ChunkManager, Metadatable{
if($player === null or $player->isSurvival()){
foreach($drops as $drop){
if($drop->getCount() > 0){
if(!$drop->isNull()){
$this->dropItem($vector->add(0.5, 0.5, 0.5), $drop);
}
}