mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 13:10:13 +00:00
35 lines
904 B
Java
35 lines
904 B
Java
package crazypants.util;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraftforge.fluids.IFluidHandler;
|
|
import buildcraft.api.transport.IPipeTile;
|
|
import buildcraft.api.transport.IPipeTile.PipeType;
|
|
|
|
public class FluidUtil {
|
|
|
|
public static IFluidHandler getFluidHandler(IBlockAccess world, BlockCoord bc) {
|
|
return getFluidHandler(world, bc.x, bc.y, bc.z);
|
|
}
|
|
|
|
public static IFluidHandler getFluidHandler(IBlockAccess world, int x, int y, int z) {
|
|
TileEntity te = world.getTileEntity(x, y, z);
|
|
return getFluidHandler(te);
|
|
}
|
|
|
|
public static IFluidHandler getFluidHandler(TileEntity te) {
|
|
if(te instanceof IFluidHandler) {
|
|
if(te instanceof IPipeTile) {
|
|
if(((IPipeTile) te).getPipeType() != PipeType.FLUID) {
|
|
return null;
|
|
}
|
|
}
|
|
return (IFluidHandler) te;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
|
|
|
|
}
|