mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Efficiency of isValidAcceptor methods.
This commit is contained in:
1 parent
9a6b3c511e
commit
fd0bdd4da8
6 files changed
+64
-6
No files matched your search
@@ -38,6 +38,32 @@ public final class PipeUtils
|
||||
return pipes;
|
||||
}
|
||||
|
||||
public static boolean isValidAcceptorOnSide(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
if(tile instanceof IGridTransmitter || !(tile instanceof IFluidHandler))
|
||||
return false;
|
||||
|
||||
IFluidHandler container = (IFluidHandler)tile;
|
||||
FluidTankInfo[] infoArray = container.getTankInfo(side.getOpposite());
|
||||
|
||||
if(container.canDrain(side.getOpposite(), FluidRegistry.WATER)
|
||||
|| container.canFill(side.getOpposite(), FluidRegistry.WATER)) //I hesitate to pass null to these.
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(infoArray != null && infoArray.length > 0)
|
||||
{
|
||||
for(FluidTankInfo info : infoArray)
|
||||
{
|
||||
if(info != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the adjacent connections to a TileEntity.
|
||||
* @param tileEntity - center TileEntity
|
||||
|
||||
Reference in new issue
Block a user