Add Tank tiles

This commit is contained in:
CovertJaguar 2013-10-12 17:13:40 -07:00
parent 99fca02856
commit ef2eace03c
8 changed files with 17 additions and 18 deletions

View file

@ -8,6 +8,7 @@
*/ */
package buildcraft.core.fluids; package buildcraft.core.fluids;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -19,8 +20,8 @@ public class RestrictedTank extends Tank {
private final Fluid[] acceptedFluids; private final Fluid[] acceptedFluids;
public RestrictedTank(String name, int capacity, Fluid... acceptedFluids) { public RestrictedTank(String name, int capacity, TileEntity tile, Fluid... acceptedFluids) {
super(name, capacity); super(name, capacity, tile);
this.acceptedFluids = acceptedFluids; this.acceptedFluids = acceptedFluids;
} }

View file

@ -9,10 +9,10 @@
package buildcraft.core.fluids; package buildcraft.core.fluids;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
/** /**
* *
@ -22,8 +22,8 @@ public class SingleUseTank extends Tank {
private Fluid acceptedFluid; private Fluid acceptedFluid;
public SingleUseTank(String name, int capacity) { public SingleUseTank(String name, int capacity, TileEntity tile) {
super(name, capacity); super(name, capacity, tile);
} }
@Override @Override

View file

@ -12,6 +12,7 @@ import buildcraft.core.gui.tooltips.ToolTip;
import buildcraft.core.gui.tooltips.ToolTipLine; import buildcraft.core.gui.tooltips.ToolTipLine;
import java.util.Locale; import java.util.Locale;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
@ -23,9 +24,10 @@ public class Tank extends FluidTank {
private final String name; private final String name;
public Tank(String name, int capacity) { public Tank(String name, int capacity, TileEntity tile) {
super(capacity); super(capacity);
this.name = name; this.name = name;
this.tile = tile;
} }
public boolean isEmpty() { public boolean isEmpty() {

View file

@ -45,8 +45,8 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
public static float COOLDOWN_RATE = 0.05F; public static float COOLDOWN_RATE = 0.05F;
public static int MAX_COOLANT_PER_TICK = 40; public static int MAX_COOLANT_PER_TICK = 40;
int burnTime = 0; int burnTime = 0;
private Tank tankFuel; private Tank tankFuel = new Tank("tankFuel", MAX_LIQUID, this);
private Tank tankCoolant; private Tank tankCoolant = new Tank("tankCoolant", MAX_LIQUID, this);
private TankManager tankManager = new TankManager(); private TankManager tankManager = new TankManager();
private Fuel currentFuel = null; private Fuel currentFuel = null;
public int penaltyCooling = 0; public int penaltyCooling = 0;
@ -55,8 +55,6 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
public TileEngineIron() { public TileEngineIron() {
super(1); super(1);
tankFuel = new Tank("tankFuel", MAX_LIQUID);
tankCoolant = new Tank("tankCoolant", MAX_LIQUID);
tankManager.add(tankFuel); tankManager.add(tankFuel);
tankManager.add(tankCoolant); tankManager.add(tankCoolant);
} }

View file

@ -36,7 +36,7 @@ public class TileFloodGate extends TileBuildCraft implements IFluidHandler {
private final TreeMap<Integer, Deque<BlockIndex>> pumpLayerQueues = new TreeMap<Integer, Deque<BlockIndex>>(); private final TreeMap<Integer, Deque<BlockIndex>> pumpLayerQueues = new TreeMap<Integer, Deque<BlockIndex>>();
private final Set<BlockIndex> visitedBlocks = new HashSet<BlockIndex>(); private final Set<BlockIndex> visitedBlocks = new HashSet<BlockIndex>();
private Deque<BlockIndex> fluidsFound = new LinkedList<BlockIndex>(); private Deque<BlockIndex> fluidsFound = new LinkedList<BlockIndex>();
private final Tank tank; private final Tank tank = new Tank("tank", MAX_LIQUID, this);
private int rebuildDelay; private int rebuildDelay;
private int tick = Utils.RANDOM.nextInt(); private int tick = Utils.RANDOM.nextInt();
private boolean powered = false; private boolean powered = false;
@ -53,7 +53,6 @@ public class TileFloodGate extends TileBuildCraft implements IFluidHandler {
} }
public TileFloodGate() { public TileFloodGate() {
tank = new Tank("tank", MAX_LIQUID);
} }
@Override @Override

View file

@ -54,7 +54,7 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
public static int MAX_LIQUID = FluidContainerRegistry.BUCKET_VOLUME * 16; public static int MAX_LIQUID = FluidContainerRegistry.BUCKET_VOLUME * 16;
EntityBlock tube; EntityBlock tube;
private TreeMap<Integer, Deque<BlockIndex>> pumpLayerQueues = new TreeMap<Integer, Deque<BlockIndex>>(); private TreeMap<Integer, Deque<BlockIndex>> pumpLayerQueues = new TreeMap<Integer, Deque<BlockIndex>>();
SingleUseTank tank; SingleUseTank tank = new SingleUseTank("tank", MAX_LIQUID, this);
double tubeY = Double.NaN; double tubeY = Double.NaN;
int aimY = 0; int aimY = 0;
private PowerHandler powerHandler; private PowerHandler powerHandler;
@ -66,7 +66,6 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
public TilePump() { public TilePump() {
powerHandler = new PowerHandler(this, Type.MACHINE); powerHandler = new PowerHandler(this, Type.MACHINE);
initPowerProvider(); initPowerProvider();
tank = new SingleUseTank("tank", MAX_LIQUID);
} }
private void initPowerProvider() { private void initPowerProvider() {

View file

@ -45,9 +45,9 @@ import net.minecraftforge.fluids.IFluidHandler;
public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowerReceptor, IInventory, IMachine { public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowerReceptor, IInventory, IMachine {
public static int LIQUID_PER_SLOT = FluidContainerRegistry.BUCKET_VOLUME * 4; public static int LIQUID_PER_SLOT = FluidContainerRegistry.BUCKET_VOLUME * 4;
public SingleUseTank tank1 = new SingleUseTank("tank1", LIQUID_PER_SLOT); public SingleUseTank tank1 = new SingleUseTank("tank1", LIQUID_PER_SLOT, this);
public SingleUseTank tank2 = new SingleUseTank("tank2", LIQUID_PER_SLOT); public SingleUseTank tank2 = new SingleUseTank("tank2", LIQUID_PER_SLOT, this);
public SingleUseTank result = new SingleUseTank("result", LIQUID_PER_SLOT); public SingleUseTank result = new SingleUseTank("result", LIQUID_PER_SLOT, this);
public TankManager<SingleUseTank> tankManager = new TankManager<SingleUseTank>(tank1, tank2, result); public TankManager<SingleUseTank> tankManager = new TankManager<SingleUseTank>(tank1, tank2, result);
public float animationSpeed = 1; public float animationSpeed = 1;
private int animationStage = 0; private int animationStage = 0;

View file

@ -32,7 +32,7 @@ import net.minecraftforge.fluids.IFluidHandler;
public class TileTank extends TileBuildCraft implements IFluidHandler { public class TileTank extends TileBuildCraft implements IFluidHandler {
public final Tank tank = new Tank("tank", FluidContainerRegistry.BUCKET_VOLUME * 16); public final Tank tank = new Tank("tank", FluidContainerRegistry.BUCKET_VOLUME * 16, this);
public final TankManager tankManager = new TankManager(tank); public final TankManager tankManager = new TankManager(tank);
public boolean hasUpdate = false; public boolean hasUpdate = false;
public SafeTimeTracker tracker = new SafeTimeTracker(); public SafeTimeTracker tracker = new SafeTimeTracker();