removed old canConnect method from psiCreator and cleanup the comments
for the new one so they are easier to understand.
This commit is contained in:
Rseifert 2013-03-26 13:27:47 -04:00
parent ca9c037fa6
commit b6048c7cac
4 changed files with 31 additions and 16 deletions

View file

@ -199,7 +199,7 @@ public class TileEntityMinorPump extends TileEntityElectricityRunnable implement
@Override @Override
public String getMeterReading(EntityPlayer user, ForgeDirection side) public String getMeterReading(EntityPlayer user, ForgeDirection side)
{ {
return this.wattsReceived + "/" + this.WATTS_PER_TICK + " " + this.percentPumped; return this.wattsReceived + "/" + this.WATTS_PER_TICK + "W " + this.percentPumped+"% DONE";
} }
@Override @Override
@ -212,16 +212,30 @@ public class TileEntityMinorPump extends TileEntityElectricityRunnable implement
return 0; return 0;
} }
@Override
public boolean getCanPressureTo(LiquidStack type, ForgeDirection dir)
{
return dir == this.pipeConnection.getOpposite() && this.color.isValidLiquid(type);
}
@Override @Override
public boolean canConnect(ForgeDirection direction) public boolean canConnect(ForgeDirection direction)
{ {
return direction == wireConnection; return direction == wireConnection;
} }
@Override
public boolean canConnect(ForgeDirection dir, LiquidStack... stacks)
{
if(dir == this.pipeConnection.getOpposite())
{
if(stacks == null || stacks.length == 0)
{
return true;
}
for(int i =0; i< stacks.length; i++)
{
if(this.color.isValidLiquid(stacks[i]))
{
return true;
}
}
}
return false;
}
} }

View file

@ -9,8 +9,8 @@ public interface IPipeConnector
/** /**
* *
* @param ent - tileEntity trying to connect to this machine * @param ent - tileEntity trying to connect to this machine
* @param stack - liquid(s) it is most likely going to take or pass. It will pass null if it * @param stack - liquid(s) it can accept. It will pass null if the
* doesn't care * connecting machine has no specific stack requirement
* @return true if it can connect * @return true if it can connect
*/ */
public boolean canConnect(ForgeDirection dir, LiquidStack... stacks); public boolean canConnect(ForgeDirection dir, LiquidStack... stacks);

View file

@ -6,12 +6,13 @@ import net.minecraftforge.liquids.LiquidStack;
public interface IPsiCreator extends IPipeConnector public interface IPsiCreator extends IPipeConnector
{ {
/** /**
* gets the PressureOutput of a device * gets the pressure produced from that side of the machine. Use canConnect method to allow a
* pipe to connect to the side first.
*
* @param stack - liquid stack that the pressure is being requested for
* @param dir - side being pressured
* @return - amount of pressure produced
*/ */
public int getPressureOut(LiquidStack stack, ForgeDirection dir); public int getPressureOut(LiquidStack stack, ForgeDirection dir);
/**
* Quick way to check if the TE will output pressure
*/
public boolean getCanPressureTo(LiquidStack stack, ForgeDirection dir);
} }

View file

@ -35,9 +35,9 @@ public class HydraulicNetwork
public final List<TileEntity> receivers = new ArrayList<TileEntity>(); public final List<TileEntity> receivers = new ArrayList<TileEntity>();
public ColorCode color = ColorCode.NONE; public ColorCode color = ColorCode.NONE;
/* PRESSURE OF THE NETWORK AS A TOTAL. ZERO AS IN DEFUALT */ /* PRESSURE OF THE NETWORK AS A TOTAL. ZERO AS IN NO PRODUCTION */
public double pressureProduced = 0; public double pressureProduced = 0;
/* PRESSURE OF THE NETWORK'S LOAD AS A TOTAL. ZERO AS IN DEFUALT */ /* PRESSURE OF THE NETWORK'S LOAD AS A TOTAL. ZERO AS IN NO LOAD */
public double pressureLoad = 0; public double pressureLoad = 0;
public HydraulicNetwork(ILiquidNetworkPart conductor, ColorCode color) public HydraulicNetwork(ILiquidNetworkPart conductor, ColorCode color)