diff --git a/src/block/tile/ItemFrame.php b/src/block/tile/ItemFrame.php index d05c8fedc..92db02d5f 100644 --- a/src/block/tile/ItemFrame.php +++ b/src/block/tile/ItemFrame.php @@ -58,7 +58,9 @@ class ItemFrame extends Spawnable{ protected function writeSaveData(CompoundTag $nbt) : void{ $nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance); $nbt->setByte(self::TAG_ITEM_ROTATION, $this->itemRotation); - $nbt->setTag(self::TAG_ITEM, $this->item->nbtSerialize()); + if(!$this->item->isNull()){ + $nbt->setTag(self::TAG_ITEM, $this->item->nbtSerialize()); + } } public function hasItem() : bool{ @@ -96,6 +98,8 @@ class ItemFrame extends Spawnable{ protected function addAdditionalSpawnData(CompoundTag $nbt) : void{ $nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance); $nbt->setByte(self::TAG_ITEM_ROTATION, $this->itemRotation); - $nbt->setTag(self::TAG_ITEM, $this->item->nbtSerialize()); + if(!$this->item->isNull()){ + $nbt->setTag(self::TAG_ITEM, $this->item->nbtSerialize()); + } } }