From bbb196fef07ab350757e0f395845e3b6623671f1 Mon Sep 17 00:00:00 2001 From: Buuz135 Date: Sun, 16 Jan 2022 14:11:25 +0100 Subject: [PATCH] Made automatic insertion of drawers more responsive, closes #9 --- .../functionalstorage/block/tile/ControllableDrawerTile.java | 5 ++--- .../functionalstorage/block/tile/DrawerControllerTile.java | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java index 17f2267..2fab351 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java @@ -256,9 +256,8 @@ public abstract class ControllableDrawerTile playerIn.setItemInHand(hand, getStorage().insertItem(slot, stack, false)); } else if (System.currentTimeMillis() - INTERACTION_LOGGER.getOrDefault(playerIn.getUUID(), System.currentTimeMillis()) < 300) { for (ItemStack itemStack : playerIn.getInventory().items) { - if (!itemStack.isEmpty() && getStorage().insertItem(slot, itemStack, true).isEmpty()) { - getStorage().insertItem(slot, itemStack.copy(), false); - itemStack.setCount(0); + if (!itemStack.isEmpty() && !getStorage().getStackInSlot(slot).isEmpty() && getStorage().insertItem(slot, itemStack, true).getCount() != stack.getCount()) { + itemStack.setCount(getStorage().insertItem(slot, itemStack.copy(), false).getCount()); } } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java index c740972..1f745b6 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java @@ -81,9 +81,8 @@ public class DrawerControllerTile extends ControllableDrawerTile