Search in sources :

Example 41 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)

Example 42 with RenderManager

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

the class ClientProxy method registerRenderers.

@Override
public void registerRenderers() {
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityComposter.class, new RenderComposter());
    RenderingRegistry.registerEntityRenderingHandler(EntityLaunchingArrow.class, new IRenderFactory<EntityLaunchingArrow>() {

        @Override
        public Render<EntityLaunchingArrow> createRenderFor(RenderManager manager) {
            return new RenderLaunchingArrow(manager);
        }
    });
}
Also used : RenderComposter(convenientadditions.block.composter.render.RenderComposter) Render(net.minecraft.client.renderer.entity.Render) RenderLaunchingArrow(convenientadditions.entity.launchingArrow.RenderLaunchingArrow) EntityLaunchingArrow(convenientadditions.entity.launchingArrow.EntityLaunchingArrow) RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Example 43 with RenderManager

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

the class RenderTools method renderString.

public static void renderString(String name, double xOffset, double yOffset, double zOffset) {
    RenderManager rm = Minecraft.getMinecraft().getRenderManager();
    FontRenderer fontrenderer = rm.getFontRenderer();
    float f = 1.6F;
    float f1 = 1 / 60F * f;
    OpenGL.glPushMatrix();
    OpenGL.glTranslatef((float) xOffset, (float) yOffset, (float) zOffset);
    OpenGL.glNormal3f(0.0F, 1.0F, 0.0F);
    OpenGL.glRotatef(-rm.playerViewY, 0.0F, 1.0F, 0.0F);
    OpenGL.glRotatef(rm.playerViewX, 1.0F, 0.0F, 0.0F);
    OpenGL.glScalef(-f1, -f1, f1);
    OpenGL.glDisable(GL11.GL_LIGHTING);
    OpenGL.glDepthMask(false);
    OpenGL.glDisable(GL11.GL_DEPTH_TEST);
    OpenGL.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexBuffer = tessellator.getBuffer();
    OpenGL.glDisable(GL11.GL_TEXTURE_2D);
    vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
    int j = fontrenderer.getStringWidth(name) / 2;
    float r = 0, g = 0, b = 0;
    float a = 0.25F;
    vertexBuffer.pos((double) (-j - 1), (double) -1, 0.0D).color(r, g, b, a).endVertex();
    vertexBuffer.pos((double) (-j - 1), (double) 8, 0.0D).color(r, g, b, a).endVertex();
    vertexBuffer.pos((double) (j + 1), (double) 8, 0.0D).color(r, g, b, a).endVertex();
    vertexBuffer.pos((double) (j + 1), (double) -1, 0.0D).color(r, g, b, a).endVertex();
    tessellator.draw();
    OpenGL.glEnable(GL11.GL_TEXTURE_2D);
    fontrenderer.drawString(name, -fontrenderer.getStringWidth(name) / 2, 0, 553648127);
    OpenGL.glEnable(GL11.GL_DEPTH_TEST);
    OpenGL.glDepthMask(true);
    fontrenderer.drawString(name, -fontrenderer.getStringWidth(name) / 2, 0, -1);
    OpenGL.glEnable(GL11.GL_LIGHTING);
    OpenGL.glDisable(GL11.GL_BLEND);
    OpenGL.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    OpenGL.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) FontRenderer(net.minecraft.client.gui.FontRenderer) RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Example 44 with RenderManager

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

the class RenderTunnelBore method doRender.

@Override
public void doRender(EntityTunnelBore bore, double x, double y, double z, float entityYaw, float partialTicks) {
    // System.out.println("Render Yaw = " + f);
    OpenGL.glPushMatrix();
    long var10 = (long) bore.getEntityId() * 493286711L;
    var10 = var10 * var10 * 4392167121L + var10 * 98761L;
    float tx = (((float) (var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
    float ty = (((float) (var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
    float tz = (((float) (var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
    OpenGL.glTranslatef(tx, ty, tz);
    RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
    if (renderManager.isDebugBoundingBox()) {
        // GlStateManager.depthMask(false);
        GlStateManager.disableTexture2D();
        GlStateManager.disableLighting();
        GlStateManager.disableCull();
        GlStateManager.disableBlend();
        for (Entity part : bore.getParts()) {
            OpenGL.glPushMatrix();
            double posX = part.lastTickPosX + (part.posX - part.lastTickPosX) * (double) partialTicks - TileEntityRendererDispatcher.staticPlayerX;
            double posY = part.lastTickPosY + (part.posY - part.lastTickPosY) * (double) partialTicks - TileEntityRendererDispatcher.staticPlayerY;
            double posZ = part.lastTickPosZ + (part.posZ - part.lastTickPosZ) * (double) partialTicks - TileEntityRendererDispatcher.staticPlayerZ;
            OpenGL.glTranslatef((float) posX, (float) posY, (float) posZ);
            float halfWidth = part.width / 2.0F;
            RenderGlobal.drawBoundingBox(-halfWidth, 0.0, -halfWidth, halfWidth, part.height, halfWidth, 1, 0, 0, 1);
            OpenGL.glPopMatrix();
        }
        GlStateManager.enableTexture2D();
        GlStateManager.enableLighting();
        GlStateManager.enableCull();
        GlStateManager.disableBlend();
    // GlStateManager.depthMask(true);
    }
    OpenGL.glTranslatef(0F, 0.375F, 0F);
    OpenGL.glTranslatef((float) x, (float) y, (float) z);
    OpenGL.glRotatef(180F - entityYaw, 0.0F, 1.0F, 0.0F);
    OpenGL.glRotatef(90, 0.0F, 1.0F, 0.0F);
    float f3 = (float) bore.getRollingAmplitude() - partialTicks;
    float f4 = bore.getDamage() - partialTicks;
    if (f4 < 0.0F) {
        f4 = 0.0F;
    }
    if (f3 > 0.0F) {
        float angle = (MathHelper.sin(f3) * f3 * f4) / 10F;
        angle = Math.min(angle, 0.8f);
        angle = Math.copySign(angle, bore.getRollingDirection());
        OpenGL.glRotatef(angle, 1.0F, 0.0F, 0.0F);
    }
    float light = bore.getBrightness();
    light = light + ((1.0f - light) * 0.4f);
    // boolean ghost = SeasonPlugin.isGhostTrain(bore);
    // if (ghost)
    // GlStateManager.enableBlend();
    int j = 0xffffff;
    float c1 = (float) (j >> 16 & 0xff) / 255F;
    float c2 = (float) (j >> 8 & 0xff) / 255F;
    float c3 = (float) (j & 0xff) / 255F;
    OpenGL.glColor4f(c1 * light, c2 * light, c3 * light, 1.0F);
    IBoreHead head = bore.getBoreHead();
    if (head != null) {
        bindTexture(head.getBoreTexture());
        modelTunnelBore.setRenderBoreHead(true);
    } else {
        bindTexture(TEXTURE);
        modelTunnelBore.setRenderBoreHead(false);
    }
    OpenGL.glScalef(-1F, -1F, 1.0F);
    modelTunnelBore.setBoreHeadRotation(bore.getBoreRotationAngle());
    modelTunnelBore.setBoreActive(bore.isMinecartPowered());
    modelTunnelBore.render(0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    // if (ghost)
    // GlStateManager.disableBlend();
    OpenGL.glPopMatrix();
}
Also used : Entity(net.minecraft.entity.Entity) IBoreHead(mods.railcraft.api.carts.IBoreHead) RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Example 45 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.renderEntity(item, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
    if (!renderManager.options.fancyGraphics) {
        OpenGL.glRotatef(180, 0, 1, 0);
        renderManager.renderEntity(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)

Aggregations

RenderManager (net.minecraft.client.renderer.entity.RenderManager)45 Tessellator (net.minecraft.client.renderer.Tessellator)8 FontRenderer (net.minecraft.client.gui.FontRenderer)7 InvokeEvent (cc.hyperium.event.InvokeEvent)4 Minecraft (net.minecraft.client.Minecraft)4 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)3 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)3 Render (net.minecraft.client.renderer.entity.Render)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 EntityItem (net.minecraft.entity.item.EntityItem)3 Field (java.lang.reflect.Field)2 EntityJuicer (micdoodle8.mods.galacticraft.planets.venus.entities.EntityJuicer)2 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)2 RenderPlayer (net.minecraft.client.renderer.entity.RenderPlayer)2 TextureManager (net.minecraft.client.renderer.texture.TextureManager)2 Entity (net.minecraft.entity.Entity)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 ItemStack (net.minecraft.item.ItemStack)2 LayerBloodElytra (WayofTime.bloodmagic.client.render.LayerBloodElytra)1 IMixinThreadDownloadImageData (cc.hyperium.mixins.client.renderer.IMixinThreadDownloadImageData)1