Worked on gases a bit more

This commit is contained in:
DarkGuardsman 2013-11-08 05:22:08 -05:00
parent fb58861207
commit 6d437b9f1e
3 changed files with 74 additions and 14 deletions

View file

@ -3,7 +3,10 @@ package com.builtbroken.common.science;
public enum ChemicalCompound
{
/** http://encyclopedia.airliquide.com/encyclopedia.asp?GasID=8#GeneralData */
BUTANE("butane", "C4H10", MatterPhase.gas, 58.12f, 2.48f, new HeatingData(133f, 274f, 1379.23f, 6634.23f, 88f));
BUTANE("Butane", "C4H10", MatterPhase.gas, 58.12f, 2.48f, new HeatingData(133f, 274f, 1379.23f, 6634.23f, 88f)),
METHANE("Methane", "CH4", MatterPhase.gas, 16.043f, 1.819f, new HeatingData(90.65f, 111.55f, 3656.67f, 31789.56f, 27f)),
WATER("Water", "H20", MatterPhase.liquid, 18.01528f, 1000f, new HeatingData(274.15f, 373.13f, 18539.817f, 126004.1476f, 4.24f)),
AIR("Air", "", MatterPhase.gas, 29f, .125f, null);
/** Formula */
public final String formula;

View file

@ -8,38 +8,60 @@ import com.builtbroken.common.science.ChemicalCompound;
* @author DarkGuardsman */
public enum EnumGas
{
C2O("Carbon DiOxide"),
O2("Oxygen"),
C4H10(ChemicalCompound.BUTANE),
METHANE("Methane"),
NATURAL_GAS("Natural Gas"),
PROPANE("Propane");
C2O("Carbon DiOxide", false),
O2(ChemElement.Oxygen, 2f, true),
C4H10(ChemicalCompound.BUTANE, true),
METHANE(ChemicalCompound.METHANE, true),
NATURAL_GAS("Natural Gas", false),
PROPANE("Propane", false);
/** Name used when creating this as a fluid */
final String fluidName;
public final String fluidName;
/** Name used to display to the players */
final String name;
public final String name;
/** Object data reference that was used to create this gas, can be a ChemicalCompound, Element,
* or Fluid */
final Object data;
public final Object data;
public boolean enabled = false;
/** Only used for elements since when used as a gas they sometimes bind together */
private float molePerGasMolecule = 1.0f;
/** Local instance of the gas used when the getGas method is called */
private Gas gas;
private EnumGas(String name)
private EnumGas(String name, boolean enabled)
{
this.fluidName = "gas:" + name.replace(" ", "").toLowerCase();
this.fluidName = name.replace(" ", "").toLowerCase();
this.name = name;
data = null;
this.enabled = enabled;
}
private EnumGas(ChemicalCompound compound)
private EnumGas(ChemicalCompound compound, boolean enabled)
{
this.fluidName = "gas:" + compound.compoundName.replace(" ", "").toLowerCase();
this.name = compound.compoundName;
data = compound;
this.enabled = enabled;
}
private EnumGas(ChemElement element)
private EnumGas(ChemElement element, float molesPerGasMolecule, boolean enabled)
{
this.fluidName = "gas:" + element.elementName.replace(" ", "").toLowerCase();
this.name = element.elementName;
data = element;
this.enabled = enabled;
this.molePerGasMolecule = molesPerGasMolecule;
}
public Gas getGas()
{
if (gas == null)
{
gas = new Gas(fluidName);
if (data instanceof ChemElement)
{
gas.setDensity((int) ((ChemElement) data).density);
}
}
return gas;
}
}

View file

@ -0,0 +1,35 @@
package dark.core.prefab.gas;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
/** Version of the fluid tank that is restricted to gases only */
public class GasTank extends FluidTank
{
public GasTank(int capacity)
{
super(capacity);
}
public GasTank(FluidStack stack, int capacity)
{
super(stack, capacity);
}
public GasTank(Fluid fluid, int amount, int capacity)
{
super(fluid, amount, capacity);
}
public int fill(FluidStack resource, boolean doFill)
{
if (resource != null && resource.getFluid() != null && resource.getFluid().isGaseous())
{
return super.fill(resource, doFill);
}
return 0;
}
}