Search in sources :

Example 1 with IRenderMetaTileEntity

use of gregtech.api.metatileentity.IRenderMetaTileEntity in project GregTech by GregTechCE.

the class MetaTileEntityRenderer method renderItem.

@Override
public void renderItem(ItemStack rawStack, TransformType transformType) {
    ItemStack stack = ModCompatibility.getRealItemStack(rawStack);
    if (!(stack.getItem() instanceof MachineItemBlock)) {
        return;
    }
    MetaTileEntity metaTileEntity = MachineItemBlock.getMetaTileEntity(stack);
    if (metaTileEntity == null) {
        return;
    }
    GlStateManager.enableBlend();
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    metaTileEntity.setRenderContextStack(stack);
    metaTileEntity.renderMetaTileEntity(renderState, new Matrix4(), new IVertexOperation[0]);
    if (metaTileEntity instanceof IFastRenderMetaTileEntity) {
        ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, new Matrix4(), 0.0f);
    }
    metaTileEntity.setRenderContextStack(null);
    renderState.draw();
    if (metaTileEntity instanceof IRenderMetaTileEntity) {
        ((IRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityDynamic(0.0, 0.0, 0.0, 0.0f);
    }
    GlStateManager.disableBlend();
}
Also used : MachineItemBlock(gregtech.api.block.machines.MachineItemBlock) IRenderMetaTileEntity(gregtech.api.metatileentity.IRenderMetaTileEntity) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) IFastRenderMetaTileEntity(gregtech.api.metatileentity.IFastRenderMetaTileEntity) IFastRenderMetaTileEntity(gregtech.api.metatileentity.IFastRenderMetaTileEntity) ItemStack(net.minecraft.item.ItemStack) CCRenderState(codechicken.lib.render.CCRenderState) IRenderMetaTileEntity(gregtech.api.metatileentity.IRenderMetaTileEntity) Matrix4(codechicken.lib.vec.Matrix4)

Aggregations

CCRenderState (codechicken.lib.render.CCRenderState)1 Matrix4 (codechicken.lib.vec.Matrix4)1 MachineItemBlock (gregtech.api.block.machines.MachineItemBlock)1 IFastRenderMetaTileEntity (gregtech.api.metatileentity.IFastRenderMetaTileEntity)1 IRenderMetaTileEntity (gregtech.api.metatileentity.IRenderMetaTileEntity)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 ItemStack (net.minecraft.item.ItemStack)1