From 48c24356d9da9ab28d906e59dd7d22fc9b6f3b93 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Tue, 10 Sep 2013 19:15:42 -0400 Subject: [PATCH] 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. --- src/dark/core/prefab/FluidSelectiveTank.java | 60 ++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/dark/core/prefab/FluidSelectiveTank.java diff --git a/src/dark/core/prefab/FluidSelectiveTank.java b/src/dark/core/prefab/FluidSelectiveTank.java new file mode 100644 index 00000000..fbf66897 --- /dev/null +++ b/src/dark/core/prefab/FluidSelectiveTank.java @@ -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 fluidList = new ArrayList(); + + 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) + { + this.fluidList = fluid; + return this; + } + + public FluidSelectiveTank addFluidToList(Fluid fluid) + { + if (fluid != null) + { + this.getList().add(fluid); + } + return this; + } + + public List getList() + { + if (this.fluidList == null) + { + this.fluidList = new ArrayList(); + } + return this.fluidList; + } + + public boolean canAcceptFluid(Fluid fluid) + { + return fluid != null && this.getList().contains(fluid); + } +}