Search in sources :

Example 6 with RenderManager

use of net.minecraft.client.renderer.entity.RenderManager in project Railcraft by Railcraft.

the class CartContentRendererTank method renderItem.

// TODO: this probably needs to be replaced with RenderItem.renderItem
private void renderItem(EntityItem item) {
    //        RenderItem.renderInFrame = true;
    RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
    renderManager.doRenderEntity(item, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
    if (!renderManager.options.fancyGraphics) {
        OpenGL.glRotatef(180, 0, 1, 0);
        renderManager.doRenderEntity(item, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
        OpenGL.glRotatef(-180, 0, 1, 0);
    }
//        RenderItem.renderInFrame = false;
}
Also used : RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Example 7 with RenderManager

use of net.minecraft.client.renderer.entity.RenderManager in project Engine by VoltzEngine-Project.

the class RenderUtility method renderFloatingText.

public static void renderFloatingText(String text, double x, double y, double z, int color) {
    RenderManager renderManager = RenderManager.instance;
    FontRenderer fontRenderer = renderManager.getFontRenderer();
    float scale = 0.027f;
    GL11.glColor4f(1f, 1f, 1f, 0.5f);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(-scale, -scale, scale);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    Tessellator tessellator = Tessellator.instance;
    int yOffset = 0;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    tessellator.startDrawingQuads();
    int stringMiddle = fontRenderer.getStringWidth(text) / 2;
    tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.5F);
    tessellator.addVertex(-stringMiddle - 1, -1 + yOffset, 0.0D);
    tessellator.addVertex(-stringMiddle - 1, 8 + yOffset, 0.0D);
    tessellator.addVertex(stringMiddle + 1, 8 + yOffset, 0.0D);
    tessellator.addVertex(stringMiddle + 1, -1 + yOffset, 0.0D);
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(1f, 1f, 1f, 0.5f);
    fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) FontRenderer(net.minecraft.client.gui.FontRenderer) RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Aggregations

RenderManager (net.minecraft.client.renderer.entity.RenderManager)7 FontRenderer (net.minecraft.client.gui.FontRenderer)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)2 IBoreHead (mods.railcraft.api.carts.bore.IBoreHead)1 Minecraft (net.minecraft.client.Minecraft)1 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)1 Entity (net.minecraft.entity.Entity)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1