diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2017-02-07 20:16:24 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2017-02-07 20:16:24 +0300 |
| commit | 2636ccdd67b5f33421ab7f9152021bc4ebc147b3 (patch) | |
| tree | bae55386c0a830ac74eeb5cd09ed7fa27ecc90dc /ihl/processing/chemistry/LabElectrolyzerTileEntity.java | |
| parent | 2db8e30b1d2151fdde5d08a6c06aef55f0c397d2 (diff) | |
Fixed an ore dictionary recipes of Iron workbench which using wrong set of items. Fixed wire recipe input. All recipes of Iron workbench now use fluid container input and will drop an empty container.
Diffstat (limited to 'ihl/processing/chemistry/LabElectrolyzerTileEntity.java')
| -rw-r--r-- | ihl/processing/chemistry/LabElectrolyzerTileEntity.java | 317 |
1 files changed, 155 insertions, 162 deletions
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;
}
|
