Made automatic insertion of drawers more responsive, closes #9

This commit is contained in:
Buuz135 2022-01-16 14:11:25 +01:00
parent e4ee831933
commit bbb196fef0
2 changed files with 4 additions and 6 deletions

View File

@ -256,9 +256,8 @@ public abstract class ControllableDrawerTile<T extends ControllableDrawerTile<T>
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());
}
}
}

View File

@ -81,9 +81,8 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
} else if (System.currentTimeMillis() - INTERACTION_LOGGER.getOrDefault(playerIn.getUUID(), System.currentTimeMillis()) < 300) {
boolean worked = false;
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());
worked = true;
}
}