Don't barf on air itemstacks found on disk

closes #5143

this is caused by bugs in PM4, where it saved air itemstacks when it wasn't supposed to.

These issues are now all addressed in PM5, since ItemSerializer won't accept air itemstacks.
This commit is contained in:
Dylan K. Taylor
2022-07-08 18:19:46 +01:00
parent 54a773be0c
commit 66d655731a
2 changed files with 14 additions and 2 deletions

View File

@@ -633,6 +633,9 @@ class Item implements \JsonSerializable{
*/
public static function nbtDeserialize(CompoundTag $tag) : Item{
$itemData = GlobalItemDataHandlers::getUpgrader()->upgradeItemStackNbt($tag);
if($itemData === null){
return VanillaItems::AIR();
}
try{
return GlobalItemDataHandlers::getDeserializer()->deserializeStack($itemData);