Fixed data export to item stack not happening if there was no save before extracting the item.

This commit is contained in:
Florian Nücke
2021-01-08 21:06:22 +01:00
parent 9657e4653a
commit 2a0b1f9a11

View File

@@ -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);