Search in sources :

Example 1 with ItemBlockCable

use of gregtech.common.pipelike.cable.ItemBlockCable in project GregTech by GregTechCE.

the class CableRenderer method renderItem.

@Override
public void renderItem(ItemStack rawItemStack, TransformType transformType) {
    ItemStack stack = ModCompatibility.getRealItemStack(rawItemStack);
    if (!(stack.getItem() instanceof ItemBlockCable)) {
        return;
    }
    GlStateManager.enableBlend();
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    BlockCable blockCable = (BlockCable) ((ItemBlockCable) stack.getItem()).getBlock();
    Insulation insulation = blockCable.getItemPipeType(stack);
    Material material = blockCable.getItemMaterial(stack);
    if (insulation != null && material != null) {
        renderCableBlock(material, insulation, IPipeTile.DEFAULT_INSULATION_COLOR, renderState, new IVertexOperation[0], 1 << EnumFacing.SOUTH.getIndex() | 1 << EnumFacing.NORTH.getIndex() | 1 << (6 + EnumFacing.SOUTH.getIndex()) | 1 << (6 + EnumFacing.NORTH.getIndex()));
    }
    renderState.draw();
    GlStateManager.disableBlend();
}
Also used : Insulation(gregtech.common.pipelike.cable.Insulation) ItemBlockCable(gregtech.common.pipelike.cable.ItemBlockCable) Material(gregtech.api.unification.material.type.Material) ItemStack(net.minecraft.item.ItemStack) CCRenderState(codechicken.lib.render.CCRenderState) ItemBlockCable(gregtech.common.pipelike.cable.ItemBlockCable) BlockCable(gregtech.common.pipelike.cable.BlockCable)

Aggregations

CCRenderState (codechicken.lib.render.CCRenderState)1 Material (gregtech.api.unification.material.type.Material)1 BlockCable (gregtech.common.pipelike.cable.BlockCable)1 Insulation (gregtech.common.pipelike.cable.Insulation)1 ItemBlockCable (gregtech.common.pipelike.cable.ItemBlockCable)1 ItemStack (net.minecraft.item.ItemStack)1