From a4cdbb544df6de943b17f8744b159c649fb068ad Mon Sep 17 00:00:00 2001 From: clienthax Date: Thu, 6 Dec 2018 14:29:15 +0000 Subject: [PATCH] [1.7.10] Fix dupe bug with chemical washer https://www.youtube.com/watch?v=i86989eh4Kc&feature=youtu.be --- .../container/ContainerChemicalWasher.java | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java index f715faee0..8c18b893d 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java @@ -68,27 +68,38 @@ public class ContainerChemicalWasher extends Container if(currentSlot != null && currentSlot.getHasStack()) { + + int inputSlot = 0; + int outputSlot = 1; + int tankSlot = 2; + int dischargeSlot = 3; + int firstGenericInvSlot = 4; + int firstHotbarSlot = 31; + int lastHotbarSlot = inventorySlots.size(); + ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(slotID == 1) + System.out.println(inventorySlots.size()); + + if(slotID == outputSlot) { - if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, firstGenericInvSlot, lastHotbarSlot, true)) { return null; } } else if(FluidContainerRegistry.isFilledContainer(slotStack) && FluidContainerRegistry.getFluidForFilledItem(slotStack).getFluid() == FluidRegistry.WATER) { - if(slotID != 0) + if(slotID != inputSlot) { - if(!mergeItemStack(slotStack, 0, 1, false)) + if(!mergeItemStack(slotStack, inputSlot, outputSlot, false)) { return null; } } else { - if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, firstGenericInvSlot, lastHotbarSlot, true)) { return null; } @@ -96,15 +107,15 @@ public class ContainerChemicalWasher extends Container } else if(slotStack.getItem() instanceof IGasItem) { - if(slotID != 2) + if(slotID != tankSlot) { - if(!mergeItemStack(slotStack, 2, 3, false)) + if(!mergeItemStack(slotStack, tankSlot, dischargeSlot, false)) { return null; } } else { - if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, firstGenericInvSlot, lastHotbarSlot, true)) { return null; } @@ -112,38 +123,38 @@ public class ContainerChemicalWasher extends Container } else if(ChargeUtils.canBeDischarged(slotStack)) { - if(slotID != 3) + if(slotID != dischargeSlot) { - if(!mergeItemStack(slotStack, 3, 4, false)) + if(!mergeItemStack(slotStack, dischargeSlot, firstGenericInvSlot, false)) { return null; } } - else if(slotID == 3) + else { - if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, firstGenericInvSlot, lastHotbarSlot, true)) { return null; } } } else { - if(slotID >= 4 && slotID <= 30) + if(slotID >= firstGenericInvSlot && slotID < firstHotbarSlot) { - if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) + if(!mergeItemStack(slotStack, firstHotbarSlot, lastHotbarSlot, false)) { return null; } } - else if(slotID > 31) + else if(slotID >= firstHotbarSlot && slotID <= lastHotbarSlot) { - if(!mergeItemStack(slotStack, 4, 30, false)) + if(!mergeItemStack(slotStack, firstGenericInvSlot, firstHotbarSlot, false)) { return null; } } else { - if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, firstGenericInvSlot, lastHotbarSlot, true)) { return null; }