Merge pull request #1 from atrain99/master

Changed Pipe tileEntity, the API interfaces, added textures.
This commit is contained in:
calclavia 2012-07-09 18:30:54 -07:00
commit a5d1fac4e7
9 changed files with 13 additions and 7 deletions

View file

@ -47,9 +47,12 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer
} }
else else
{ {
if(tileEntity instanceof ILiquidConsumer || tileEntity instanceof ILiquidProducer) if(tileEntity instanceof ILiquidProducer)
{ {
this.connectedBlocks[side] = tileEntity; if(((ILiquidProducer) tileEntity).canConnectFromTypeAndSide(this.getType(), side)) this.connectedBlocks[side] = tileEntity;
}else if(tileEntity instanceof ILiquidConsumer)
{
if(((ILiquidConsumer) tileEntity).canConnectFromTypeAndSide(this.getType(), side)) this.connectedBlocks[side] = tileEntity;
} }
else else
{ {
@ -67,13 +70,13 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer
* @return watt - The amount of rejected power to be sent back into the conductor * @return watt - The amount of rejected power to be sent back into the conductor
*/ */
@Override @Override
public int onReceiveLiquid(int type,int watt, byte side) public int onReceiveLiquid(int type,int amt, byte side)
{ {
if(type == this.type) if(type == this.type)
{ {
int rejectedElectricity = Math.max((this.getStoredLiquid(type) + watt) - this.capacity, 0); int rejectedLiquid = Math.max((this.getStoredLiquid(type) + amt) - this.capacity, 0);
this.liquidStored = watt - rejectedElectricity; this.liquidStored += watt - rejectedElectricity;
return rejectedElectricity; return rejectedLiquid;
} }
return watt; return watt;
} }
@ -154,7 +157,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer
} }
/** /**
* @return Return the stored electricity in this consumer. Called by conductors to spread electricity to this unit. * @return Return the stored liquid in this consumer. Called by conductors to spread electricity to this unit.
*/ */
@Override @Override
public int getStoredLiquid(int type) public int getStoredLiquid(int type)

View file

@ -27,5 +27,6 @@ public interface ILiquidConsumer
* @return Return the maximum amount of stored liquid this consumer can get. * @return Return the maximum amount of stored liquid this consumer can get.
*/ */
public int getLiquidCapacity(int type); public int getLiquidCapacity(int type);
public int canConnectFromTypeAndSide(int type, byte side);
} }

View file

@ -18,4 +18,6 @@ public interface ILiquidProducer
public int onProduceLiquid(int type, int maxVol, int side); public int onProduceLiquid(int type, int maxVol, int side);
public boolean canProduceLiquid(int type, byte side); public boolean canProduceLiquid(int type, byte side);
public boolean canConnectFromTypeAndSide(int type, byte side);
} }

BIN
textures/SteamPipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
textures/WaterPipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
textures/airPipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
textures/fuelPipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

BIN
textures/lavaPipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

BIN
textures/oilPipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB