mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 20:12:19 +00:00
Fix #537 Shift click goes to first slot instead of existing stack
This commit is contained in:
1 parent
fc0ef3eef0
commit
f5407f9e88
1 file changed
+13
-4
@@ -182,14 +182,23 @@ public class ContainerForestry extends Container {
|
||||
}
|
||||
|
||||
private boolean tryShiftItem(ItemStack stackToShift, int numSlots) {
|
||||
boolean success = tryShiftItem(stackToShift, numSlots, true);
|
||||
if (stackToShift.stackSize > 0) {
|
||||
success |= tryShiftItem(stackToShift, numSlots, false);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
// if mergeOnly = true, don't shift into empty slots.
|
||||
private boolean tryShiftItem(ItemStack stackToShift, int numSlots, boolean mergeOnly) {
|
||||
for (int machineIndex = 0; machineIndex < numSlots - 9 * 4; machineIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(machineIndex);
|
||||
if (mergeOnly && slot.getStack() == null) {
|
||||
continue;
|
||||
}
|
||||
if (slot instanceof SlotForestry) {
|
||||
SlotForestry slotForestry = (SlotForestry) slot;
|
||||
if (!slotForestry.canShift()) {
|
||||
continue;
|
||||
}
|
||||
if (slotForestry.isPhantom()) {
|
||||
if (!slotForestry.canShift() || slotForestry.isPhantom()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user