use of gregtech.api.pipenet.block.ItemBlockPipe in project GregTech by GregTechCEu.
the class PipeRenderer method renderItem.
@Override
public void renderItem(ItemStack rawItemStack, TransformType transformType) {
ItemStack stack = ModCompatibility.getRealItemStack(rawItemStack);
if (!(stack.getItem() instanceof ItemBlockPipe)) {
return;
}
CCRenderState renderState = CCRenderState.instance();
GlStateManager.enableBlend();
renderState.reset();
renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
BlockPipe<?, ?, ?> blockFluidPipe = (BlockPipe<?, ?, ?>) ((ItemBlockPipe<?, ?>) stack.getItem()).getBlock();
IPipeType<?> pipeType = blockFluidPipe.getItemPipeType(stack);
Material material = blockFluidPipe instanceof BlockMaterialPipe ? ((BlockMaterialPipe<?, ?, ?>) blockFluidPipe).getItemMaterial(stack) : null;
if (pipeType != null) {
// 12 == 0b1100 is North and South connection (index 2 & 3)
PipeRenderContext renderContext = new PipeRenderContext(12, 0, pipeType.getThickness());
renderContext.color = GTUtility.convertRGBtoOpaqueRGBA_CL(getPipeColor(material, -1));
buildRenderer(renderContext, blockFluidPipe, null, pipeType, material);
renderPipeBlock(renderState, renderContext);
}
renderState.draw();
GlStateManager.disableBlend();
}
Aggregations