Fix GUI crash, items with outputs now take priority in factories and electric machines

This commit is contained in:
Aidan Brady 2014-03-01 10:50:17 -05:00
parent a37b6950e6
commit e27a3abae8
3 changed files with 33 additions and 33 deletions

View file

@ -41,7 +41,7 @@ public class GuiChemicalCrystalizer extends GuiMekanism
public int stackIndex = 0;
public List<ItemStack> iterStacks;
public List<ItemStack> iterStacks = new ArrayList<ItemStack>();
public GuiChemicalCrystalizer(InventoryPlayer inventory, TileEntityChemicalCrystalizer tentity)
{

View file

@ -76,6 +76,22 @@ public class ContainerElectricMachine extends Container
return null;
}
}
else if(RecipeHandler.getOutput(slotStack, false, tileEntity.getRecipes()) != null)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
{
if(!mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
else if(ChargeUtils.canBeDischarged(slotStack))
{
if(slotID != 1)
@ -93,22 +109,6 @@ public class ContainerElectricMachine extends Container
}
}
}
else if(RecipeHandler.getOutput(slotStack, false, tileEntity.getRecipes()) != null)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
{
if(!mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)

View file

@ -146,6 +146,22 @@ public class ContainerFactory extends Container
return null;
}
}
else if(RecipeType.values()[tileEntity.recipeType].getCopiedOutput(slotStack, tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas() : null, false) != null)
{
if(!isInputSlot(slotID))
{
if(!mergeItemStack(slotStack, 5, 5+tileEntity.tier.processes, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
return null;
}
}
}
else if(ChargeUtils.canBeDischarged(slotStack))
{
if(slotID != 1)
@ -179,22 +195,6 @@ public class ContainerFactory extends Container
}
}
}
else if(RecipeType.values()[tileEntity.recipeType].getCopiedOutput(slotStack, tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas() : null, false) != null)
{
if(!isInputSlot(slotID))
{
if(!mergeItemStack(slotStack, 5, 5+tileEntity.tier.processes, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(slotID != 0)