Search in sources :

Example 1 with RenderEngine

use of net.minecraft.client.renderer.RenderEngine in project MineFactoryReloaded by powercrystals.

the class RedNetCardItemRenderer method renderItem.

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    RenderEngine renderengine = Minecraft.getMinecraft().renderEngine;
    if (renderengine != null) {
        renderengine.bindTexture(MineFactoryReloadedCore.tileEntityFolder + "cards.png");
    }
    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5f, 0, 0);
    switch(type) {
        case EQUIPPED:
            GL11.glRotatef(60, 0, 1, 0);
            GL11.glRotatef(200, 1, 0, 0);
            GL11.glRotatef(120, 0, 0, 1);
            GL11.glTranslatef(-1.8f, 0.5f, -1.0f);
            break;
        case INVENTORY:
            GL11.glTranslatef(0, -0.2f, 0);
            break;
        default:
            break;
    }
    GL11.glScalef(1.7f, 1.7f, 1.7f);
    switch(item.getItemDamage()) {
        case 0:
            _cardsModel.renderLevel1(0.0625f);
            break;
        case 1:
            _cardsModel.renderLevel2(0.0625f);
            break;
        case 2:
            _cardsModel.renderLevel3(0.0625f);
            break;
        default:
            _cardsModel.renderEmptySlot(0.0625f);
    }
    GL11.glPopMatrix();
}
Also used : RenderEngine(net.minecraft.client.renderer.RenderEngine)

Example 2 with RenderEngine

use of net.minecraft.client.renderer.RenderEngine in project MineFactoryReloaded by powercrystals.

the class RedNetHistorianRenderer method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTicks) {
    RenderEngine renderengine = Minecraft.getMinecraft().renderEngine;
    TileEntityRedNetHistorian historian = (TileEntityRedNetHistorian) tileentity;
    if (renderengine != null) {
        renderengine.bindTexture(MineFactoryReloadedCore.tileEntityFolder + "historian.png");
    }
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y, (float) z);
    if (historian.getDirectionFacing() == ForgeDirection.EAST) {
        GL11.glTranslatef(1, 0, 0);
        GL11.glRotatef(270, 0, 1, 0);
    } else if (historian.getDirectionFacing() == ForgeDirection.SOUTH) {
        GL11.glTranslatef(1, 0, 1);
        GL11.glRotatef(180, 0, 1, 0);
    } else if (historian.getDirectionFacing() == ForgeDirection.WEST) {
        GL11.glTranslatef(0, 0, 1);
        GL11.glRotatef(90, 0, 1, 0);
    }
    _model.render((TileEntityRedNetHistorian) tileentity);
    GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
    RenderHelper.disableStandardItemLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator t = Tessellator.instance;
    t.startDrawing(GL11.GL_LINES);
    GL11.glLineWidth(2.0F);
    Integer[] values = historian.getValues();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int yMin = Integer.MAX_VALUE;
    int yMax = Integer.MIN_VALUE;
    for (int i = 0; i < values.length; i++) {
        Integer v = values[i];
        if (v == null) {
            continue;
        }
        if (v > yMax) {
            yMax = v;
        }
        if (v < yMin) {
            yMin = v;
        }
    }
    yMax = Math.max(yMax, 15);
    yMin = Math.min(yMin, 0);
    Integer lastValue = null;
    int lastX = 0;
    for (int i = 1; i < values.length; i++) {
        if (values[i] == null) {
            continue;
        }
        if (lastValue == null) {
            lastValue = values[i];
            lastX = i;
        } else {
            double x1 = (14.0 / 16.0) / values.length * lastX + (1.0 / 16.0);
            double x2 = (14.0 / 16.0) / values.length * (i) + (1.0 / 16.0);
            double y1 = (values[i - 1] - yMin) * (_renderMax - _renderMin) / (yMax - yMin) + _renderMin;
            double y2 = (values[i] - yMin) * (_renderMax - _renderMin) / (yMax - yMin) + _renderMin;
            t.addVertex(x1, y1, 0.253);
            t.addVertex(x2, y2, 0.253);
            lastValue = values[i];
            lastX = i;
        }
    }
    t.draw();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glPopAttrib();
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) RenderEngine(net.minecraft.client.renderer.RenderEngine) TileEntityRedNetHistorian(powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetHistorian)

Example 3 with RenderEngine

use of net.minecraft.client.renderer.RenderEngine in project MineFactoryReloaded by powercrystals.

the class EntityRocketRenderer method renderRocket.

public void renderRocket(EntityRocket rocket, double x, double y, double z, float yaw, float partialTicks) {
    RenderEngine renderengine = Minecraft.getMinecraft().renderEngine;
    if (renderengine != null) {
        renderengine.bindTexture("/textures/itemmodels/powercrystals/minefactoryreloaded/Rocket.png");
    }
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glRotatef(rocket.prevRotationYaw + (rocket.rotationYaw - rocket.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(90, 0, 0, 1);
    GL11.glRotatef(rocket.prevRotationPitch + (rocket.rotationPitch - rocket.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F);
    GL11.glScalef(0.01F, 0.01F, 0.01F);
    _model.renderAll();
    GL11.glPopMatrix();
}
Also used : RenderEngine(net.minecraft.client.renderer.RenderEngine)

Example 4 with RenderEngine

use of net.minecraft.client.renderer.RenderEngine in project MineFactoryReloaded by powercrystals.

the class FactoryGlassPaneItemRenderer method renderItem.

@SuppressWarnings("deprecation")
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    RenderEngine renderEngine = Minecraft.getMinecraft().renderEngine;
    RenderBlocks renderer = (RenderBlocks) data[0];
    BlockFactoryGlassPane pane = (BlockFactoryGlassPane) Block.blocksList[((ItemBlock) item.getItem()).getBlockID()];
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_CULL_FACE);
    Tessellator tessellator = Tessellator.instance;
    if (type == ItemRenderType.INVENTORY) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glScalef(16f, 16f, 16f);
        GL11.glTranslatef(0.5f, 0.5f, 0.5f);
        RenderingRegistry.instance().renderInventoryBlock(renderer, pane, item.getItemDamage(), MineFactoryReloadedCore.renderIdFactoryGlassPane);
        GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
        GL11.glScalef(1 / 16f, 1 / 16f, 1 / 16f);
        if (item.hasEffect()) {
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glDepthFunc(GL11.GL_GREATER);
            GL11.glDepthMask(false);
            renderEngine.bindTexture("%blur%/misc/glint.png");
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
            GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
            float f = 0.00390625F;
            float f1 = 0.00390625F;
            float f2 = Minecraft.getSystemTime() % (3000 + 0 * 1873) / (3000.0F + 0 * 1873) * 256.0F;
            float f3 = 0.0F;
            float f4 = 4.0F;
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(0, 16, -50, (f2 + 16 * f4) * f, (f3 + 16) * f1);
            tessellator.addVertexWithUV(16, 16, -50, (f2 + 16 + 16 * f4) * f, (f3 + 16) * f1);
            tessellator.addVertexWithUV(16, 0, -50, (f2 + 16) * f, (f3 + 0.0F) * f1);
            tessellator.addVertexWithUV(0, 0, -50, (f2 + 0.0F) * f, (f3 + 0.0F) * f1);
            tessellator.draw();
            f2 = Minecraft.getSystemTime() % (3000 + 1 * 1873) / (3000.0F + 1 * 1873) * 256.0F;
            f4 = -1.0F;
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(0, 16, -50, (f2 + 16 * f4) * f, (f3 + 16) * f1);
            tessellator.addVertexWithUV(16, 16, -50, (f2 + 16 + 16 * f4) * f, (f3 + 16) * f1);
            tessellator.addVertexWithUV(16, 0, -50, (f2 + 16) * f, (f3 + 0.0F) * f1);
            tessellator.addVertexWithUV(0, 0, -50, (f2 + 0.0F) * f, (f3 + 0.0F) * f1);
            tessellator.draw();
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glDepthMask(true);
            GL11.glDepthFunc(GL11.GL_LEQUAL);
        }
        GL11.glEnable(GL11.GL_LIGHTING);
    } else {
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        switch(type) {
            case EQUIPPED_FIRST_PERSON:
            case EQUIPPED:
                GL11.glTranslatef(10 / 16f, 7 / 16f, 0f);
                break;
            case ENTITY:
                GL11.glScalef(0.75f, 0.75f, 0.75f);
                GL11.glTranslatef(0f, 4 / 16f, 0f);
                break;
            default:
        }
        RenderingRegistry.instance().renderInventoryBlock(renderer, pane, item.getItemDamage(), MineFactoryReloadedCore.renderIdFactoryGlassPane);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}
Also used : RenderBlocks(net.minecraft.client.renderer.RenderBlocks) Tessellator(net.minecraft.client.renderer.Tessellator) BlockFactoryGlassPane(powercrystals.minefactoryreloaded.block.BlockFactoryGlassPane) ItemBlock(net.minecraft.item.ItemBlock) RenderEngine(net.minecraft.client.renderer.RenderEngine)

Example 5 with RenderEngine

use of net.minecraft.client.renderer.RenderEngine in project MineFactoryReloaded by powercrystals.

the class RocketLauncherItemRenderer method renderItem.

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    RenderEngine renderengine = Minecraft.getMinecraft().renderEngine;
    if (renderengine != null) {
        renderengine.bindTexture("/textures/itemmodels/powercrystals/minefactoryreloaded/RocketLauncher.png");
    }
    GL11.glPushMatrix();
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(270, 0, 1, 0);
        GL11.glRotatef(300, 1, 0, 0);
        GL11.glTranslatef(-0.3F, 0.3F, 0.5F);
        GL11.glScalef(0.03F, 0.03F, 0.03F);
    } else if (type == ItemRenderType.EQUIPPED) {
        GL11.glRotatef(270, 1, 0, 0);
        GL11.glTranslatef(0.3F, -0.4F, 1.0F);
        GL11.glScalef(0.03F, 0.03F, 0.03F);
    } else {
        GL11.glRotatef(270, 1, 0, 0);
        GL11.glScalef(0.025F, 0.025F, 0.025F);
    }
    _model.renderAll();
    GL11.glPopMatrix();
}
Also used : RenderEngine(net.minecraft.client.renderer.RenderEngine)

Aggregations

RenderEngine (net.minecraft.client.renderer.RenderEngine)7 Tessellator (net.minecraft.client.renderer.Tessellator)2 RenderBlocks (net.minecraft.client.renderer.RenderBlocks)1 ItemBlock (net.minecraft.item.ItemBlock)1 BlockFactoryGlassPane (powercrystals.minefactoryreloaded.block.BlockFactoryGlassPane)1 TileEntityRedNetHistorian (powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetHistorian)1