mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Beginning Filtered Electrolytic
This commit is contained in:
1 parent
6db4759621
commit
b949940e96
2 files changed
+34
-17
No files matched your search
@@ -68,6 +68,14 @@ public class GuiElectrolyticSeparator extends GuiMekanism
|
||||
return tileEntity.fluidTank;
|
||||
}
|
||||
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
|
||||
|
||||
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() {
|
||||
@Override
|
||||
public FluidTank getTank()
|
||||
{
|
||||
return tileEntity.extraTank;
|
||||
}
|
||||
}, GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, 51));
|
||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||
@Override
|
||||
public GasTank getTank()
|
||||
@@ -88,6 +96,7 @@ public class GuiElectrolyticSeparator extends GuiMekanism
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 25, 34));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 51));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 51));
|
||||
if (tileEntity.hasFilter())
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, 34).with(SlotOverlay.POWER));
|
||||
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
|
||||
@@ -19,11 +19,7 @@ import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.base.*;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
@@ -67,6 +63,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||
/** The amount of hydrogen this block is storing. */
|
||||
public GasTank rightTank = new GasTank(MAX_GAS);
|
||||
|
||||
public FluidTank extraTank = new FluidTank(24000);
|
||||
|
||||
/** How fast this block can output gas. */
|
||||
public int output = 512;
|
||||
|
||||
@@ -102,6 +100,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||
{
|
||||
super("ElectrolyticSeparator", MachineType.ELECTROLYTIC_SEPARATOR.baseEnergy);
|
||||
inventory = new ItemStack[5];
|
||||
|
||||
upgradeComponent.setSupported(Upgrade.FILTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +133,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||
}
|
||||
|
||||
ChargeUtils.discharge(3, this);
|
||||
|
||||
|
||||
if(inventory[0] != null)
|
||||
{
|
||||
if(RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(inventory[0]))
|
||||
@@ -180,24 +180,28 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||
|
||||
SeparatorRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && getEnergy() >= energyPerTick && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
if(canOperate(recipe) && getEnergy() >= energyPerTick && MekanismUtils.canFunction(this)) {
|
||||
setActive(true);
|
||||
|
||||
boolean update = BASE_ENERGY_USAGE != recipe.energyUsage;
|
||||
|
||||
|
||||
BASE_ENERGY_USAGE = recipe.energyUsage;
|
||||
|
||||
if(update)
|
||||
{
|
||||
|
||||
if (update) {
|
||||
recalculateUpgradables(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
|
||||
int operations = operate(recipe);
|
||||
double prev = getEnergy();
|
||||
|
||||
setEnergy(getEnergy() - energyPerTick*operations);
|
||||
clientEnergyUsed = prev-getEnergy();
|
||||
|
||||
setEnergy(getEnergy() - energyPerTick * operations);
|
||||
clientEnergyUsed = prev - getEnergy();
|
||||
|
||||
if (hasFilter()){
|
||||
extraTank.fill(new FluidStack(FluidRegistry.getFluid("heavywater"), 5), true);
|
||||
if (extraTank.getFluid() != null)
|
||||
System.out.println("Capacity" + extraTank.getFluid().getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(prevEnergy >= getEnergy())
|
||||
@@ -285,6 +289,10 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||
|
||||
return Math.min(fluidTank.getFluidAmount()/recipe.recipeInput.ingredient.amount, possibleProcess);
|
||||
}
|
||||
public boolean hasFilter()
|
||||
{
|
||||
return upgradeComponent.getInstalledTypes().contains(Upgrade.FILTER);
|
||||
}
|
||||
|
||||
public SeparatorRecipe getRecipe()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user