Java 类net.minecraftforge.fluids.RenderBlockFluid 实例源码

项目:carpentersblocks    文件:RoutableFluidsHelper.java   
/**
 * Renders routable fluid.
 *
 * @param  TE the {@link TEBase}
 * @param  renderBlocks the {@link RenderBlocks}
 * @param  x the x coordinate
 * @param  y the y coordinate
 * @param  z the z coordinate
 * @return true if fluid rendered in space
 */
public static boolean render(TEBase TE, RenderBlocks renderBlocks, int x, int y, int z)
{
    // Do not render if fluid is above block
    Class clazz_YP = renderBlocks.blockAccess.getBlock(x, y + 1, z).getClass();
    for (Class clazz : liquidClasses) {
        if (clazz.isAssignableFrom(clazz_YP)) {
            return false;
        }
    }

    ItemStack itemStack = getFluidBlock(renderBlocks.blockAccess, x, y, z);

    if (itemStack != null) {

        Block block = BlockProperties.toBlock(itemStack);
        int metadata = itemStack.getItemDamage();

        if (block.getRenderBlockPass() == MinecraftForgeClient.getRenderPass())
        {
            if (!block.hasTileEntity(metadata))
            {
                if (block instanceof BlockLiquid) {
                    renderLiquidSurface(TE, renderBlocks, itemStack, x, y, z);
                } else {
                    RenderBlockFluid.instance.renderWorldBlock(renderBlocks.blockAccess, x, y, z, block, 0, renderBlocks);
                }
                return true;
            }
        }

    }

    return false;
}