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
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

View file

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

View file

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