diff options
Diffstat (limited to 'ihl/processing')
8 files changed, 656 insertions, 762 deletions
diff --git a/ihl/processing/chemistry/ChemicalReactorTileEntity.java b/ihl/processing/chemistry/ChemicalReactorTileEntity.java index cec4177..ea3427c 100644 --- a/ihl/processing/chemistry/ChemicalReactorTileEntity.java +++ b/ihl/processing/chemistry/ChemicalReactorTileEntity.java @@ -230,7 +230,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl if(te instanceof CryogenicDistillerTileEntity)
{
CryogenicDistillerTileEntity cgte = (CryogenicDistillerTileEntity)te;
- cgte.fill(ForgeDirection.getOrientation(this.getFacing()), recipeInput.getFluidInputs().get(1).getInputs().get(0), true);
+ cgte.fill(ForgeDirection.getOrientation(this.getFacing()).getOpposite(), recipeInput.getFluidInputs().get(0).getInputs().get(0), true);
}
}
this.fluidTank.drain(recipeInput.getFluidInputs(), true);
diff --git a/ihl/processing/chemistry/CryogenicDistillerGui.java b/ihl/processing/chemistry/CryogenicDistillerGui.java index 3fbbfa4..2bfd969 100644 --- a/ihl/processing/chemistry/CryogenicDistillerGui.java +++ b/ihl/processing/chemistry/CryogenicDistillerGui.java @@ -2,7 +2,9 @@ package ihl.processing.chemistry; import org.lwjgl.opengl.GL11;
+import ic2.core.IC2;
import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
@@ -15,43 +17,55 @@ public class CryogenicDistillerGui extends GuiContainer { super(latheContainer);
container = latheContainer;
}
-
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- int xOffset = (this.width - xSize) / 2;
- int yOffset = (this.height - ySize) / 2;
-
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.renderEngine.bindTexture(tex);
- int i1;
- if (this.container.tileEntity.getEnergy() > 0D)
- {
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F);
- i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
- this.drawTexturedModalRect(9, 15 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
- }
- if (this.container.tileEntity.progress > 0)
- {
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18),18);
- this.drawTexturedModalRect(81, 35, 198, 0, i1 + 1, 13);
- }
- if (this.container.tileEntity.fluidTankProducts.getFluid()!=null && this.container.tileEntity.fluidTankProducts.getFluidAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankProducts, 125, 28, 137, 67, zLevel, par1, par2, xOffset, yOffset);
- }
- }
-
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2,
- int par3) {
- //draw your Gui here, only thing you need to change is the path
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.renderEngine.bindTexture(tex);
- int x = (width - xSize) / 2;
- int y = (height - ySize) / 2;
- this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
- }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void initGui() {
+ super.initGui();
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.buttonList.add(new GuiButton(0, x + 7, y + 49, 49, 20, "Empty"));
+ }
+
+ @Override
+ public void actionPerformed(GuiButton button) {
+ super.actionPerformed(button);
+ IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, button.id);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(9, 15 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18), 18);
+ this.drawTexturedModalRect(81, 35, 198, 0, i1 + 1, 13);
+ }
+ if (this.container.tileEntity.fluidTankProducts.getFluid() != null
+ && this.container.tileEntity.fluidTankProducts.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankProducts, 125, 28, 137, 67,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
}
diff --git a/ihl/processing/chemistry/CryogenicDistillerTileEntity.java b/ihl/processing/chemistry/CryogenicDistillerTileEntity.java index 5a0194f..1ed4e36 100644 --- a/ihl/processing/chemistry/CryogenicDistillerTileEntity.java +++ b/ihl/processing/chemistry/CryogenicDistillerTileEntity.java @@ -1,9 +1,9 @@ package ihl.processing.chemistry;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import ic2.core.ContainerBase;
import ic2.core.block.invslot.InvSlot;
@@ -16,7 +16,6 @@ import ihl.recipes.UniversalRecipeManager; import ihl.recipes.UniversalRecipeOutput;
import ihl.utils.IHLFluidTank;
import ihl.utils.IHLUtils;
-import net.minecraft.block.Block;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -24,195 +23,154 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-public class CryogenicDistillerTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler{
+public class CryogenicDistillerTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler {
- public final InvSlotConsumableLiquidIHL fillInputSlotInput;
- public final InvSlotOutput fluidItemsSlot;
- public final InvSlotConsumableLiquidIHL fillInputSlotProducts;
+ public final InvSlotConsumableLiquidIHL fillInputSlotInput;
+ public final InvSlotOutput fluidItemsSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlotProducts;
- private int processTimer=0;
private IHLFluidTank fluidTankInput = new IHLFluidTank(8000);
public IHLFluidTank fluidTankProducts = new IHLFluidTank(8000);
protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("cryogenicdistiller");
- public CryogenicDistillerTileEntity()
- {
+ public CryogenicDistillerTileEntity() {
super();
- this.fillInputSlotInput = new InvSlotConsumableLiquidIHL(this, "fillInputSlotInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
- this.fillInputSlotProducts = new InvSlotConsumableLiquidIHL(this, "fillInputSlotProducts", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotInput = new InvSlotConsumableLiquidIHL(this, "fillInputSlotInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotProducts = new InvSlotConsumableLiquidIHL(this, "fillInputSlotProducts", -1, InvSlot.Access.I,
+ 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
this.fluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 2);
}
-
+
@Override
public String getInventoryName() {
return "CryogenicDistiller";
}
-
- @Override
- public void updateEntityServer()
- {
- super.updateEntityServer();
- ForgeDirection dir = ForgeDirection.getOrientation(getFacing());
- if(this.processTimer++>20 && this.energy>=this.energyConsume)
- {
- this.energy-=this.energyConsume;
- this.processTimer=0;
- dir = dir.getOpposite();
- Block block = worldObj.getBlock(xCoord+dir.offsetX,yCoord+dir.offsetY,zCoord+dir.offsetZ);
- if(block!=null && block.isAir(worldObj, xCoord+dir.offsetX,yCoord+dir.offsetY,zCoord+dir.offsetZ) && this.fluidTankInput.getFluidAmount()<1000)
- {
- if(this.fluidTankInput.getFluid()==null || (this.fluidTankInput.getNumberOfFluids()<=1 && this.fluidTankInput.getFluid().getFluid()==FluidRegistry.getFluid("air")))
- {
- this.fluidTankInput.fill(IHLUtils.getFluidStackWithSize("air", 1000-(this.fluidTankInput.getFluid()!=null?this.fluidTankInput.getFluid().amount:0)),true);
- }
- }
- TileEntity teOnTop = worldObj.getTileEntity(xCoord, yCoord+1, zCoord);
- if(teOnTop instanceof IFluidHandler && this.fluidTankProducts.getLigthestFluid()!=null)
- {
- IFluidHandler topFH = (IFluidHandler)teOnTop;
- if(topFH.canFill(ForgeDirection.DOWN, this.fluidTankProducts.getLigthestFluid().getFluid()))
- {
- FluidStack fsToDrain = this.fluidTankProducts.getLigthestFluid().copy();
- fsToDrain.amount=topFH.fill(ForgeDirection.DOWN, fsToDrain, true);
- this.fluidTankProducts.drain(fsToDrain, true);
- }
- }
- ForgeDirection orientation = ForgeDirection.getOrientation(this.getFacing());
- TileEntity teOnFront = worldObj.getTileEntity(xCoord+orientation.offsetX, yCoord, zCoord+orientation.offsetZ);
- if(teOnFront instanceof IFluidHandler && this.fluidTankProducts.getFluid()!=null)
- {
- IFluidHandler frontFH = (IFluidHandler)teOnFront;
- if(frontFH.canFill(orientation, this.fluidTankProducts.getFluid().getFluid()))
- {
- FluidStack fsToDrain = this.fluidTankProducts.getFluid().copy();
- fsToDrain.amount=frontFH.fill(orientation, fsToDrain, true);
- this.fluidTankProducts.drain(fsToDrain, true);
- }
- }
- }
- IHLUtils.handleFluidSlotsBehaviour(fillInputSlotProducts, null, fluidItemsSlot, fluidTankProducts);
- }
-
+
+ @Override
+ public void updateEntityServer() {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotProducts, null, fluidItemsSlot, fluidTankProducts);
+ }
+
@Override
- public ItemStack getWrenchDrop(EntityPlayer player)
- {
+ public ItemStack getWrenchDrop(EntityPlayer player) {
return IHLUtils.getThisModItemStack("cryogenicDistiller");
}
-
+
@Override
@SideOnly(Side.CLIENT)
public GuiScreen getGui(EntityPlayer player, boolean arg1) {
return new CryogenicDistillerGui(new CryogenicDistillerContainer(player, this));
}
-
+
@Override
public ContainerBase<?> getGuiContainer(EntityPlayer player) {
return new CryogenicDistillerContainer(player, this);
}
-
- @Override
- public void operate()
- {
- if (!this.fillInputSlotInput.isEmpty() && this.fluidTankInput.getFluid().getFluid()==FluidRegistry.getFluid("air"))
- {
- IHLUtils.handleFluidSlotsBehaviour(fillInputSlotInput, null, fluidItemsSlot, fluidTankInput);
- }
- else
- {
- UniversalRecipeInput ri = CryogenicDistillerTileEntity.recipeManager.getRecipeInput(getInput());
- Iterator<FluidStack> listFluidOutputsIterator = getOutput().getFluidOutputs().iterator();
- while(listFluidOutputsIterator.hasNext())
- {
- this.fluidTankProducts.fill(listFluidOutputsIterator.next(), true);
- }
- this.fluidTankInput.drain(ri.getFluidInputs().get(0), true);
- }
- }
-
- public UniversalRecipeOutput getOutput()
- {
- return CryogenicDistillerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
-
+
+ @Override
+ public void operate() {
+ UniversalRecipeInput ri = CryogenicDistillerTileEntity.recipeManager.getRecipeInput(getInput());
+ this.fluidTankProducts.fill(getOutput().getFluidOutputs(), true);
+ this.fluidTankInput.drain(ri.getFluidInputs().get(0), true);
+ TileEntity teOnTop = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
+ if (teOnTop instanceof IFluidHandler && this.fluidTankProducts.getLigthestFluid() != null) {
+ IFluidHandler topFH = (IFluidHandler) teOnTop;
+ if (topFH.canFill(ForgeDirection.DOWN, this.fluidTankProducts.getLigthestFluid().getFluid())) {
+ FluidStack fsToDrain = this.fluidTankProducts.getLigthestFluid().copy();
+ fsToDrain.amount = topFH.fill(ForgeDirection.DOWN, fsToDrain, true);
+ this.fluidTankProducts.drain(fsToDrain, true);
+ }
+ }
+ ForgeDirection orientation = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity teOnFront = worldObj.getTileEntity(xCoord + orientation.offsetX, yCoord,
+ zCoord + orientation.offsetZ);
+ if (teOnFront instanceof IFluidHandler && this.fluidTankProducts.getFluid() != null) {
+ IFluidHandler frontFH = (IFluidHandler) teOnFront;
+ if (frontFH.canFill(orientation, this.fluidTankProducts.getFluid().getFluid())) {
+ FluidStack fsToDrain = this.fluidTankProducts.getFluid().copy();
+ fsToDrain.amount = frontFH.fill(orientation, fsToDrain, true);
+ this.fluidTankProducts.drain(fsToDrain, true);
+ }
+ }
+ }
+
+ public UniversalRecipeOutput getOutput() {
+ return CryogenicDistillerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ }
+
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
- public List[] getInput()
- {
- return new List [] {Arrays.asList(new FluidStack [] {this.fluidTankInput.getLigthestFluid()}),null};
+ public List[] getInput() {
+ return new List[] {Arrays.asList(new FluidStack[] {this.fluidTankInput.getLigthestFluid()}), null };
}
-
+
@Override
- public boolean canOperate()
- {
- return this.getOutput()!=null;
+ public boolean canOperate() {
+ return this.getOutput() != null;
}
@Override
- public void onGuiClosed(EntityPlayer arg0) {}
-
+ public void onGuiClosed(EntityPlayer arg0) {
+ }
+
@Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- this.fluidTankInput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankInput"));
- this.fluidTankProducts.readFromNBT(nbttagcompound.getCompoundTag("fluidTankProducts"));
- }
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTankInput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankInput"));
+ this.fluidTankProducts.readFromNBT(nbttagcompound.getCompoundTag("fluidTankProducts"));
+ }
@Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- NBTTagCompound fluidTankInputTag = new NBTTagCompound();
- this.fluidTankInput.writeToNBT(fluidTankInputTag);
- nbttagcompound.setTag("fluidTankInput", fluidTankInputTag);
- NBTTagCompound fluidTankProductsTag = new NBTTagCompound();
- this.fluidTankProducts.writeToNBT(fluidTankProductsTag);
- nbttagcompound.setTag("fluidTankProducts", fluidTankProductsTag);
- }
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankInputTag = new NBTTagCompound();
+ this.fluidTankInput.writeToNBT(fluidTankInputTag);
+ nbttagcompound.setTag("fluidTankInput", fluidTankInputTag);
+ NBTTagCompound fluidTankProductsTag = new NBTTagCompound();
+ this.fluidTankProducts.writeToNBT(fluidTankProductsTag);
+ nbttagcompound.setTag("fluidTankProducts", fluidTankProductsTag);
+ }
- public static void addRecipe(FluidStack input, FluidStack output, FluidStack output2, boolean specialCondition)
- {
- if(output2!=null)
- {
- recipeManager.addRecipe(new UniversalRecipeInput(new FluidStack[] {input},null), new UniversalRecipeOutput(new FluidStack[] {output,output2},null,20,specialCondition));
- }
- else
- {
- recipeManager.addRecipe(new UniversalRecipeInput(new FluidStack[] {input},null), new UniversalRecipeOutput(new FluidStack[] {output},null,20,specialCondition));
+ public static void addRecipe(FluidStack input, FluidStack output, FluidStack output2, boolean specialCondition) {
+ if (output2 != null) {
+ recipeManager.addRecipe(new UniversalRecipeInput(new FluidStack[] { input }, null),
+ new UniversalRecipeOutput(new FluidStack[] { output, output2 }, null, 20, specialCondition));
+ } else {
+ recipeManager.addRecipe(new UniversalRecipeInput(new FluidStack[] { input }, null),
+ new UniversalRecipeOutput(new FluidStack[] { output }, null, 20, specialCondition));
}
}
-
public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
return recipeManager.getRecipes();
}
-
- public boolean canProcess()
- {
- return this.energy>=this.maxStorage && this.fluidTankInput.getFluidAmount()<1000;
+
+ public boolean canProcess() {
+ return this.energy >= this.energyConsume;
}
@Override
public boolean canDrain(ForgeDirection dir, Fluid arg1) {
- return dir.getOpposite().equals(ForgeDirection.getOrientation(this.getFacing())) || dir.equals(ForgeDirection.UP);
+ return dir.equals(ForgeDirection.getOrientation(this.getFacing()))
+ || dir.equals(ForgeDirection.UP);
}
@Override
public boolean canFill(ForgeDirection dir, Fluid fluid) {
- return dir.equals(ForgeDirection.getOrientation(this.getFacing()));
+ return dir.equals(ForgeDirection.getOrientation(this.getFacing()).getOpposite());
}
@Override
public FluidStack drain(ForgeDirection dir, FluidStack fstack, boolean doDrain) {
- if(this.canDrain(dir, null))
- {
+ if (this.canDrain(dir, null)) {
return this.fluidTankProducts.drain(fstack, doDrain);
}
return null;
@@ -220,10 +178,8 @@ public class CryogenicDistillerTileEntity extends BasicElectricMotorTileEntity i @Override
public FluidStack drain(ForgeDirection dir, int amount, boolean doDrain) {
- if(this.canDrain(dir, null))
- {
- if(dir.equals(ForgeDirection.UP))
- {
+ if (this.canDrain(dir, null)) {
+ if (dir.equals(ForgeDirection.UP)) {
return this.fluidTankProducts.drainLightest(amount, doDrain);
}
return this.fluidTankProducts.drain(amount, doDrain);
@@ -232,20 +188,25 @@ public class CryogenicDistillerTileEntity extends BasicElectricMotorTileEntity i }
@Override
- public int fill(ForgeDirection dir, FluidStack fstack, boolean doFill)
- {
- if(fstack!=null && fstack.getFluid()!=null && this.canFill(dir, fstack.getFluid()))
- {
- this.fluidTankInput.drain(IHLUtils.getFluidStackWithSize("air", this.fluidTankInput.getCapacity()), true);
+ public int fill(ForgeDirection dir, FluidStack fstack, boolean doFill) {
+ if (fstack != null && fstack.getFluid() != null && this.canFill(dir, fstack.getFluid())) {
return this.fluidTankInput.fill(fstack, doFill);
}
return 0;
}
@Override
- public FluidTankInfo[] getTankInfo(ForgeDirection dir)
- {
- return new FluidTankInfo[] {this.fluidTankInput.getInfo(),this.fluidTankProducts.getInfo()};
+ public FluidTankInfo[] getTankInfo(ForgeDirection dir) {
+ return new FluidTankInfo[] { this.fluidTankInput.getInfo(), this.fluidTankProducts.getInfo() };
}
-
+
+ @Override
+ public void onNetworkEvent(EntityPlayer player, int event) {
+ switch (event) {
+ case 0:
+ this.fluidTankProducts.setEmpty();
+ break;
+ }
+ }
+
}
diff --git a/ihl/processing/chemistry/LabElectrolyzerTileEntity.java b/ihl/processing/chemistry/LabElectrolyzerTileEntity.java index 10feef6..f8c00ad 100644 --- a/ihl/processing/chemistry/LabElectrolyzerTileEntity.java +++ b/ihl/processing/chemistry/LabElectrolyzerTileEntity.java @@ -29,105 +29,102 @@ import ihl.recipes.UniversalRecipeOutput; import ihl.utils.IHLFluidTank;
import ihl.utils.IHLUtils;
-public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler
-{
+public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler {
private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("labelectrolyzer");
- public final IHLInvSlotOutput outputSlot;
- public final InvSlotConsumableLiquidIHL drainInputSlot;
- public final InvSlotConsumableLiquidIHL fillInputSlot;
- public final InvSlotConsumableLiquidIHL fillInputSlotAnodeOutput;
- public final InvSlotConsumableLiquidIHL fillInputSlotCathodeOutput;
- public final InvSlotOutput emptyFluidItemsSlot;
+ public final IHLInvSlotOutput outputSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlotAnodeOutput;
+ public final InvSlotConsumableLiquidIHL fillInputSlotCathodeOutput;
+ public final InvSlotOutput emptyFluidItemsSlot;
private final IHLFluidTank fluidTank = new IHLFluidTank(2000);
public final IHLFluidTank fluidTankAnodeOutput = new IHLFluidTank(8000);
public final IHLFluidTank fluidTankCathodeOutput = new IHLFluidTank(8000);
- public short temperature=20;
-
+ public short temperature = 20;
+
public LabElectrolyzerTileEntity() {
super();
- this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 2);
- this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
- this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
- this.fillInputSlotAnodeOutput = new InvSlotConsumableLiquidIHL(this, "fillInputAnodeOutput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
- this.fillInputSlotCathodeOutput = new InvSlotConsumableLiquidIHL(this, "fillInputCathodeOutput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.energyConsume *= 10;
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 2);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotAnodeOutput = new InvSlotConsumableLiquidIHL(this, "fillInputAnodeOutput", -1,
+ InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotCathodeOutput = new InvSlotConsumableLiquidIHL(this, "fillInputCathodeOutput", -1,
+ InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 3);
}
-
- @Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
- this.fluidTankAnodeOutput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankAnodeOutput"));
- this.fluidTankCathodeOutput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankCathodeOutput"));
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- NBTTagCompound fluidTankTag = new NBTTagCompound();
- this.fluidTank.writeToNBT(fluidTankTag);
- nbttagcompound.setTag("fluidTank", fluidTankTag);
-
- NBTTagCompound fluidTankAnodeTag = new NBTTagCompound();
- this.fluidTankAnodeOutput.writeToNBT(fluidTankAnodeTag);
- nbttagcompound.setTag("fluidTankAnodeOutput", fluidTankAnodeTag);
-
- NBTTagCompound fluidTankCathodeTag = new NBTTagCompound();
- this.fluidTankCathodeOutput.writeToNBT(fluidTankCathodeTag);
- nbttagcompound.setTag("fluidTankCathodeOutput", fluidTankCathodeTag);
- }
-
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ this.fluidTankAnodeOutput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankAnodeOutput"));
+ this.fluidTankCathodeOutput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankCathodeOutput"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+
+ NBTTagCompound fluidTankAnodeTag = new NBTTagCompound();
+ this.fluidTankAnodeOutput.writeToNBT(fluidTankAnodeTag);
+ nbttagcompound.setTag("fluidTankAnodeOutput", fluidTankAnodeTag);
+
+ NBTTagCompound fluidTankCathodeTag = new NBTTagCompound();
+ this.fluidTankCathodeOutput.writeToNBT(fluidTankCathodeTag);
+ nbttagcompound.setTag("fluidTankCathodeOutput", fluidTankCathodeTag);
+ }
+
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
- return this.getFacing()!=side;
+ return this.getFacing() != side;
}
-
+
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return IHLUtils.getThisModItemStack("labElectrolyzer");
}
-
- @Override
- public boolean enableUpdateEntity()
- {
- return IC2.platform.isSimulating();
- }
-
-
- @Override
- public void updateEntityServer()
- {
- super.updateEntityServer();
- IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
- IHLUtils.handleFluidSlotsBehaviour(fillInputSlotAnodeOutput, null, emptyFluidItemsSlot, fluidTankAnodeOutput);
- IHLUtils.handleFluidSlotsBehaviour(fillInputSlotCathodeOutput, null, emptyFluidItemsSlot, fluidTankCathodeOutput);
- }
-
- @Override
- public FluidStack drain(ForgeDirection direction, int amount, boolean doDrain)
- {
- if(this.canDrain(direction, null))
- {
- if(direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP)))
- {
- return this.fluidTankAnodeOutput.drain(amount, doDrain);
- }
- if(direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN)))
- {
- return this.fluidTankCathodeOutput.drain(amount, doDrain);
- }
+
+ @Override
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer() {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotAnodeOutput, null, emptyFluidItemsSlot, fluidTankAnodeOutput);
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotCathodeOutput, null, emptyFluidItemsSlot,
+ fluidTankCathodeOutput);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection direction, int amount, boolean doDrain) {
+ if (this.canDrain(direction, null)) {
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP))) {
+ return this.fluidTankAnodeOutput.drain(amount, doDrain);
+ }
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN))) {
+ return this.fluidTankCathodeOutput.drain(amount, doDrain);
+ }
return this.fluidTank.drain(amount, doDrain);
- }
- return null;
- }
+ }
+ return null;
+ }
-
- //1.7.10 API
+ // 1.7.10 API
@Override
public boolean canDrain(ForgeDirection direction, Fluid arg1) {
- return direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP))||direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN))||direction.equals(ForgeDirection.DOWN);
+ return direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP))
+ || direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN))
+ || direction.equals(ForgeDirection.DOWN);
}
@Override
@@ -139,12 +136,11 @@ public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity impl public String getInventoryName() {
return "labElectrolizer";
}
-
- @Override
- public int gaugeProgressScaled(int i)
- {
- return this.progress * i / operationLength;
- }
+
+ @Override
+ public int gaugeProgressScaled(int i) {
+ return this.progress * i / operationLength;
+ }
@Override
@SideOnly(Side.CLIENT)
@@ -153,64 +149,58 @@ public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity impl }
@Override
- public ContainerBase<?> getGuiContainer(EntityPlayer player)
- {
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
this.fluidTank.sortFluidsByDensity();
return new LabElectrolyzerContainer(player, this);
}
@Override
- public void onGuiClosed(EntityPlayer player) {}
-
- @Override
- public boolean canOperate()
- {
- UniversalRecipeOutput output = getOutput();
- if(output!=null)
- {
- if(getOutput().getItemOutputs()!=null && !getOutput().getItemOutputs().isEmpty() && getOutput().getItemOutputs().get(0)!=null)
- {
- return this.outputSlot.canAdd(getOutput().getItemOutputs());
- }
- else
- {
- return this.fluidTankAnodeOutput.getFluidAmount()<this.fluidTankAnodeOutput.getCapacity() && this.fluidTankAnodeOutput.getFluidAmount()<this.fluidTankCathodeOutput.getCapacity();
- }
- }
- return false;
- }
-
- public UniversalRecipeOutput getOutput()
- {
- return LabElectrolyzerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
+ public void onGuiClosed(EntityPlayer player) {
+ }
+
+ @Override
+ public boolean canOperate() {
+ UniversalRecipeOutput output = getOutput();
+ if (output != null) {
+ if (getOutput().getItemOutputs() != null && !getOutput().getItemOutputs().isEmpty()
+ && getOutput().getItemOutputs().get(0) != null) {
+ return this.outputSlot.canAdd(getOutput().getItemOutputs());
+ } else {
+ return this.fluidTankAnodeOutput.getFluidAmount() < this.fluidTankAnodeOutput.getCapacity()
+ && this.fluidTankAnodeOutput.getFluidAmount() < this.fluidTankCathodeOutput.getCapacity();
+ }
+ }
+ return false;
+ }
+
+ public UniversalRecipeOutput getOutput() {
+ return LabElectrolyzerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ }
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public List[] getInput()
- {
- return new List[]{Arrays.asList(new FluidStack[]{fluidTank.getFluid()}),null};
+ public List[] getInput() {
+ return new List[] { Arrays.asList(new FluidStack[] { fluidTank.getFluid() }), null };
}
-
+
@Override
- public void operate()
- {
+ public void operate() {
UniversalRecipeInput recipeInput = LabElectrolyzerTileEntity.recipeManager.getRecipeInput(getInput());
UniversalRecipeOutput output1 = getOutput();
this.fluidTank.drain(recipeInput.getFluidInputs().get(0), true);
- if(output1.getFluidOutputs().size()>0)this.fluidTankAnodeOutput.fill(output1.getFluidOutputs().get(0).copy(), true);
- if(output1.getFluidOutputs().size()>1)this.fluidTankCathodeOutput.fill(output1.getFluidOutputs().get(1).copy(), true);
- if(!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0)!=null)this.outputSlot.add(output1.getItemOutputs());
+ if (output1.getFluidOutputs().size() > 0)
+ this.fluidTankAnodeOutput.fill(output1.getFluidOutputs().get(0).copy(), true);
+ if (output1.getFluidOutputs().size() > 1)
+ this.fluidTankCathodeOutput.fill(output1.getFluidOutputs().get(1).copy(), true);
+ if (!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0) != null)
+ this.outputSlot.add(output1.getItemOutputs());
}
@Override
- public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
- if(this.fluidTankAnodeOutput.getFluid().containsFluid(fluidStack))
- {
+ public FluidStack drain(ForgeDirection direction, FluidStack fluidStack, boolean doDrain) {
+ if (this.fluidTankAnodeOutput.getFluid().containsFluid(fluidStack)) {
return this.fluidTankAnodeOutput.drain(fluidStack.amount, doDrain);
- }
- if(this.fluidTankCathodeOutput.getFluid().containsFluid(fluidStack))
- {
+ } else if (this.fluidTankCathodeOutput.getFluid().containsFluid(fluidStack)) {
return this.fluidTankCathodeOutput.drain(fluidStack.amount, doDrain);
}
return null;
@@ -222,36 +212,39 @@ public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity impl }
@Override
- public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
- return new FluidTankInfo[] {this.fluidTank.getInfo()};
+ public FluidTankInfo[] getTankInfo(ForgeDirection direction) {
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP))) {
+ return new FluidTankInfo[] { this.fluidTankAnodeOutput.getInfo() };
+ }
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN))) {
+ return new FluidTankInfo[] { this.fluidTankCathodeOutput.getInfo() };
+ }
+ return new FluidTankInfo[] { this.fluidTank.getInfo() };
+
+ }
+
+ public boolean needsFluid() {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank() {
+ return this.fluidTank.getFluid();
}
-
- public boolean needsFluid()
- {
- return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
- }
-
- public FluidStack getFluidStackfromTank()
- {
- return this.fluidTank.getFluid();
- }
-
- public int getTankAmount()
- {
+
+ public int getTankAmount() {
return this.fluidTank.getFluidAmount();
}
-
- public int gaugeLiquidScaled(int i, int index)
- {
- return this.fluidTank.getFluidAmount() <= 0 ? 0 : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
- }
- public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output)
- {
+
+ public int gaugeLiquidScaled(int i, int index) {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0
+ : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output) {
recipeManager.addRecipe(input, output);
}
- public int getNumberOfFluidsInTank()
- {
+ public int getNumberOfFluidsInTank() {
return this.fluidTank.getNumberOfFluids();
}
@@ -259,20 +252,20 @@ public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity impl return recipeManager.getRecipes();
}
- public static void addRecipe(FluidStack fluidStackInput1, FluidStack fluidStackOutputAnode, FluidStack fluidStackOutputCathode, ItemStack itemStackOutput1)
- {
- if(itemStackOutput1!=null)
- {
- addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1}), null), new UniversalRecipeOutput((new FluidStack[] {fluidStackOutputAnode, fluidStackOutputCathode}), (new ItemStack[] {itemStackOutput1}),200));
- }
- else
- {
- addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1}), null), new UniversalRecipeOutput((new FluidStack[] {fluidStackOutputAnode, fluidStackOutputCathode}), null,200));
+ public static void addRecipe(FluidStack fluidStackInput1, FluidStack fluidStackOutputAnode,
+ FluidStack fluidStackOutputCathode, ItemStack itemStackOutput1) {
+ if (itemStackOutput1 != null) {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] { fluidStackInput1 }), null),
+ new UniversalRecipeOutput((new FluidStack[] { fluidStackOutputAnode, fluidStackOutputCathode }),
+ (new ItemStack[] { itemStackOutput1 }), 200));
+ } else {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] { fluidStackInput1 }), null),
+ new UniversalRecipeOutput((new FluidStack[] { fluidStackOutputAnode, fluidStackOutputCathode }),
+ null, 200));
}
}
- public IHLFluidTank getFluidTank()
- {
+ public IHLFluidTank getFluidTank() {
return this.fluidTank;
}
diff --git a/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java b/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java index 0c1b75f..5709cb9 100644 --- a/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java +++ b/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java @@ -20,28 +20,28 @@ import net.minecraft.item.ItemStack; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-public class AchesonFurnanceTileEntity extends MachineBaseTileEntity{
+public class AchesonFurnanceTileEntity extends MachineBaseTileEntity {
- public final ApparatusProcessableInvSlot inputElectrode;
+ public final ApparatusProcessableInvSlot inputElectrode;
protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("achesonfurnace");
- private final RecipeInputOreDict[] validElectrodeTypes=new RecipeInputOreDict[] {new RecipeInputOreDict("stickCoal"),new RecipeInputOreDict("stickGraphite"),new RecipeInputOreDict("plateCoal"),new RecipeInputOreDict("plateGraphite")};
-
- public AchesonFurnanceTileEntity()
- {
+ private final RecipeInputOreDict[] validElectrodeTypes = new RecipeInputOreDict[] {
+ new RecipeInputOreDict("stickCoal"), new RecipeInputOreDict("stickGraphite"),
+ new RecipeInputOreDict("plateCoal"), new RecipeInputOreDict("plateGraphite") };
+
+ public AchesonFurnanceTileEntity() {
super(2);
inputElectrode = new ApparatusProcessableInvSlot(this, "inputElectrode", 1, Access.IO, 2, 1);
}
-
- public static void addRecipe(IRecipeInput input1, IRecipeInput input2, String output1)
- {
- recipeManager.addRecipe(new UniversalRecipeInput(null,new IRecipeInput [] {input1,input2}),new UniversalRecipeOutput(null,new ItemStack [] {IHLUtils.getThisModItemStack(output1)},20));
+
+ public static void addRecipe(IRecipeInput input1, IRecipeInput input2, String output1) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, new IRecipeInput[] { input1, input2 }),
+ new UniversalRecipeOutput(null, new ItemStack[] { IHLUtils.getThisModItemStack(output1) }, 20));
}
@Override
- public String getStartSoundFile()
- {
- return "Machines/Electro Furnace/ElectroFurnaceLoop.ogg";
- }
+ public String getStartSoundFile() {
+ return "Machines/Electro Furnace/ElectroFurnaceLoop.ogg";
+ }
@Override
public String getLoopSoundFile() {
@@ -68,80 +68,63 @@ public class AchesonFurnanceTileEntity extends MachineBaseTileEntity{ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
return new AchesonFurnanceContainer(player, this);
}
-
+
@Override
- public void operate()
- {
- List<RecipeOutputItemStack> output = AchesonFurnanceTileEntity.recipeManager.getOutputFor(getInput(), true, true).getItemOutputs();
- for(int i=0; i<this.inputElectrode.size();i++)
- {
+ public void operate() {
+ List<RecipeOutputItemStack> output = AchesonFurnanceTileEntity.recipeManager
+ .getOutputFor(getInput(), true, true).getItemOutputs();
+ for (int i = 0; i < this.inputElectrode.size(); i++) {
ItemStack electrodeIS = this.inputElectrode.get(i);
- if(this.validElectrodeTypes[0].matches(electrodeIS))
- {
+ if (this.validElectrodeTypes[0].matches(electrodeIS)) {
this.inputElectrode.put(i, IHLUtils.getThisModItemStack("stickGraphite"));
- }
- else if(this.validElectrodeTypes[2].matches(electrodeIS))
- {
+ } else if (this.validElectrodeTypes[2].matches(electrodeIS)) {
this.inputElectrode.put(i, IHLUtils.getThisModItemStack("plateGraphite"));
}
}
- for(int i=0; i<this.input.size();i++)
- {
- if(output.size()>i)
- {
+ for (int i = 0; i < this.input.size(); i++) {
+ if (output.size() > i) {
ItemStack stack = output.get(i).itemStack.copy();
- stack.stackSize=Math.round(output.get(i).quantity);
- this.input.put(i,stack);
+ stack.stackSize = Math.round(output.get(i).quantity);
+ this.input.put(i, stack);
}
- if(this.input.get(i)!=null && this.input.get(i).stackSize<=0)
- {
+ if (this.input.get(i) != null && this.input.get(i).stackSize <= 0) {
this.input.put(i, null);
}
}
- ItemStack crucible = input.getItemStack(IHLMod.crucible);
- if(crucible!=null)
- {
- ((Crucible)crucible.getItem()).processContent(crucible, this);
- }
+ ItemStack crucible = input.getItemStack(IHLMod.crucible);
+ if (crucible != null) {
+ ((Crucible) crucible.getItem()).processContent(crucible, this);
+ }
}
-
+
@Override
- public boolean canOperate()
- {
- return this.isValidElectrode(this.inputElectrode.get(0)) &&
- this.isValidElectrode(this.inputElectrode.get(1)) &&
- this.getOutput()!=null;
+ public boolean canOperate() {
+ return this.isValidElectrode(this.inputElectrode.get(0)) && this.isValidElectrode(this.inputElectrode.get(1))
+ && this.getOutput() != null;
}
-
+
@Override
- public List<?>[] getInput()
- {
- return new List[] {null, this.input.getItemStackList()};
+ public List<?>[] getInput() {
+ return new List[] { null, this.input.getItemStackList() };
}
-
public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
return recipeManager.getRecipes();
}
-
- @Override
- public UniversalRecipeOutput getOutput()
- {
- return AchesonFurnanceTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
-
- private boolean isValidElectrode(ItemStack stack)
- {
- if(stack!=null)
- {
- for(int i=0;i<this.validElectrodeTypes.length;i++)
- {
- if(validElectrodeTypes[i].matches(stack))
- {
- return true;
- }
- }
- }
- return false;
- }
+
+ @Override
+ public UniversalRecipeOutput getOutput() {
+ return AchesonFurnanceTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ }
+
+ private boolean isValidElectrode(ItemStack stack) {
+ if (stack != null) {
+ for (int i = 0; i < this.validElectrodeTypes.length; i++) {
+ if (validElectrodeTypes[i].matches(stack)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java index 47cfda9..a2fa219 100644 --- a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java +++ b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java @@ -21,125 +21,116 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
-public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBaseTileEntity implements IHasGui, INetworkClientTileEntityEventListener, IEnergySink{
+public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBaseTileEntity
+ implements IHasGui, INetworkClientTileEntityEventListener, IEnergySink {
- public final IHLInvSlotDischarge dischargeSlot;
+ public final IHLInvSlotDischarge dischargeSlot;
public short progress;
- protected short operationLength=600;
- protected final double energyConsume=0.1D;
- public double energy;
- public int maxStorage=128;
- private boolean addedToEnergyNet=false;
-
- public BasicElectricMotorTileEntity()
- {
+ protected short operationLength = 600;
+ protected double energyConsume = 1d;
+ public double energy;
+ public int maxStorage = 128;
+ private boolean addedToEnergyNet = false;
+
+ public BasicElectricMotorTileEntity() {
super();
dischargeSlot = new IHLInvSlotDischarge(this, 1, Access.IO, 4, InvSlot.InvSide.BOTTOM);
}
-
@Override
public String getInventoryName() {
return "Lathe";
}
-
- public boolean enableUpdateEntity()
- {
- return IC2.platform.isSimulating();
- }
-
- @Override
- public void onLoaded()
- {
- super.onLoaded();
- if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
- this.addedToEnergyNet = true;
- }
- }
-
- @Override
- public void onUnloaded()
- {
- if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
- this.addedToEnergyNet = false;
- }
-
- super.onUnloaded();
- }
-
-
+
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void onLoaded() {
+ super.onLoaded();
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ @Override
+ public void onUnloaded() {
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+
+ super.onUnloaded();
+ }
+
@SuppressWarnings("unchecked")
@Override
- public void setFacing(short facing1)
- {
+ public void setFacing(short facing1) {
short facing2 = (short) Math.max(facing1, 2);
- double d=0.3D;
- double f=-0.1D;
- if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
- this.addedToEnergyNet = false;
- }
+ double d = 0.3D;
+ double f = -0.1D;
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
double range = 2D;
- AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(connectionX-range,connectionY-range,connectionZ-range,connectionX+range,connectionY+range,connectionZ+range);
+ AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(connectionX - range, connectionY - range,
+ connectionZ - range, connectionX + range, connectionY + range, connectionZ + range);
List<NodeEntity> nodeList = worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea);
super.setFacing(facing2);
- switch(getFacing())
- {
- case 4:
- setConnectionX(this.xCoord+0.5D);
- setConnectionY(this.yCoord+d);
- setConnectionZ(this.zCoord+1D-f);
- break;
- case 5:
- setConnectionX(this.xCoord+0.5D);
- setConnectionY(this.yCoord+d);
- setConnectionZ(this.zCoord+f);
- break;
- case 2:
- setConnectionX(this.xCoord+1D-f);
- setConnectionY(this.yCoord+d);
- setConnectionZ(this.zCoord+0.5D);
- break;
- case 3:
- setConnectionX(this.xCoord+f);
- setConnectionY(this.yCoord+d);
- setConnectionZ(this.zCoord+0.5D);
- break;
- default:
- setConnectionX(this.xCoord+1D-f);
- setConnectionY(this.yCoord+d);
- setConnectionZ(this.zCoord+0.5D);
- break;
-
+ switch (getFacing()) {
+ case 4:
+ setConnectionX(this.xCoord + 0.5D);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 1D - f);
+ break;
+ case 5:
+ setConnectionX(this.xCoord + 0.5D);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + f);
+ break;
+ case 2:
+ setConnectionX(this.xCoord + 1D - f);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 0.5D);
+ break;
+ case 3:
+ setConnectionX(this.xCoord + f);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 0.5D);
+ break;
+ default:
+ setConnectionX(this.xCoord + 1D - f);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 0.5D);
+ break;
+
}
- if(!nodeList.isEmpty())
- {
+ if (!nodeList.isEmpty()) {
Iterator<NodeEntity> ei = nodeList.iterator();
- while(ei.hasNext())
- {
- NodeEntity ne= ei.next();
- if((ne.prevAnchorEntity==null||ne.nextAnchorEntity==null) && this.cableListContains(ne.getChainUniqueID()))
- {
- ne.setVirtualNodePos(connectionX,connectionY,connectionZ);
- }
- }
+ while (ei.hasNext()) {
+ NodeEntity ne = ei.next();
+ if ((ne.prevAnchorEntity == null || ne.nextAnchorEntity == null)
+ && this.cableListContains(ne.getChainUniqueID())) {
+ ne.setVirtualNodePos(connectionX, connectionY, connectionZ);
+ }
+ }
+ }
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
}
- if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
- this.addedToEnergyNet = true;
- }
}
-
+
@Override
- public double getDemandedEnergy()
- {
- return this.maxStorage-this.energy;
+ public double getDemandedEnergy() {
+ if(this.maxStorage - this.energy <= 1d)
+ {
+ return 0d;
+ }
+ return this.maxStorage - this.energy;
}
@Override
@@ -148,154 +139,126 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa }
@Override
- public double injectEnergy(ForgeDirection directionFrom, double amount,
- double voltage) {
- if(this.energy<this.maxStorage)
- {
- this.energy+=amount;
- return 0.0D;
- }
- else
- {
- return amount;
- }
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
+ if (this.energy < this.maxStorage) {
+ this.energy += amount;
+ return 0.0D;
+ } else {
+ return amount;
+ }
}
-
+
@Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
- {
- return this.getFacing()!=(short)side;
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing() != (short) side;
}
-
@Override
public void writeToNBT(NBTTagCompound nbt) {
- super.writeToNBT(nbt);
- nbt.setShort("progress", this.progress);
- nbt.setDouble("energy", this.energy);
+ super.writeToNBT(nbt);
+ nbt.setShort("progress", this.progress);
+ nbt.setDouble("energy", this.energy);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
- super.readFromNBT(nbt);
- this.progress = nbt.getShort("progress");
- this.energy=nbt.getDouble("energy");
+ super.readFromNBT(nbt);
+ this.progress = nbt.getShort("progress");
+ this.energy = nbt.getDouble("energy");
}
@Override
- public void onNetworkEvent(EntityPlayer player, int event)
- {
- switch(event)
- {
+ public void onNetworkEvent(EntityPlayer player, int event) {
+ switch (event) {
case 0:
break;
- }
+ }
}
-
+
public abstract void operate();
-
- @Override
- public void updateEntityServer()
- {
- if(this.getDemandedEnergy() > 1.0D)
- {
- double amount = this.dischargeSlot.discharge(this.getDemandedEnergy(), false);
- this.energy += amount;
- }
- if(this.gridID!=-1 && this.getGrid().energy>0D && this.energy<this.maxStorage)
- {
- this.energy+=energyConsume*10D;
- this.getGrid().drawEnergy(energyConsume*10D, this);
- }
- if (this.canOperate() && this.energy>=this.energyConsume)
- {
- this.energy-=this.energyConsume;
- if (this.progress == 0)
- {
- IC2.network.get().initiateTileEntityEvent(this, 0, true);
- }
- ++this.progress;
- if (this.progress >= this.operationLength)
- {
- this.operate();
- this.progress = 0;
- IC2.network.get().initiateTileEntityEvent(this, 2, true);
- }
- }
- else
- {
- if (this.progress != 0 && this.getActive())
- {
- IC2.network.get().initiateTileEntityEvent(this, 1, true);
- }
- if (!this.canOperate())
- {
- this.progress = 0;
- }
- }
-
- }
-
+
+ @Override
+ public void updateEntityServer() {
+ if (this.getDemandedEnergy() > 1.0D) {
+ double amount = this.dischargeSlot.discharge(this.getDemandedEnergy(), false);
+ this.energy += amount;
+ }
+ if (this.gridID != -1 && this.getGrid().energy > 0D && this.energy < this.maxStorage) {
+ this.energy += energyConsume * 10D;
+ this.getGrid().drawEnergy(energyConsume * 10D, this);
+ }
+ if (this.canOperate() && this.energy >= this.energyConsume) {
+ this.energy -= this.energyConsume;
+ if (this.progress == 0) {
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+ ++this.progress;
+ if (this.progress >= this.operationLength) {
+ this.operate();
+ this.progress = 0;
+ IC2.network.get().initiateTileEntityEvent(this, 2, true);
+ }
+ } else {
+ if (this.progress != 0 && this.getActive()) {
+ IC2.network.get().initiateTileEntityEvent(this, 1, true);
+ }
+ if (!this.canOperate()) {
+ this.progress = 0;
+ }
+ }
+
+ }
+
public abstract List<?>[] getInput();
+
public abstract boolean canOperate();
- @Override
- public void onGuiClosed(EntityPlayer arg0) {}
- public int getEnergy()
- {
- return (int)this.energy;
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {
}
+ public int getEnergy() {
+ return (int) this.energy;
+ }
public int getGUIEnergy(int i) {
- if(this.energy<Float.MAX_VALUE)
- {
- return Math.round((float)this.energy/this.maxStorage*i);
- }
- else
- {
- return Math.round((float)(this.energy/this.maxStorage)*i);
- }
+ if (this.energy < Float.MAX_VALUE) {
+ return Math.round((float) this.energy / this.maxStorage * i);
+ } else {
+ return Math.round((float) (this.energy / this.maxStorage) * i);
+ }
}
-
- public int gaugeProgressScaled(int i)
- {
- return this.progress * i / this.operationLength;
- }
-
- public void setEnergy(int value)
- {
- this.energy=value;
+ public int gaugeProgressScaled(int i) {
+ return this.progress * i / this.operationLength;
}
+ public void setEnergy(int value) {
+ this.energy = value;
+ }
@Override
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
return true;
}
-
+
@Override
- public double getMaxAllowableVoltage()
- {
+ public double getMaxAllowableVoltage() {
return 64000D;
}
-
+
@Override
- public double getEnergyAmountThisNodeWant()
- {
- return this.energy-this.maxStorage;
+ public double getEnergyAmountThisNodeWant() {
+ return this.energy - this.maxStorage;
}
-
- public double drawEnergyToGrid(double amount)
- {
+
+ public double drawEnergyToGrid(double amount) {
return 0d;
}
-
+
@Override
- public void injectEnergyInThisNode(double amount, double voltage)
- {
- this.energy+=amount;
+ public void injectEnergyInThisNode(double amount, double voltage) {
+ this.energy += amount;
}
}
diff --git a/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java b/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java index 40d44e4..e052ad7 100644 --- a/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java +++ b/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java @@ -9,6 +9,8 @@ import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.network.INetworkDataProvider;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputItemStack;
import ic2.api.tile.IWrenchable;
import ic2.core.IC2;
import ihl.items_blocks.FlexibleCableItem;
@@ -28,144 +30,127 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
-public class VulcanizationExtrudingMoldTileEntity extends TileEntity implements IWrenchable, INetworkDataProvider, IEnergySink, IProductionLine, IFluidHandler{
+public class VulcanizationExtrudingMoldTileEntity extends TileEntity
+ implements IWrenchable, INetworkDataProvider, IEnergySink, IProductionLine, IFluidHandler {
- private short facing=2;
- private short lastFacing=2;
- public double energy;
- public int maxStorage=64;
- private double energyConsume=16D;
- private boolean addedToEnergyNet=false;
+ private short facing = 2;
+ private short lastFacing = 2;
+ public double energy;
+ public int maxStorage = 64;
+ private double energyConsume = 16D;
+ private boolean addedToEnergyNet = false;
private FluidTank fluidTank = new FluidTank(5000);
- protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("vulcanizationextrudingmold");
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager(
+ "vulcanizationextrudingmold");
- public VulcanizationExtrudingMoldTileEntity()
- {
+ public VulcanizationExtrudingMoldTileEntity() {
super();
}
-
- public static void addRecipe(FluidStack inputFluid,ItemStack input,ItemStack output1)
- {
- recipeManager.addRecipe(new UniversalRecipeInput((new FluidStack[] {inputFluid}),(new ItemStack[] {input})),new UniversalRecipeOutput(null,(new ItemStack[] {output1}),200));
- }
-
- public boolean enableUpdateEntity()
- {
- return IC2.platform.isSimulating();
- }
-
- @Override
- public void invalidate()
- {
- if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
- this.addedToEnergyNet = false;
- }
- super.invalidate();
- }
-
+
+ public static void addRecipe(FluidStack inputFluid, ItemStack input, ItemStack output1) {
+ recipeManager.addRecipe(
+ new UniversalRecipeInput((new FluidStack[] { inputFluid }),
+ (new IRecipeInput[] { new RecipeInputItemStack(input) })),
+ new UniversalRecipeOutput(null, (new ItemStack[] { output1 }), 200));
+ }
+
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void invalidate() {
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ super.invalidate();
+ }
+
@Override
- public List<String> getNetworkedFields()
- {
- List<String> fields = new ArrayList();
+ public List<String> getNetworkedFields() {
+ List<String> fields = new ArrayList<String>();
fields.add("facing");
return fields;
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
- this.addedToEnergyNet = true;
- }
-
- if(lastFacing!=facing)
- {
+ }
+
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+
+ if (lastFacing != facing) {
IC2.network.get().updateTileEntityField(this, "facing");
- lastFacing=facing;
- }
- }
-
+ lastFacing = facing;
+ }
+ }
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
- return this.getFacing()!=side;
+ return this.getFacing() != side;
}
-
@Override
public short getFacing() {
return this.facing;
}
-
@Override
- public void setFacing(short facing1)
- {
- if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
- this.addedToEnergyNet = false;
- }
- facing=(short) Math.max(2,facing1);
- if(IC2.platform.isSimulating())
- {
+ public void setFacing(short facing1) {
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ facing = (short) Math.max(2, facing1);
+ if (IC2.platform.isSimulating()) {
IC2.network.get().updateTileEntityField(this, "facing");
- lastFacing=facing;
+ lastFacing = facing;
+ }
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
}
- if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
- this.addedToEnergyNet = true;
- }
}
-
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
-
@Override
public float getWrenchDropRate() {
return 1F;
}
-
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return IHLUtils.getThisModItemStack("vulcanizationExtrudingMold");
}
-
+
@Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
- facing=nbttagcompound.getShort("facing");
- energy=nbttagcompound.getDouble("energy");
- }
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ facing = nbttagcompound.getShort("facing");
+ energy = nbttagcompound.getDouble("energy");
+ }
@Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- NBTTagCompound fluidTankTag = new NBTTagCompound();
- this.fluidTank.writeToNBT(fluidTankTag);
- nbttagcompound.setTag("fluidTank", fluidTankTag);
- nbttagcompound.setShort("facing", facing);
- nbttagcompound.setDouble("energy", this.energy);
- }
-
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ nbttagcompound.setShort("facing", facing);
+ nbttagcompound.setDouble("energy", this.energy);
+ }
+
@Override
- public double getDemandedEnergy()
- {
- return this.maxStorage-this.energy;
+ public double getDemandedEnergy() {
+ return this.maxStorage - this.energy;
}
@Override
@@ -174,57 +159,52 @@ public class VulcanizationExtrudingMoldTileEntity extends TileEntity implements }
@Override
- public double injectEnergy(ForgeDirection directionFrom, double amount,
- double voltage) {
- if(this.energy<this.maxStorage)
- {
- this.energy+=amount;
- return 0.0D;
- }
- else
- {
- return amount;
- }
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
+ if (this.energy < this.maxStorage) {
+ this.energy += amount;
+ return 0.0D;
+ } else {
+ return amount;
+ }
}
@Override
- public boolean acceptsEnergyFrom(TileEntity emitter,
- ForgeDirection direction)
- {
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
return true;
}
private ItemStack processWire(ItemStack wire, boolean doProcess) {
- UniversalRecipeOutput rOutput = VulcanizationExtrudingMoldTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[] {this.fluidTank.getFluid()}),Arrays.asList(new ItemStack[] {wire}), false, false);
- if(rOutput==null || !(wire.getItem() instanceof FlexibleCableItem) || this.energy<this.energyConsume)
- {
+ UniversalRecipeOutput rOutput = VulcanizationExtrudingMoldTileEntity.recipeManager.getOutputFor(
+ Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }),
+ false, false);
+ if (rOutput == null || this.energy < this.energyConsume) {
return wire;
}
- UniversalRecipeInput rInput = VulcanizationExtrudingMoldTileEntity.recipeManager.getRecipeInput(Arrays.asList(new FluidStack[] {this.fluidTank.getFluid()}),Arrays.asList(new ItemStack[] {wire}));
+ UniversalRecipeInput rInput = VulcanizationExtrudingMoldTileEntity.recipeManager.getRecipeInput(
+ Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }));
ItemStack cableAsRO = rOutput.getItemOutputs().get(0).itemStack;
ItemStack cable = wire.copy();
FlexibleCableItem fci = (FlexibleCableItem) cableAsRO.getItem();
cable.stackTagCompound.setString("insulationMaterial", fci.getInsulationMaterial(cableAsRO));
cable.stackTagCompound.setInteger("insulationThickness", fci.getInsulationThickness(cableAsRO));
- cable.stackTagCompound.setInteger("maxVoltage", IHLUtils.getInsulationMaxVoltage(fci.getInsulationMaterial(cableAsRO), fci.getInsulationThickness(cableAsRO)));
- if(doProcess)
- {
- this.energy-=this.energyConsume;
- this.fluidTank.drain(rInput.getFluidInputs().get(0).getAmount()*IHLUtils.getWireLength(cable), true);
+ cable.stackTagCompound.setInteger("maxVoltage", IHLUtils
+ .getInsulationMaxVoltage(fci.getInsulationMaterial(cableAsRO), fci.getInsulationThickness(cableAsRO)));
+ if (doProcess) {
+ this.energy -= this.energyConsume;
+ this.fluidTank.drain(rInput.getFluidInputs().get(0).getAmount() * IHLUtils.getWireLength(cable), true);
}
return cable;
}
-
+
@Override
public boolean canProcess(ItemStack wire) {
- ItemStack cable = this.processWire(wire,false);
+ ItemStack cable = this.processWire(wire, false);
ForgeDirection dir = ForgeDirection.getOrientation(getFacing()).getRotation(ForgeDirection.UP);
- TileEntity te = worldObj.getTileEntity(xCoord+dir.offsetX,yCoord+dir.offsetY,zCoord+dir.offsetZ);
- if(te instanceof IProductionLine)
- {
- if(ForgeDirection.getOrientation(((IProductionLine)te).getFacing()).equals(dir.getRotation(ForgeDirection.DOWN)))
- {
- return ((IProductionLine)te).canProcess(cable);
+ TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
+ if (te instanceof IProductionLine) {
+ if (ForgeDirection.getOrientation(((IProductionLine) te).getFacing())
+ .equals(dir.getRotation(ForgeDirection.DOWN))) {
+ return ((IProductionLine) te).canProcess(cable);
}
}
return false;
@@ -232,12 +212,12 @@ public class VulcanizationExtrudingMoldTileEntity extends TileEntity implements @Override
public void process(ItemStack wire) {
- ItemStack cable = this.processWire(wire,true);
+ ItemStack cable = this.processWire(wire, true);
ForgeDirection dir = ForgeDirection.getOrientation(getFacing()).getRotation(ForgeDirection.UP);
- TileEntity te = worldObj.getTileEntity(xCoord+dir.offsetX,yCoord+dir.offsetY,zCoord+dir.offsetZ);
- if(te instanceof IProductionLine && ForgeDirection.getOrientation(((IProductionLine)te).getFacing()).equals(dir.getRotation(ForgeDirection.DOWN)))
- {
- ((IProductionLine)te).process(cable);
+ TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
+ if (te instanceof IProductionLine && ForgeDirection.getOrientation(((IProductionLine) te).getFacing())
+ .equals(dir.getRotation(ForgeDirection.DOWN))) {
+ ((IProductionLine) te).process(cable);
}
}
@@ -248,7 +228,7 @@ public class VulcanizationExtrudingMoldTileEntity extends TileEntity implements @Override
public boolean canFill(ForgeDirection arg0, Fluid arg1) {
- return ForgeDirection.getOrientation(this.facing)==arg0;
+ return ForgeDirection.getOrientation(this.facing) == arg0;
}
@Override
@@ -268,12 +248,10 @@ public class VulcanizationExtrudingMoldTileEntity extends TileEntity implements @Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
- // TODO Auto-generated method stub
- return null;
+ return new FluidTankInfo[] {this.fluidTank.getInfo()};
}
- public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes()
- {
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
return recipeManager.getRecipes();
}
}
diff --git a/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java b/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java index 31b6386..5c786c5 100644 --- a/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java +++ b/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.Map;
import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputItemStack;
+import ic2.api.recipe.RecipeInputOreDict;
import ic2.core.ContainerBase;
import ic2.core.IC2;
import ic2.core.block.invslot.InvSlot.Access;
@@ -132,9 +134,9 @@ public class WoodenRollingMachinePart1TileEntity extends BasicElectricMotorTileE @Override
public void onGuiClosed(EntityPlayer arg0) {}
- public static void addRecipe(ItemStack input, ItemStack input2, ItemStack input3, ItemStack output)
+ public static void addRecipe(RecipeInputItemStack recipeInputItemStack, RecipeInputItemStack recipeInputItemStack2, RecipeInputOreDict recipeInputOreDict, ItemStack output)
{
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] {input,input2,input3})), new UniversalRecipeOutput(null,(new ItemStack[] {output}),20));
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] {recipeInputItemStack,recipeInputItemStack2,recipeInputOreDict})), new UniversalRecipeOutput(null,(new ItemStack[] {output}),20));
}
@@ -142,9 +144,9 @@ public class WoodenRollingMachinePart1TileEntity extends BasicElectricMotorTileE return recipeManager.getRecipes();
}
- public static void addRecipe(ItemStack input, ItemStack input3, ItemStack output)
+ public static void addRecipe(RecipeInputOreDict recipeInputOreDict, RecipeInputOreDict recipeInputOreDict2, ItemStack output)
{
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] {input,input3})), new UniversalRecipeOutput(null,(new ItemStack[] {output}),20));
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] {recipeInputOreDict,recipeInputOreDict2})), new UniversalRecipeOutput(null,(new ItemStack[] {output}),20));
}
@Override
|
