ItemEntity: disable saving if the contained item is air or has a zero count

This commit is contained in:
Dylan K. Taylor 2022-09-20 14:45:10 +01:00
parent f39d2a9be3
commit 5bc7ca6569
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -186,6 +186,10 @@ class ItemEntity extends Entity{
return true;
}
public function canSaveWithChunk() : bool{
return !$this->item->isNull();
}
public function saveNBT() : CompoundTag{
$nbt = parent::saveNBT();
$nbt->setTag("Item", $this->item->nbtSerialize());