Created two tank prefabs
This commit is contained in:
parent
68d725912b
commit
b41be74dec
2 changed files with 96 additions and 0 deletions
58
src/dark/core/prefab/fluids/FilteredTank.java
Normal file
58
src/dark/core/prefab/fluids/FilteredTank.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
package dark.core.prefab.fluids;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/** Tank that has a filter on the fluid ids it will accept
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class FilteredTank extends FluidTank
|
||||
{
|
||||
private List<Integer> fluidIds = new ArrayList<Integer>();
|
||||
boolean gas = true;
|
||||
boolean liquid = true;
|
||||
|
||||
public FilteredTank(int capacity, int... fluidIds)
|
||||
{
|
||||
this(capacity, true, true, fluidIds);
|
||||
}
|
||||
|
||||
public FilteredTank(int capacity, boolean gas, boolean liquid, int... fluidIds)
|
||||
{
|
||||
super(capacity);
|
||||
this.gas = gas;
|
||||
this.liquid = liquid;
|
||||
for (int id : fluidIds)
|
||||
{
|
||||
this.fluidIds.add(id);
|
||||
}
|
||||
}
|
||||
|
||||
public FilteredTank(FluidStack stack, int capacity)
|
||||
{
|
||||
super(stack, capacity);
|
||||
}
|
||||
|
||||
public FilteredTank(Fluid fluid, int amount, int capacity)
|
||||
{
|
||||
super(fluid, amount, capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource != null && resource.getFluid() != null && (!gas || gas && resource.getFluid().isGaseous()) && (!liquid || liquid && !resource.getFluid().isGaseous()))
|
||||
{
|
||||
if (fluidIds.contains(resource.fluidID))
|
||||
{
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
38
src/dark/core/prefab/fluids/LiquidTank.java
Normal file
38
src/dark/core/prefab/fluids/LiquidTank.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package dark.core.prefab.fluids;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/** Version of the fluid tank that only supports liquids
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class LiquidTank extends FluidTank
|
||||
{
|
||||
|
||||
public LiquidTank(int capacity)
|
||||
{
|
||||
super(capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(FluidStack stack, int capacity)
|
||||
{
|
||||
super(stack, capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(Fluid fluid, int amount, int capacity)
|
||||
{
|
||||
super(fluid, amount, capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource != null && resource.getFluid() != null && !resource.getFluid().isGaseous())
|
||||
{
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue