diff --git a/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java b/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java index 5ba2414b5..21e2dd068 100644 --- a/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java +++ b/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java @@ -10,19 +10,24 @@ import resonantinduction.api.fluid.IFluidPart; import universalelectricity.api.net.IConnector; import universalelectricity.core.net.ConnectionPathfinder; import universalelectricity.core.net.Network; +import universalelectricity.core.net.NetworkTickHandler; +import calclavia.lib.utility.FluidHelper; public class FluidNetwork extends Network implements IFluidNetwork { protected FluidTank tank; protected final FluidTankInfo[] tankInfo = new FluidTankInfo[1]; + protected boolean loadPart = false; + protected long ticks = 0; public FluidNetwork() { - + NetworkTickHandler.addNetwork(this); } public FluidNetwork(IFluidPart... parts) { + this(); for (IFluidPart part : parts) { this.addConnector(part); @@ -32,8 +37,32 @@ public class FluidNetwork extends Network= Long.MAX_VALUE - 10) + { + ticks = 1; + } + if (this.loadPart && ticks % 10 == 0) + { + this.loadPart = false; + FluidStack stack = this.getTank().getFluid(); + + if (stack != null) + { + int parts = this.getConnectors().size(); + for (IFluidPart part : this.getConnectors()) + { + int fillPer = stack.amount / parts; + part.getInternalTank().setFluid(null); + part.getInternalTank().fill(FluidHelper.getStack(stack, fillPer), true); + if (parts > 1) + parts--; + } + } + } } diff --git a/src/main/java/resonantinduction/mechanical/fluid/pipe/PipeNetwork.java b/src/main/java/resonantinduction/mechanical/fluid/pipe/PipeNetwork.java index 785485f23..063bd0d32 100644 --- a/src/main/java/resonantinduction/mechanical/fluid/pipe/PipeNetwork.java +++ b/src/main/java/resonantinduction/mechanical/fluid/pipe/PipeNetwork.java @@ -7,7 +7,11 @@ import resonantinduction.mechanical.fluid.network.FluidNetwork; public class PipeNetwork extends FluidNetwork { //TODO implements pressure for future hydraulic machines - + public PipeNetwork() + { + super(); + } + public PipeNetwork(IFluidPipe... pipes) { super(pipes); diff --git a/src/main/java/resonantinduction/mechanical/fluid/pipe/TilePipe.java b/src/main/java/resonantinduction/mechanical/fluid/pipe/TilePipe.java index 33645d377..0c9f9be37 100644 --- a/src/main/java/resonantinduction/mechanical/fluid/pipe/TilePipe.java +++ b/src/main/java/resonantinduction/mechanical/fluid/pipe/TilePipe.java @@ -146,14 +146,12 @@ public class TilePipe extends TileFluidNetwork implements IColorCoded, IFluidPip @Override public int getMaxPressure() { - // TODO Auto-generated method stub - return 0; + return 10000; } @Override public int getMaxFlowRate() { - // TODO Auto-generated method stub - return 0; + return 1000; } }