From db8bf672f0933a5bc908825f973be4b845e54573 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 25 Jun 2022 16:10:06 +0100 Subject: [PATCH] fix item frames --- src/block/tile/ItemFrame.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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()); + } } }