Started up on redoing arch's gas system

Not that it was bad archadia but we have the fluid system which i'm
using. Though to help out a bit i took your gas and made it extend the
fluid class. This way you can create gas fluid faster. As well i started
to create an enum to store all the gases with extended element data.
Later on this will allow use to do advanced features like gas increasing
pressure when heated.
This commit is contained in:
DarkGuardsman 2013-11-08 03:55:55 -05:00
parent e57ea196a2
commit fb58861207
5 changed files with 110 additions and 8 deletions

View file

@ -0,0 +1,30 @@
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));
/** Formula */
public final String formula;
/** IUPAC ID */
public final String compoundName;
/** g/mol */
public final float molarMass;
/** g/cm³ */
public final float density;
public final MatterPhase defaultPhase;
public final HeatingData heatingData;
private ChemicalCompound(String name, String formula, MatterPhase phase, float molarMass, float density, HeatingData data)
{
this.compoundName = name;
this.formula = formula;
this.molarMass = molarMass;
this.density = density;
this.defaultPhase = phase;
this.heatingData = data;
}
}

View file

@ -40,6 +40,17 @@ public class FormulaHelper
return mass * acceleration;
}
/** Gets the number of moles of the object from the mass of the object, and the materials
* molarMass
*
* @param molarMass - mass of one mole of the material
* @param objectMass - mass of the object made of the material
* @return number of moles of the material */
public static float moles(float molarMass, float objectMass)
{
return objectMass / molarMass;
}
/** Calculates change from original value to new value
*
* @param a - original value

View file

@ -14,8 +14,7 @@ public class HeatingData
public float fisionHeat;
/** (kJ/mol) Energy per gram needed to make the final leap from liquid to gas */
public float vaporHeat;
/** (j/kg K) Rate at which the material heats at in its default matter stage. This does change
* per phase */
/** (j/kg K) Heating rate, at constant volume if gas */
public float specificHeat;
/** How much the material expands */
public float thermalExpasion;

View file

@ -0,0 +1,45 @@
package dark.core.prefab.gas;
import com.builtbroken.common.science.ChemElement;
import com.builtbroken.common.science.ChemicalCompound;
/** Enum of gases used to create all the gas fluids
*
* @author DarkGuardsman */
public enum EnumGas
{
C2O("Carbon DiOxide"),
O2("Oxygen"),
C4H10(ChemicalCompound.BUTANE),
METHANE("Methane"),
NATURAL_GAS("Natural Gas"),
PROPANE("Propane");
/** Name used when creating this as a fluid */
final String fluidName;
/** Name used to display to the players */
final String name;
/** Object data reference that was used to create this gas, can be a ChemicalCompound, Element,
* or Fluid */
final Object data;
private EnumGas(String name)
{
this.fluidName = "gas:" + name.replace(" ", "").toLowerCase();
this.name = name;
data = null;
}
private EnumGas(ChemicalCompound compound)
{
this.fluidName = "gas:" + compound.compoundName.replace(" ", "").toLowerCase();
this.name = compound.compoundName;
data = compound;
}
private EnumGas(ChemElement element)
{
this.fluidName = "gas:" + element.elementName.replace(" ", "").toLowerCase();
this.name = element.elementName;
data = element;
}
}

View file

@ -0,0 +1,17 @@
package dark.core.prefab.gas;
import net.minecraftforge.fluids.Fluid;
/** These is an extension of the Fluid system forcing it to be a gas on creation
*
* @author Archadia, DarkGuardsman */
public class Gas extends Fluid
{
public Gas(String name)
{
super(name);
this.isGaseous = true;
this.density = -1000;
}
}