Pumps can now be hand cranked and fixed grate infinite lava

This commit is contained in:
Calclavia 2014-02-24 22:06:15 +08:00
parent ca9e694a68
commit 39bda36b9b
3 changed files with 16 additions and 9 deletions

View file

@ -190,7 +190,7 @@ public class PartPipe extends PartFramedConnection<EnumPipeMaterial, IFluidPipe,
@Override @Override
protected boolean canConnectTo(TileEntity tile, ForgeDirection dir) protected boolean canConnectTo(TileEntity tile, ForgeDirection dir)
{ {
return tile instanceof IFluidHandler; return tile instanceof IFluidHandler && (((IFluidHandler) tile).canFill(dir.getOpposite(), null) || ((IFluidHandler) tile).canDrain(dir.getOpposite(), null));
} }
@Override @Override

View file

@ -390,7 +390,7 @@ public class TileGrate extends TileAdvanced implements IFluidHandler
if (drainedAmount > amount) if (drainedAmount > amount)
{ {
return new FluidStack(fluidType, drainedAmount); break;
} }
} }
} }
@ -398,6 +398,10 @@ public class TileGrate extends TileAdvanced implements IFluidHandler
} }
TileGrate.this.resetPath(); TileGrate.this.resetPath();
if (drainedAmount > 0)
return new FluidStack(fluidType, drainedAmount);
return null; return null;
} }

View file

@ -50,7 +50,7 @@ public class TilePump extends TileMechanical implements IFluidHandler, IRotatabl
@Override @Override
public boolean canDrain(ForgeDirection from, Fluid fluid) public boolean canDrain(ForgeDirection from, Fluid fluid)
{ {
return false; return from == this.getDirection();
} }
@Override @Override
@ -78,14 +78,17 @@ public class TilePump extends TileMechanical implements IFluidHandler, IRotatabl
@Override @Override
public int getPressure(ForgeDirection dir) public int getPressure(ForgeDirection dir)
{
if (getPower() > 0)
{ {
if (dir == getDirection()) if (dir == getDirection())
{ {
return (int) (((double) getPower() / (double) maximumPower) * 100); return (int) Math.max((((double) getPower() / (double) maximumPower) * 100), 2);
} }
else if (dir == getDirection().getOpposite()) else if (dir == getDirection().getOpposite())
{ {
return (int) -(((double) getPower() / (double) maximumPower) * 100); return (int) -Math.max((((double) getPower() / (double) maximumPower) * 100), 2);
}
} }
return 0; return 0;