Made automatic insertion of drawers more responsive, closes #9
This commit is contained in:
parent
e4ee831933
commit
bbb196fef0
|
@ -256,9 +256,8 @@ public abstract class ControllableDrawerTile<T extends ControllableDrawerTile<T>
|
||||||
playerIn.setItemInHand(hand, getStorage().insertItem(slot, stack, false));
|
playerIn.setItemInHand(hand, getStorage().insertItem(slot, stack, false));
|
||||||
} else if (System.currentTimeMillis() - INTERACTION_LOGGER.getOrDefault(playerIn.getUUID(), System.currentTimeMillis()) < 300) {
|
} else if (System.currentTimeMillis() - INTERACTION_LOGGER.getOrDefault(playerIn.getUUID(), System.currentTimeMillis()) < 300) {
|
||||||
for (ItemStack itemStack : playerIn.getInventory().items) {
|
for (ItemStack itemStack : playerIn.getInventory().items) {
|
||||||
if (!itemStack.isEmpty() && getStorage().insertItem(slot, itemStack, true).isEmpty()) {
|
if (!itemStack.isEmpty() && !getStorage().getStackInSlot(slot).isEmpty() && getStorage().insertItem(slot, itemStack, true).getCount() != stack.getCount()) {
|
||||||
getStorage().insertItem(slot, itemStack.copy(), false);
|
itemStack.setCount(getStorage().insertItem(slot, itemStack.copy(), false).getCount());
|
||||||
itemStack.setCount(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,8 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
|
||||||
} else if (System.currentTimeMillis() - INTERACTION_LOGGER.getOrDefault(playerIn.getUUID(), System.currentTimeMillis()) < 300) {
|
} else if (System.currentTimeMillis() - INTERACTION_LOGGER.getOrDefault(playerIn.getUUID(), System.currentTimeMillis()) < 300) {
|
||||||
boolean worked = false;
|
boolean worked = false;
|
||||||
for (ItemStack itemStack : playerIn.getInventory().items) {
|
for (ItemStack itemStack : playerIn.getInventory().items) {
|
||||||
if (!itemStack.isEmpty() && getStorage().insertItem(slot, itemStack, true).isEmpty()) {
|
if (!itemStack.isEmpty() && !getStorage().getStackInSlot(slot).isEmpty() && getStorage().insertItem(slot, itemStack, true).getCount() != stack.getCount()) {
|
||||||
getStorage().insertItem(slot, itemStack.copy(), false);
|
itemStack.setCount(getStorage().insertItem(slot, itemStack.copy(), false).getCount());
|
||||||
itemStack.setCount(0);
|
|
||||||
worked = true;
|
worked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user