From 18292e415a17f5dce9a1d9c3df2c72620abe9051 Mon Sep 17 00:00:00 2001 From: SammySemicolon <69329424+SammySemicolon@users.noreply.github.com> Date: Mon, 2 Jan 2023 13:57:01 +0100 Subject: [PATCH] Update LodestoneBlockEntityInventory.java --- .../blockentity/LodestoneBlockEntityInventory.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/team/lodestar/lodestone/systems/blockentity/LodestoneBlockEntityInventory.java b/src/main/java/team/lodestar/lodestone/systems/blockentity/LodestoneBlockEntityInventory.java index d205399f..2f8761b3 100644 --- a/src/main/java/team/lodestar/lodestone/systems/blockentity/LodestoneBlockEntityInventory.java +++ b/src/main/java/team/lodestar/lodestone/systems/blockentity/LodestoneBlockEntityInventory.java @@ -95,7 +95,14 @@ public void updateData() { nonEmptyItemStacks = stacks.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(ArrayList::new)); nonEmptyItemAmount = nonEmptyItemStacks.size(); emptyItemAmount = (int) stacks.stream().filter(ItemStack::isEmpty).count(); - firstEmptyItemIndex = this.stacks.indexOf(ItemStack.EMPTY); + for (int i = 0; i < stacks.size(); i++) { + ItemStack stack = stacks.get(i); + if (stack.isEmpty()) { + firstEmptyItemIndex = i; + return; + } + } + firstEmptyItemIndex = -1; } public void load(CompoundTag compound) {