Created a simple Selective fluid tank prefab
Still need to do more work to make it selective when working with non FM blocks. Right now it simple contains a basic fluid allow list.
This commit is contained in:
parent
8f15c5357c
commit
48c24356d9
1 changed files with 60 additions and 0 deletions
60
src/dark/core/prefab/FluidSelectiveTank.java
Normal file
60
src/dark/core/prefab/FluidSelectiveTank.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package dark.core.prefab;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/** Selective fluid version of the FluidTank
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class FluidSelectiveTank extends FluidTank
|
||||
{
|
||||
protected List<Fluid> fluidList = new ArrayList<Fluid>();
|
||||
|
||||
public FluidSelectiveTank(int capacity)
|
||||
{
|
||||
super(capacity);
|
||||
}
|
||||
|
||||
public FluidSelectiveTank(FluidStack stack, int capacity)
|
||||
{
|
||||
super(stack, capacity);
|
||||
}
|
||||
|
||||
public FluidSelectiveTank(Fluid fluid, int amount, int capacity)
|
||||
{
|
||||
super(fluid, amount, capacity);
|
||||
}
|
||||
|
||||
public FluidSelectiveTank setFluidList(List<Fluid> fluid)
|
||||
{
|
||||
this.fluidList = fluid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluidSelectiveTank addFluidToList(Fluid fluid)
|
||||
{
|
||||
if (fluid != null)
|
||||
{
|
||||
this.getList().add(fluid);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Fluid> getList()
|
||||
{
|
||||
if (this.fluidList == null)
|
||||
{
|
||||
this.fluidList = new ArrayList<Fluid>();
|
||||
}
|
||||
return this.fluidList;
|
||||
}
|
||||
|
||||
public boolean canAcceptFluid(Fluid fluid)
|
||||
{
|
||||
return fluid != null && this.getList().contains(fluid);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue