diff --git a/resources/mcmod.info b/resources/mcmod.info new file mode 100644 index 000000000..e27a11408 --- /dev/null +++ b/resources/mcmod.info @@ -0,0 +1,18 @@ +[ +{ + "modid" : "FluidMechanics", + "name" : "Fluid Mechanics", + "version" : "0.3.0", + "url" : "http://calclavia.com/universalelectricity/?m=18", + "credits" : "", + "authors": [ + "Darkguardsman" + ], + "description": "A basic fluid and mechanics support system for other mods to work off of", + "logoFile" : "/fm_logo.png", + "updateUrl" : "http://universalelectricity.com/?m=fluid_mechanics", + "parent" : "", + "screenshots": [ + ] +} +] \ No newline at end of file diff --git a/src/minecraft/hydraulic/api/IFluidPipe.java b/src/minecraft/hydraulic/api/ILiquidNetworkPart.java similarity index 74% rename from src/minecraft/hydraulic/api/IFluidPipe.java rename to src/minecraft/hydraulic/api/ILiquidNetworkPart.java index 6265a86c1..a0bfc37fe 100644 --- a/src/minecraft/hydraulic/api/IFluidPipe.java +++ b/src/minecraft/hydraulic/api/ILiquidNetworkPart.java @@ -6,18 +6,22 @@ import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.liquids.LiquidStack; /** - * Must be applied to all tile entities that are conductors. - * - * @author Calclavia - * + * A machine that acts as one with the liquid network using the networks pressure for some function */ -public interface IFluidPipe extends IColorCoded +public interface ILiquidNetworkPart { /** - * The Fluid network that this pipe is part of + * gets the devices pressure from a given side for input + */ + public double getMaxPressure(ForgeDirection side); + + /** + * The Fluid network that this machine is part of */ public HydraulicNetwork getNetwork(); - + /** + * sets the machines network + */ public void setNetwork(HydraulicNetwork network); /** @@ -32,10 +36,6 @@ public interface IFluidPipe extends IColorCoded */ public int getMaxFlowRate(LiquidStack stack); - /** - * gets the pipe's max pressure before bursting - */ - public double getMaxPressure(); /** * Called when the pressure on the pipe passes max @@ -53,7 +53,7 @@ public interface IFluidPipe extends IColorCoded public void refreshConnectedBlocks(); /** - * Adds a connection between this conductor and a UE unit + * Adds a connection between this machine and another machine * * @param tileEntity - Must be either a producer, consumer or a conductor * @param side - side in which the connection is coming from @@ -61,4 +61,5 @@ public interface IFluidPipe extends IColorCoded public void updateConnection(TileEntity tileEntity, ForgeDirection side); public void updateConnectionWithoutSplit(TileEntity connectorFromSide, ForgeDirection orientation); + } diff --git a/src/minecraft/hydraulic/api/IPsiMachine.java b/src/minecraft/hydraulic/api/IPsiMachine.java deleted file mode 100644 index 1c9b10fbe..000000000 --- a/src/minecraft/hydraulic/api/IPsiMachine.java +++ /dev/null @@ -1,12 +0,0 @@ -package hydraulic.api; - -import net.minecraftforge.common.ForgeDirection; - -public interface IPsiMachine -{ - /** - * gets the devices pressure from a given side - */ - public double getMaxPressure(ForgeDirection side); - -} diff --git a/src/minecraft/hydraulic/api/IPsiReciever.java b/src/minecraft/hydraulic/api/IPsiReciever.java index 0575b47d5..909d351bf 100644 --- a/src/minecraft/hydraulic/api/IPsiReciever.java +++ b/src/minecraft/hydraulic/api/IPsiReciever.java @@ -1,11 +1,13 @@ package hydraulic.api; -public interface IPsiReciever extends IPsiMachine +public interface IPsiReciever { /** - * Called when this machine receives pressure/Fluid - * Too get force take pressure x Surface area of you machine - * @param pressure - input pressure. make sure to output a pressure later on, plus remaining liquid + * Called when this machine receives pressure/Fluid Too get force take pressure x Surface area + * of you machine + * + * @param pressure - input pressure. make sure to output a pressure later on, plus remaining + * liquid */ public void onReceivePressure(double pressure); } diff --git a/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java b/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java index b401a4904..4d16ffaeb 100644 --- a/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java +++ b/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetwork.java @@ -1,9 +1,8 @@ package hydraulic.core.liquidNetwork; import hydraulic.api.ColorCode; -import hydraulic.api.IFluidPipe; import hydraulic.api.IPsiCreator; -import hydraulic.api.IPsiMachine; +import hydraulic.api.ILiquidNetworkPart; import hydraulic.helpers.connectionHelper; import java.util.ArrayList; @@ -18,17 +17,17 @@ import net.minecraftforge.liquids.LiquidStack; public class HydraulicNetwork { /* BLOCK THAT ACT AS FLUID CONVEYORS ** */ - public final List conductors = new ArrayList(); + public final List conductors = new ArrayList(); /* MACHINES THAT USE THE FORGE LIQUID API TO RECEIVE LIQUID ** */ public final List receivers = new ArrayList(); public ColorCode color = ColorCode.NONE; - public HydraulicNetwork(IFluidPipe conductor) + public HydraulicNetwork(ILiquidNetworkPart conductor, ColorCode color) { - this.addConductor(conductor); - this.color = conductor.getColor(); + this.addConductor(conductor, color); + this.color = color; } /** @@ -66,7 +65,7 @@ public class HydraulicNetwork TileEntity[] surroundings = connectionHelper.getSurroundingTileEntities((TileEntity) tank); for (int i = 0; i < 6; i++) { - if (surroundings[i] instanceof IFluidPipe && ((IFluidPipe) surroundings[i]).getNetwork() == this) + if (surroundings[i] instanceof ILiquidNetworkPart && ((ILiquidNetworkPart) surroundings[i]).getNetwork() == this) { ForgeDirection dir = ForgeDirection.getOrientation(i).getOpposite(); ILiquidTank storage = tank.getTank(dir, stack); @@ -125,7 +124,7 @@ public class HydraulicNetwork public int getMaxFlow(LiquidStack stack) { int flow = 1000; - for (IFluidPipe conductor : this.conductors) + for (ILiquidNetworkPart conductor : this.conductors) { int cFlow = conductor.getMaxFlowRate(stack); if (cFlow < flow) @@ -159,17 +158,17 @@ public class HydraulicNetwork */ public void addEntity(TileEntity ent) { - if(!receivers.contains(ent) && (ent instanceof ITankContainer || ent instanceof IPsiMachine || ent instanceof IPsiCreator)) + if(!receivers.contains(ent) && (ent instanceof ITankContainer || ent instanceof ILiquidNetworkPart || ent instanceof IPsiCreator)) { receivers.add(ent); } } - public void addConductor(IFluidPipe newConductor) + public void addConductor(ILiquidNetworkPart newConductor, ColorCode code) { this.cleanConductors(); - if (newConductor.getColor() == this.color && !conductors.contains(newConductor)) + if (code == this.color && !conductors.contains(newConductor)) { conductors.add(newConductor); newConductor.setNetwork(this); @@ -203,7 +202,7 @@ public class HydraulicNetwork { this.cleanConductors(); - for (IFluidPipe conductor : this.conductors) + for (ILiquidNetworkPart conductor : this.conductors) { conductor.setNetwork(this); } diff --git a/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetworkManager.java b/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetworkManager.java index 049dba4b6..d24e51117 100644 --- a/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetworkManager.java +++ b/src/minecraft/hydraulic/core/liquidNetwork/HydraulicNetworkManager.java @@ -1,6 +1,7 @@ package hydraulic.core.liquidNetwork; -import hydraulic.api.IFluidPipe; +import hydraulic.api.ColorCode; +import hydraulic.api.ILiquidNetworkPart; import java.util.ArrayList; import java.util.Iterator; @@ -23,15 +24,20 @@ public class HydraulicNetworkManager private List hydraulicNetworks = new ArrayList(); /** - * Registers a conductor into the UE electricity net. + * Registers a pipe into the network, if not using a specific color give ColorCode.NONE */ - public void registerConductor(IFluidPipe newConductor) + public void registerConductor(ILiquidNetworkPart newConductor, ColorCode color) { this.cleanUpNetworks(); - HydraulicNetwork newNetwork = new HydraulicNetwork(newConductor); + HydraulicNetwork newNetwork = new HydraulicNetwork(newConductor, color); this.hydraulicNetworks.add(newNetwork); } + /** + * unregisters a tileEntity from the network + * + * @param tileEntity + */ public void unregister(TileEntity tileEntity) { for (HydraulicNetwork network : this.hydraulicNetworks) @@ -73,7 +79,7 @@ public class HydraulicNetworkManager * @param conductorA - existing conductor * @param conductorB - broken/invalid conductor */ - public void splitConnection(IFluidPipe conductorA, IFluidPipe conductorB) + public void splitConnection(ILiquidNetworkPart conductorA, ILiquidNetworkPart conductorB) { try { @@ -88,7 +94,7 @@ public class HydraulicNetworkManager while (it.hasNext()) { - IFluidPipe conductor = (IFluidPipe) it.next(); + ILiquidNetworkPart conductor = (ILiquidNetworkPart) it.next(); for (byte i = 0; i < 6; i++) {