Search in sources :

Example 1 with ItemBlockFluidPipe

use of gregtech.common.pipelike.fluidpipe.ItemBlockFluidPipe in project GregTech by GregTechCE.

the class FluidPipeRenderer method renderItem.

@Override
public void renderItem(ItemStack rawItemStack, TransformType transformType) {
    ItemStack stack = ModCompatibility.getRealItemStack(rawItemStack);
    if (!(stack.getItem() instanceof ItemBlockFluidPipe)) {
        return;
    }
    CCRenderState renderState = CCRenderState.instance();
    GlStateManager.enableBlend();
    renderState.reset();
    renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    BlockFluidPipe blockFluidPipe = (BlockFluidPipe) ((ItemBlockFluidPipe) stack.getItem()).getBlock();
    FluidPipeType pipeType = blockFluidPipe.getItemPipeType(stack);
    Material material = blockFluidPipe.getItemMaterial(stack);
    if (pipeType != null && material != null) {
        renderPipeBlock(material, pipeType, IPipeTile.DEFAULT_INSULATION_COLOR, renderState, new IVertexOperation[0], 0);
    }
    renderState.draw();
    GlStateManager.disableBlend();
}
Also used : ItemBlockFluidPipe(gregtech.common.pipelike.fluidpipe.ItemBlockFluidPipe) ItemBlockFluidPipe(gregtech.common.pipelike.fluidpipe.ItemBlockFluidPipe) BlockFluidPipe(gregtech.common.pipelike.fluidpipe.BlockFluidPipe) FluidPipeType(gregtech.common.pipelike.fluidpipe.FluidPipeType) Material(gregtech.api.unification.material.type.Material) ItemStack(net.minecraft.item.ItemStack) CCRenderState(codechicken.lib.render.CCRenderState)

Aggregations

CCRenderState (codechicken.lib.render.CCRenderState)1 Material (gregtech.api.unification.material.type.Material)1 BlockFluidPipe (gregtech.common.pipelike.fluidpipe.BlockFluidPipe)1 FluidPipeType (gregtech.common.pipelike.fluidpipe.FluidPipeType)1 ItemBlockFluidPipe (gregtech.common.pipelike.fluidpipe.ItemBlockFluidPipe)1 ItemStack (net.minecraft.item.ItemStack)1