1e5c47ad3f
Moved some stuff around, and made LiquidHandler able to be used in the api folder to help other people work with this mod. The api is not actual needed to work with this mod but it contains helpers to make life easier. Also added a method to LiquidHandler to get the name of a LiquidStack which for some reason can't be directly gotten from the liquidStack itself. Too get it i had to iterate over the hashMap used to store liquids. If the LiquidStack is linked to a LiquidData it will use the LiquidData name first. Also removed PipeInstance since its not actual needed anymore now that PipeColor is directly linked the pipe as well as the PipeBlock metadata.
46 lines
1.1 KiB
Java
46 lines
1.1 KiB
Java
package liquidmechanics.api.helpers;
|
|
|
|
import net.minecraftforge.liquids.LiquidStack;
|
|
|
|
public class LiquidData
|
|
{
|
|
private boolean isAGas;
|
|
private int defaultPressure;
|
|
private LiquidStack sampleStack;
|
|
private String name;
|
|
private PipeColor color;
|
|
|
|
public LiquidData(String name, LiquidStack stack,PipeColor color, boolean gas, int dPressure)
|
|
{
|
|
this.sampleStack = stack;
|
|
this.isAGas = gas;
|
|
this.defaultPressure = dPressure;
|
|
this.name = name;
|
|
this.color = color;
|
|
}
|
|
|
|
public String getName()
|
|
{
|
|
if (name != null || !name.equalsIgnoreCase("")) { return name; }
|
|
return "unknown";
|
|
}
|
|
public int getPressure()
|
|
{
|
|
return defaultPressure;
|
|
}
|
|
public LiquidStack getStack()
|
|
{
|
|
if (sampleStack != null) { return sampleStack; }
|
|
return new LiquidStack(0,1);
|
|
}
|
|
public boolean getCanFloat()
|
|
{
|
|
return isAGas;
|
|
}
|
|
public PipeColor getColor()
|
|
{
|
|
if (color != null) { return color; }
|
|
return PipeColor.NONE;
|
|
}
|
|
|
|
}
|