From 4371fd7edf0c9c9b53c641eeb468d5305a05920f Mon Sep 17 00:00:00 2001 From: glisco Date: Mon, 9 Dec 2024 22:35:22 +0100 Subject: [PATCH] fix log spam caused by empty item stacks in NbtUtil.readItemStackList --- src/main/java/io/wispforest/affinity/misc/util/NbtUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/wispforest/affinity/misc/util/NbtUtil.java b/src/main/java/io/wispforest/affinity/misc/util/NbtUtil.java index 7fe80758..d516782b 100644 --- a/src/main/java/io/wispforest/affinity/misc/util/NbtUtil.java +++ b/src/main/java/io/wispforest/affinity/misc/util/NbtUtil.java @@ -36,7 +36,9 @@ public static void readItemStackList(NbtCompound nbt, String key, DefaultedList< var stackNbt = (NbtCompound) element; byte idx = stackNbt.contains("Slot", NbtElement.BYTE_TYPE) ? stackNbt.getByte("Slot") : -1; - if (idx >= 0 && idx < items.size()) items.set(idx, ItemStack.fromNbtOrEmpty(registries, stackNbt)); + if (stackNbt.contains("id") && idx >= 0 && idx < items.size()) { + items.set(idx, ItemStack.fromNbtOrEmpty(registries, stackNbt)); + } } }