From c553460fc70b33ba69a616b53ce24bf4a5327d59 Mon Sep 17 00:00:00 2001 From: Matyrobbrt <65940752+Matyrobbrt@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:08:52 +0200 Subject: [PATCH] Fix stacks having empty nbts upon deserialization --- .../com/refinedmods/refinedstorage/network/NetworkHandler.java | 2 +- .../java/com/refinedmods/refinedstorage/util/StackUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/refinedmods/refinedstorage/network/NetworkHandler.java b/src/main/java/com/refinedmods/refinedstorage/network/NetworkHandler.java index 56cc7331e1..27c0be84ec 100644 --- a/src/main/java/com/refinedmods/refinedstorage/network/NetworkHandler.java +++ b/src/main/java/com/refinedmods/refinedstorage/network/NetworkHandler.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage.network; -import com.refinedmods.refinedstorage.network.craftingmonitor.CraftingMonitorCancelMessage; +import com.refinedmods.refinedstorage.network.craftingmonitor.CraftingMonitorCancelMessage; import com.refinedmods.refinedstorage.network.craftingmonitor.CraftingMonitorUpdateMessage; import com.refinedmods.refinedstorage.network.craftingmonitor.WirelessCraftingMonitorSettingsUpdateMessage; import com.refinedmods.refinedstorage.network.disk.StorageDiskSizeRequestMessage; diff --git a/src/main/java/com/refinedmods/refinedstorage/util/StackUtils.java b/src/main/java/com/refinedmods/refinedstorage/util/StackUtils.java index 864924419e..393f5dfacf 100644 --- a/src/main/java/com/refinedmods/refinedstorage/util/StackUtils.java +++ b/src/main/java/com/refinedmods/refinedstorage/util/StackUtils.java @@ -338,7 +338,7 @@ public static ItemStack deserializeStackFromNbt(CompoundTag tag) { return AttachmentInternals.reconstructItemStack( BuiltInRegistries.ITEM.get(new ResourceLocation(tag.getString(NBT_ITEM_ID))), tag.getInt(NBT_ITEM_QUANTITY), - tag.getCompound(NBT_ITEM_NBT) + tag.contains(NBT_ITEM_NBT) ? tag.getCompound(NBT_ITEM_NBT) : null ); } }