Work on new machines

This commit is contained in:
Aidan Brady 2013-12-11 18:26:10 -05:00
parent 123ae05dcd
commit 7a3c678d76
6 changed files with 50 additions and 53 deletions

View file

@ -98,7 +98,7 @@ public final class RecipeHandler
* @param recipes - Map of recipes
* @return InfusionOutput
*/
public static InfusionOutput getOutput(InfusionInput infusion, boolean stackDecrease)
public static InfusionOutput getMetallurgicInfuserOutput(InfusionInput infusion, boolean stackDecrease)
{
if(infusion != null && infusion.inputStack != null)
{
@ -126,7 +126,7 @@ public final class RecipeHandler
return null;
}
public static GasStack getOutput(ChemicalInput input)
public static GasStack getChemicalInfuserOutput(ChemicalInput input)
{
if(input != null && input.isValid())
{
@ -137,7 +137,7 @@ public final class RecipeHandler
return null;
}
public GasStack getOutput(ItemStack itemstack, boolean stackDecrease)
public static GasStack getChemicalFormulatorOutput(ItemStack itemstack, boolean stackDecrease)
{
if(itemstack != null)
{

View file

@ -1,9 +1,10 @@
package mekanism.common.inventory.container;
import mekanism.api.gas.IGasItem;
import mekanism.common.RecipeHandler;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tileentity.TileEntityChemicalInfuser;
import mekanism.common.tileentity.TileEntityChemicalFormulator;
import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@ -13,21 +14,20 @@ import net.minecraft.item.ItemStack;
public class ContainerChemicalFormulator extends Container
{
private TileEntityChemicalInfuser tileEntity;
private TileEntityChemicalFormulator tileEntity;
public ContainerChemicalFormulator(InventoryPlayer inventory, TileEntityChemicalInfuser tentity)
public ContainerChemicalFormulator(InventoryPlayer inventory, TileEntityChemicalFormulator tentity)
{
tileEntity = tentity;
addSlotToContainer(new SlotStorageTank(tentity, null, true, 0, 5, 56));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 1, 80, 65));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 2, 155, 56));
addSlotToContainer(new SlotDischarge(tentity, 3, 155, 5));
addSlotToContainer(new Slot(tentity, 0, 26, 36));
addSlotToContainer(new SlotDischarge(tentity, 1, 155, 5));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 2, 155, 25));
int slotX;
for(slotX = 0; slotX < 3; slotX++)
for(slotX = 0; slotX < 3; ++slotX)
{
for(int slotY = 0; slotY < 9; slotY++)
for(int slotY = 0; slotY < 9; ++slotY)
{
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
}
@ -68,9 +68,9 @@ public class ContainerChemicalFormulator extends Container
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(slotID == 2)
if(RecipeHandler.getChemicalFormulatorOutput(slotStack, false) != null)
{
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 0, 1, true))
{
return null;
}
@ -86,45 +86,45 @@ public class ContainerChemicalFormulator extends Container
}
else if(slotID == 1)
{
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
else if(slotStack.getItem() instanceof IGasItem)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
if(slotID != 0 && slotID != 1 && slotID != 2)
{
if(!mergeItemStack(slotStack, 3, 4, false))
if(!mergeItemStack(slotStack, 2, 3, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}
}
}
else {
if(slotID >= 4 && slotID <= 30)
if(slotID >= 3 && slotID <= 29)
{
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 30)
{
if(!mergeItemStack(slotStack, 4, 30, false))
if(!mergeItemStack(slotStack, 3, 29, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
{
return null;
}

View file

@ -1,9 +1,7 @@
package mekanism.common.inventory.container;
import mekanism.common.RecipeHandler;
import mekanism.api.gas.IGasItem;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tileentity.TileEntityChemicalInfuser;
@ -21,15 +19,16 @@ public class ContainerChemicalInfuser extends Container
public ContainerChemicalInfuser(InventoryPlayer inventory, TileEntityChemicalInfuser tentity)
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, 26, 36));
addSlotToContainer(new SlotDischarge(tentity, 1, 155, 5));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 2, 155, 25));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 0, 5, 56));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 1, 155, 56));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 2, 80, 65));
addSlotToContainer(new SlotDischarge(tentity, 3, 155, 5));
int slotX;
for(slotX = 0; slotX < 3; ++slotX)
for(slotX = 0; slotX < 3; slotX++)
{
for(int slotY = 0; slotY < 9; ++slotY)
for(int slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
}
@ -70,23 +69,16 @@ public class ContainerChemicalInfuser extends Container
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(slotID == 2)
if(ChargeUtils.canBeDischarged(slotStack))
{
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
else if(ChargeUtils.canBeDischarged(slotStack))
{
if(slotID != 1)
if(slotID != 3)
{
if(!mergeItemStack(slotStack, 1, 2, false))
if(!mergeItemStack(slotStack, 3, 4, false))
{
return null;
}
}
else if(slotID == 1)
else if(slotID == 3)
{
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
@ -94,17 +86,17 @@ public class ContainerChemicalInfuser extends Container
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
else if(slotStack.getItem() instanceof IGasItem)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
if(slotID != 0 && slotID != 1 && slotID != 2)
{
if(!mergeItemStack(slotStack, 3, 4, false))
if(!mergeItemStack(slotStack, 0, 3, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
{
return null;
}

View file

@ -156,7 +156,7 @@ public class ContainerMetallurgicInfuser extends Container
{
if(tileEntity.type != null)
{
if(RecipeHandler.getOutput(InfusionInput.getInfusion(tileEntity.type, tileEntity.infuseStored, itemStack), false) != null)
if(RecipeHandler.getMetallurgicInfuserOutput(InfusionInput.getInfusion(tileEntity.type, tileEntity.infuseStored, itemStack), false) != null)
{
return true;
}

View file

@ -1,7 +1,12 @@
package mekanism.common.tileentity;
import mekanism.api.gas.GasStack;
public class TileEntityChemicalInfuser extends TileEntityElectricBlock
{
public GasStack leftStack;
public GasStack rightStack;
public TileEntityChemicalInfuser()
{
super("ChemicalInfuser", 0 /*TODO*/);

View file

@ -226,7 +226,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
{
if(type != null)
{
if(RecipeHandler.getOutput(InfusionInput.getInfusion(type, infuseStored, itemstack), false) != null)
if(RecipeHandler.getMetallurgicInfuserOutput(InfusionInput.getInfusion(type, infuseStored, itemstack), false) != null)
{
return true;
}
@ -257,7 +257,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
return;
}
InfusionOutput output = RecipeHandler.getOutput(InfusionInput.getInfusion(type, infuseStored, inventory[2]), true);
InfusionOutput output = RecipeHandler.getMetallurgicInfuserOutput(InfusionInput.getInfusion(type, infuseStored, inventory[2]), true);
infuseStored -= output.getInfuseRequired();
@ -284,7 +284,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
return false;
}
InfusionOutput output = RecipeHandler.getOutput(InfusionInput.getInfusion(type, infuseStored, inventory[2]), false);
InfusionOutput output = RecipeHandler.getMetallurgicInfuserOutput(InfusionInput.getInfusion(type, infuseStored, inventory[2]), false);
if(output == null)
{