mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 06:55:29 +00:00
More use of Item->isNull()
This commit is contained in:
parent
c47f1f572c
commit
4b63a22f8c
@ -242,7 +242,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
/** @var Item[] $slots */
|
/** @var Item[] $slots */
|
||||||
$itemSlots = [];
|
$itemSlots = [];
|
||||||
foreach($slots as $slot){
|
foreach($slots as $slot){
|
||||||
if($slot->getId() !== 0 and $slot->getCount() > 0){
|
if(!$slot->isNull()){
|
||||||
$itemSlots[] = clone $slot;
|
$itemSlots[] = clone $slot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
/** @var Item[] $slots */
|
/** @var Item[] $slots */
|
||||||
$itemSlots = [];
|
$itemSlots = [];
|
||||||
foreach($slots as $slot){
|
foreach($slots as $slot){
|
||||||
if($slot->getId() !== 0 and $slot->getCount() > 0){
|
if(!$slot->isNull()){
|
||||||
$itemSlots[] = clone $slot;
|
$itemSlots[] = clone $slot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1519,7 +1519,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$itemTag = $item->nbtSerialize();
|
$itemTag = $item->nbtSerialize();
|
||||||
$itemTag->setName("Item");
|
$itemTag->setName("Item");
|
||||||
|
|
||||||
if($item->getId() > 0 and $item->getCount() > 0){
|
if(!$item->isNull()){
|
||||||
$itemEntity = Entity::createEntity("Item", $this, new CompoundTag("", [
|
$itemEntity = Entity::createEntity("Item", $this, new CompoundTag("", [
|
||||||
new ListTag("Pos", [
|
new ListTag("Pos", [
|
||||||
new DoubleTag("", $source->getX()),
|
new DoubleTag("", $source->getX()),
|
||||||
@ -1682,7 +1682,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
if($player === null or $player->isSurvival()){
|
if($player === null or $player->isSurvival()){
|
||||||
foreach($drops as $drop){
|
foreach($drops as $drop){
|
||||||
if($drop->getCount() > 0){
|
if(!$drop->isNull()){
|
||||||
$this->dropItem($vector->add(0.5, 0.5, 0.5), $drop);
|
$this->dropItem($vector->add(0.5, 0.5, 0.5), $drop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user