From 2a0b1f9a111a2334720f9675e6add9c79a24c8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Fri, 8 Jan 2021 21:06:22 +0100 Subject: [PATCH] Fixed data export to item stack not happening if there was no save before extracting the item. --- .../oc2/common/container/DeviceItemStackHandler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/li/cil/oc2/common/container/DeviceItemStackHandler.java b/src/main/java/li/cil/oc2/common/container/DeviceItemStackHandler.java index 7bd11b59..6ce37e8a 100644 --- a/src/main/java/li/cil/oc2/common/container/DeviceItemStackHandler.java +++ b/src/main/java/li/cil/oc2/common/container/DeviceItemStackHandler.java @@ -58,11 +58,19 @@ public class DeviceItemStackHandler extends ItemStackHandler { } } + @NotNull + @Override + public ItemStack getStackInSlot(final int slot) { + final ItemStack stack = super.getStackInSlot(slot); + busElement.exportDeviceDataToItemStack(slot, stack); + return stack; + } + @NotNull @Override public ItemStack extractItem(final int slot, final int amount, final boolean simulate) { if (!simulate && amount > 0) { - busElement.exportDeviceDataToItemStack(slot, getStackInSlot(slot)); + busElement.exportDeviceDataToItemStack(slot, super.getStackInSlot(slot)); } return super.extractItem(slot, amount, simulate);