From ee2c3241d4e3dc2c063b4a794bf2a78c19940fad Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 18 Sep 2021 17:14:57 +0700 Subject: [PATCH] Fix MatteryContainer not adding items properly --- .../ru/dbotthepony/mc/otm/container/MatteryContainer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/dbotthepony/mc/otm/container/MatteryContainer.java b/src/main/java/ru/dbotthepony/mc/otm/container/MatteryContainer.java index 48c5544ce..c2c83a11f 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/container/MatteryContainer.java +++ b/src/main/java/ru/dbotthepony/mc/otm/container/MatteryContainer.java @@ -193,7 +193,7 @@ public class MatteryContainer implements Container, Iterable { if (stack.isEmpty() || start < 0 || end > size || start >= end) return ItemStack.EMPTY; - var copy = stack.copy(); + final var copy = stack.copy(); // двигаем в одинаковые слоты for (int slot = start; slot < end; slot++) { @@ -229,6 +229,7 @@ public class MatteryContainer implements Container, Iterable { if (!simulate) { var put_copy = copy.copy(); put_copy.setCount(diff); + slots[slot] = put_copy; tracked_slots[slot] = put_copy.copy(); setChanged(slot, put_copy, ItemStack.EMPTY); } @@ -244,10 +245,12 @@ public class MatteryContainer implements Container, Iterable { return copy; } + @SuppressWarnings("unused") public ItemStack addItem(ItemStack stack, boolean simulate) { return addItem(stack, 0, size, simulate); } + @SuppressWarnings("unused") public ItemStack addItem(ItemStack stack) { return addItem(stack, 0, size, false); } @@ -260,6 +263,7 @@ public class MatteryContainer implements Container, Iterable { return addItem(stack, 0, size, false).isEmpty(); } + @SuppressWarnings("unused") public boolean fullyAddItem(ItemStack stack, int start, int end) { if (!addItem(stack, start, end, true).isEmpty()) { return false;