Fix dupe bug with fluid tank

https://github.com/aidancbrady/Mekanism/issues/3609
This commit is contained in:
clienthax 2018-12-02 19:18:57 +00:00 committed by GitHub
parent 611627519d
commit adb09e43ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ public class ContainerFluidTank extends Container
{
return tileEntity.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
@ -61,42 +61,49 @@ public class ContainerFluidTank extends Container
if(currentSlot != null && currentSlot.getHasStack())
{
int inputSlot = 0;
int outputSlot = 1;
int firstGenericInvSlot = 2;
int firstHotbarSlot = 29;
int lastHotbarSlot = 38;
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(FluidContainerRegistry.isEmptyContainer(slotStack) || FluidContainerRegistry.isFilledContainer(slotStack))
{
if(slotID != 0 && slotID != 1)
if (slotID != inputSlot && slotID != outputSlot)
{
if(!mergeItemStack(slotStack, 0, 1, false))
if(!mergeItemStack(slotStack, inputSlot, outputSlot, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, firstGenericInvSlot, lastHotbarSlot, true))
{
return null;
}
}
}
else {
if(slotID >= 2 && slotID <= 8)
if(slotID >= firstGenericInvSlot && slotID < firstHotbarSlot)
{
if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false))
if(!mergeItemStack(slotStack, firstHotbarSlot, lastHotbarSlot, false))
{
return null;
}
}
else if(slotID > 28)
else if(slotID >= firstHotbarSlot && slotID <= lastHotbarSlot)
{
if(!mergeItemStack(slotStack, 2, 28, false))
if(!mergeItemStack(slotStack, firstGenericInvSlot, firstHotbarSlot, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, firstGenericInvSlot, lastHotbarSlot, true))
{
return null;
}