Java Code Examples for net.minecraft.client.gui.FontRenderer#drawString()

The following examples show how to use net.minecraft.client.gui.FontRenderer#drawString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GTRenderDisplayScreen.java    From GT-Classic with GNU Lesser General Public License v3.0 9 votes vote down vote up
@Override
public void render(GTTileDisplayScreen screen, double x, double y, double z, float partialTicks, int destroyStage,
		float alpha) {
	if (screen != null && screen.shouldDraw) {
		FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
		GlStateManager.pushMatrix();
		screen.applyRotation((float) x, (float) y, (float) z);
		screen.applySize(2.5F, 4D, 4D, -0.001D);
		int bright = 0xF0;
		int brightX = bright % 65536;
		int brightY = bright / 65536;
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX, brightY);
		int i = 0;
		for (String text : screen.information.getWrapperList()) {
			i++;
			if (i > 8) {
				break;
			}
			renderer.drawString(text, (int) x + 10, (int) (y - 2) + (10 * i), Color.CYAN.getRGB());
		}
		GlStateManager.popMatrix();
	}
}
 
Example 2
Source File: MultiblockInfoRecipeWrapper.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void drawText(Minecraft minecraft, int recipeWidth) {
    String localizedName = I18n.format(infoPage.getController().getMetaFullName());
    GTUtility.drawCenteredSizedText(recipeWidth / 2, 0, localizedName, 0x333333, 1.3);
    FontRenderer fontRenderer = minecraft.fontRenderer;
    List<String> lines = Arrays.stream(infoPage.getDescription())
        .flatMap(s -> fontRenderer.listFormattedStringToWidth(s, recipeWidth).stream())
        .collect(Collectors.toList());
    for (int i = 0; i < lines.size(); i++) {
        String lineText = lines.get(i);
        int x = (recipeWidth - fontRenderer.getStringWidth(lineText)) / 2;
        int y = 8 + i * fontRenderer.FONT_HEIGHT;
        fontRenderer.drawString(lineText, x, y, 0x333333);
    }
    GlStateManager.color(1.0f, 1.0f, 1.0f);
}
 
Example 3
Source File: GuiChestHook.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public static int drawString(FontRenderer fontRenderer, String text, int x, int y, int color) {
    SkyblockAddons main = SkyblockAddons.getInstance();

    if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.SHOW_BACKPACK_PREVIEW) &&
            main.getConfigValues().isEnabled(Feature.MAKE_BACKPACK_INVENTORIES_COLORED) && BackpackManager.getOpenedBackpackColor() != null) {
        return fontRenderer.drawString(text, x,y, BackpackManager.getOpenedBackpackColor().getInventoryTextColor());
    }
    return fontRenderer.drawString(text,x,y,color);
}
 
Example 4
Source File: LabelWidget.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    String resultText = getResultText();
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    Position pos = getPosition();
    if (!xCentered) {
        fontRenderer.drawString(resultText, pos.x, pos.y, color);
    } else {
        fontRenderer.drawString(resultText,
            pos.x - fontRenderer.getStringWidth(resultText) / 2, pos.y, color);
    }
    GlStateManager.color(1.0f, 1.0f, 1.0f);
}
 
Example 5
Source File: GuiModifier.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render(GuiScreenEvent.DrawScreenEvent.Post event)
{
    FontRenderer font = Minecraft.getMinecraft().fontRenderer;

    int left = getLeft(event.getGui(), font.getStringWidth(text));
    int top = getTop(event.getGui(), font.FONT_HEIGHT);

    font.drawString(text, left, top, color.getRGB(), dropShadow);
}
 
Example 6
Source File: AboveHeadRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void render(FontRenderer fontRenderer, LevelheadComponent header, int x) {
    GlStateManager.disableDepth();
    GlStateManager.depthMask(true);
    GlStateManager.disableDepth();
    GlStateManager.depthMask(false);

    int y = 0;
    if (header.isRgb()) {
        fontRenderer.drawString(header.getValue(), x, y, new Color((float) header.getRed() / 255F, (float) header.getGreen() / 255F,
            (float) header.getBlue() / 255F, .2F).getRGB());
    } else if (header.isChroma()) {
        fontRenderer.drawString(header.getValue(), x, y, Levelhead.getInstance().getDarkRGBColor());
    } else {
        GlStateManager.color(255, 255, 255, .5F);
        fontRenderer.drawString(header.getColor() + header.getValue(), x, y, Color.WHITE.darker().darker().darker().darker().darker().getRGB() * 255);
    }
    GlStateManager.enableDepth();
    GlStateManager.depthMask(true);

    GlStateManager.color(1.0F, 1.0F, 1.0F);
    if (header.isRgb()) {
        GlStateManager.color(header.getRed(), header.getBlue(), header.getGreen(), header.getAlpha());
        fontRenderer.drawString(header.getValue(), x, y, new Color(header.getRed(), header.getGreen(), header.getBlue()).getRGB());
    } else if (header.isChroma()) {
        fontRenderer.drawString(header.getValue(), x, y, header.isChroma() ? Levelhead.getInstance().getRGBColor() : 553648127);
    } else {
        GlStateManager.color(255, 255, 255, .5F);

        fontRenderer.drawString(header.getColor() + header.getValue(), x, y, Color.WHITE.darker().getRGB());
    }
}
 
Example 7
Source File: GTJeiUUAmplifierWrapper.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
	FontRenderer font = minecraft.fontRenderer;
	int value = getEntryTicks(multiRecipe.getOutputs());
	DecimalFormat df = new DecimalFormat("###.##");
	font.drawString("Progress: " + df.format(100.0 / (1000000.0 / value)) + "%", 0, 40, Color.black.getRGB());
	font.drawString("Multiplier: " + value / 5000.0 + "X", 0, 50, Color.black.getRGB());
	font.drawString("Cost: " + NumberFormat.getNumberInstance(Locale.US).format(value)
			+ " EU", 0, 60, Color.black.getRGB());
	if (GTConfig.general.debugMode) {
		font.drawString("Recipe Id: " + multiRecipe.getRecipeID(), 0, 70, Color.black.getRGB());
	}
}
 
Example 8
Source File: HyperiumGuiPlayerTabOverlay.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void drawChromaWaveString(String text, int xIn, int y) {
    FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
    int x = xIn;
    for (char c : text.toCharArray()) {
        long dif = (x * 10) - (y * 10);
        long l = System.currentTimeMillis() - dif;
        float ff = 2000.0F;
        int i = Color.HSBtoRGB((float) (l % (int) ff) / ff, 0.8F, 0.8F);
        String tmp = String.valueOf(c);
        renderer.drawString(tmp, (float) ((double) x), (float) ((double) y), i, false);
        x += (double) renderer.getCharWidth(c);
    }
}
 
Example 9
Source File: HyperiumRender.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void drawChromaWaveString(String text, int xIn, int y) {
    FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
    int x = xIn;
    for (char c : text.toCharArray()) {
        long dif = (x * 10) - (y * 10);
        long l = System.currentTimeMillis() - dif;
        float ff = 2000.0F;
        int i = Color.HSBtoRGB((float) (l % (int) ff) / ff, 0.8F, 0.8F);
        String tmp = String.valueOf(c);
        renderer.drawString(tmp, (float) ((double) x), (float) ((double) y), i, false);
        x += (double) renderer.getCharWidth(c);
    }
}
 
Example 10
Source File: ElementRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void drawChromaString(String text, int xIn, int y) {
    FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
    int x = xIn;

    for (char c : text.toCharArray()) {
        long dif = (x * 10) - (y * 10);
        if (current.isStaticChroma()) dif = 0;
        long l = System.currentTimeMillis() - dif;
        float ff = current.isStaticChroma() ? 1000.0F : 2000.0F;
        int i = Color.HSBtoRGB((float) (l % (int) ff) / ff, 0.8F, 0.8F);
        String tmp = String.valueOf(c);
        renderer.drawString(tmp, (float) ((double) x / currentScale), (float) ((double) y / currentScale), i, current.isShadow());
        x += (double) renderer.getCharWidth(c) * currentScale;
    }
}
 
Example 11
Source File: MoCRenderDolphin.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
public void doRenderLiving2(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving;
    super.doRenderLiving(entitydolphin, d, d1, d2, f, f1);
    if (entitydolphin.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entityliving.getDistanceToEntity(renderManager.livingPlayer);
        String s = "";
        s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString();
        if ((f4 < 12F) && (s.length() > 0))
        {
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + 0.3F, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            GL11.glDepthMask(false);
            GL11.glDisable(2929 /* GL_DEPTH_TEST */);
            GL11.glEnable(3042 /* GL_BLEND */);
            GL11.glBlendFunc(770, 771);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            GL11.glDisable(3553 /* GL_TEXTURE_2D */);
            tessellator.startDrawingQuads();
            int i = fontrenderer.getStringWidth(s) / 2;
            tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
            tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
            tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
            tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
            tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
            if (MoCreatures.proxy.getDisplayPetHealth())
            {
                float f5 = entitydolphin.getHealth();
                float f6 = entitydolphin.getMaxHealth();
                float f7 = f5 / f6;
                float f8 = 40F * f7;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f8, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f8, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f8 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f8 - 20F, -10 + byte0, 0.0D);
            }
            tessellator.draw();
            GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
            GL11.glEnable(2929 /* GL_DEPTH_TEST */);
            GL11.glDepthMask(true);
            fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glDisable(3042 /* GL_BLEND */);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glPopMatrix();
        }
    }
}
 
Example 12
Source File: RenderBlockTarget.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(float partialTicks){

        double x = blockX + 0.5D;
        double y = blockY + 0.5D;
        double z = blockZ + 0.5D;

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPushMatrix();

        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);

        float red = 0.5F;
        float green = 0.5F;
        float blue = 1.0F;
        float alpha = 0.5F;

        GL11.glTranslated(x, y, z);

        // for some reason the blend function resets... that's why this line is
        // here.
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if(!getBlock().isAir(world, blockX, blockY, blockZ)) arrowRenderer.render(world, blockX, blockY, blockZ, partialTicks);

        int targetAcquireProgress = (int)((ticksExisted - 50) / 0.7F);
        GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(180.0F - RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
        if(ticksExisted <= 120 && ticksExisted > 50) {
            GL11.glColor4d(0, 1, 0, 0.8D);
            RenderProgressBar.render(0D, 0.4D, 1.8D, 0.9D, 0, targetAcquireProgress);
        }

        GL11.glEnable(GL11.GL_TEXTURE_2D);
        if(!getBlock().isAir(world, blockX, blockY, blockZ)) {
            FontRenderer fontRenderer = RenderManager.instance.getFontRenderer();

            GL11.glColor4d(red, green, blue, alpha);
            if(ticksExisted > 120) {
                GL11.glScaled(0.02D, 0.02D, 0.02D);
                stat.render(-1, -1, partialTicks);
            } else if(ticksExisted > 50) {
                GL11.glScaled(0.02D, 0.02D, 0.02D);
                fontRenderer.drawString("Acquiring Target...", 0, 0, 0x7F7F7F);
                fontRenderer.drawString(targetAcquireProgress + "%", 37, 28, 0x002F00);
            } else if(ticksExisted < -30) {
                GL11.glScaled(0.03D, 0.03D, 0.03D);
                stat.render(-1, -1, partialTicks);
                fontRenderer.drawString("Lost Target!", 0, 0, 0xFF0000);
            }
        }
        GL11.glPopMatrix();
    }
 
Example 13
Source File: HyperiumRendererLivingEntity.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderName(T entity, double x, double y, double z, RenderManager renderManager) {
    if (((IMixinRendererLivingEntity<T>) parent).callCanRenderName(entity)) {

        double d0 = entity.getDistanceSqToEntity(renderManager.livingPlayer);
        float f = entity.isSneaking() ? 32.0F : 64.0F;

        if (d0 < (double) (f * f)) {
            String s = entity.getDisplayName().getFormattedText();
            GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);

            if (entity.isSneaking() && (Settings.SHOW_OWN_NAME || !entity.equals(Minecraft.getMinecraft().thePlayer))) {
                FontRenderer fontrenderer = renderManager.getFontRenderer();
                GlStateManager.pushMatrix();
                float offset = Utils.INSTANCE.calculateDeadmauEarsOffset(entity);
                GlStateManager.translate((float) x, (float) y + offset + entity.height + 0.5F - (entity.isChild() ? entity.height / 2.0F : 0.0F), (float) z);
                GL11.glNormal3f(0.0F, 1.0F, 0.0F);
                GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
                GlStateManager.rotate(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
                GlStateManager.scale(-0.02666667F, -0.02666667F, 0.02666667F);
                GlStateManager.translate(0.0F, 9.374999F, 0.0F);
                GlStateManager.disableLighting();
                GlStateManager.depthMask(false);
                GlStateManager.enableBlend();
                GlStateManager.disableTexture2D();
                GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
                int i = fontrenderer.getStringWidth(s) / 2;
                Tessellator tessellator = Tessellator.getInstance();
                WorldRenderer worldrenderer = tessellator.getWorldRenderer();
                worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
                worldrenderer.pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                tessellator.draw();
                GlStateManager.enableTexture2D();
                GlStateManager.depthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127);
                GlStateManager.enableLighting();
                GlStateManager.disableBlend();
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                GlStateManager.popMatrix();
            } else {
                ((IMixinRender<T>) parent).callRenderOffsetLivingLabel(entity, x, y - (entity.isChild() ? (double)
                    (entity.height / 2.0F) : 0.0D), z, s, 0.02666667F, d0);
            }
        }
    }
}
 
Example 14
Source File: ConfirmationPopup.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean render() {
    if (framesLeft <= 0) return true;

    if (text.equalsIgnoreCase("Party request from " + acceptFrom)) {
        callback.accept(true);
        return true;
    }

    while (systemTime < Minecraft.getSystemTime() + (1000 / 60)) {
        framesLeft--;
        systemTime += (1000 / 60);
    }

    percentComplete = HyperiumGui.clamp(
        HyperiumGui.easeOut(
            percentComplete,
            framesLeft < lowerThreshold ? 0.0f :
                framesLeft > upperThreshold ? 1.0f : framesLeft,
            0.01f,
            15f
        ),
        0.0f,
        1.0f
    );

    FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
    ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());

    int middle = sr.getScaledWidth() / 2;
    int halfWidth = 105;
    int currWidth = (int) (halfWidth * percentComplete);

    // Background
    Gui.drawRect(
        middle - currWidth,
        50,
        middle + currWidth,
        95,
        new Color(27, 27, 27).getRGB()
    );

    if (percentComplete == 1.0F) {
        long length = upperThreshold - lowerThreshold;
        long current = framesLeft - lowerThreshold;
        float progress = 1.0F - HyperiumGui.clamp((float) current / (float) length, 0.0F, 1.0F);

        // Progress
        Gui.drawRect(
            middle - currWidth,
            93,
            (int) (middle - currWidth + (210 * progress)),
            95,
            new Color(128, 226, 126).getRGB()
        );

        fr.drawString(text, sr.getScaledWidth() / 2 - fr.getStringWidth(text) / 2, 58, 0xFFFFFF);

        String s = ChatColor.GREEN + "[Y] Accept " + ChatColor.RED + "[N] Deny";
        fr.drawString(s, sr.getScaledWidth() / 2 - fr.getStringWidth(s) / 2, 70, -1);
    }

    return false;
}
 
Example 15
Source File: GuiEditNBT.java    From NBTEdit with GNU General Public License v3.0 4 votes vote down vote up
public void drawCenteredString(FontRenderer par1FontRenderer, String par2Str, int par3, int par4, int par5) {
	par1FontRenderer.drawString(par2Str, par3 - par1FontRenderer.getStringWidth(par2Str) / 2, par4, par5);
}
 
Example 16
Source File: RenderUtils.java    From SimplyJetpacks with MIT License 4 votes vote down vote up
public static void drawStringRight(String string, FontRenderer fontRenderer, int x, int y, int color, boolean shadow) {
    fontRenderer.drawString(string, x - fontRenderer.getStringWidth(string), y, color, shadow);
}
 
Example 17
Source File: ComboBox.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks)
{
	ClickGui gui = ForgeWurst.getForgeWurst().getGui();
	float[] bgColor = gui.getBgColor();
	float[] acColor = gui.getAcColor();
	float opacity = gui.getOpacity();
	
	int x1 = getX();
	int x2 = x1 + getWidth();
	int x3 = x2 - 11;
	int x4 = x3 - popupWidth - 4;
	int y1 = getY();
	int y2 = y1 + getHeight();
	
	int scroll = getParent().isScrollingEnabled()
		? getParent().getScrollOffset() : 0;
	boolean hovering = mouseX >= x1 && mouseY >= y1 && mouseX < x2
		&& mouseY < y2 && mouseY >= -scroll
		&& mouseY < getParent().getHeight() - 13 - scroll;
	boolean hText = hovering && mouseX < x4;
	boolean hBox = hovering && mouseX >= x4;
	
	// tooltip
	if(hText)
		gui.setTooltip(setting.getDescription());
	
	// background
	GL11.glColor4f(bgColor[0], bgColor[1], bgColor[2], opacity);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2i(x1, y1);
	GL11.glVertex2i(x1, y2);
	GL11.glVertex2i(x4, y2);
	GL11.glVertex2i(x4, y1);
	GL11.glEnd();
	
	// box
	GL11.glColor4f(bgColor[0], bgColor[1], bgColor[2],
		hBox ? opacity * 1.5F : opacity);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glVertex2i(x4, y1);
	GL11.glVertex2i(x4, y2);
	GL11.glVertex2i(x2, y2);
	GL11.glVertex2i(x2, y1);
	GL11.glEnd();
	GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2i(x4, y1);
	GL11.glVertex2i(x4, y2);
	GL11.glVertex2i(x2, y2);
	GL11.glVertex2i(x2, y1);
	GL11.glEnd();
	
	// separator
	GL11.glBegin(GL11.GL_LINES);
	GL11.glVertex2i(x3, y1);
	GL11.glVertex2i(x3, y2);
	GL11.glEnd();
	
	double xa1 = x3 + 1;
	double xa2 = (x3 + x2) / 2.0;
	double xa3 = x2 - 1;
	double ya1;
	double ya2;
	
	if(popup != null && !popup.isClosing())
	{
		ya1 = y2 - 3.5;
		ya2 = y1 + 3;
		GL11.glColor4f(hBox ? 1 : 0.85F, 0, 0, 1);
	}else
	{
		ya1 = y1 + 3.5;
		ya2 = y2 - 3;
		GL11.glColor4f(0, hBox ? 1 : 0.85F, 0, 1);
	}
	
	// arrow
	GL11.glBegin(GL11.GL_TRIANGLES);
	GL11.glVertex2d(xa1, ya1);
	GL11.glVertex2d(xa3, ya1);
	GL11.glVertex2d(xa2, ya2);
	GL11.glEnd();
	
	// outline
	GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex2d(xa1, ya1);
	GL11.glVertex2d(xa3, ya1);
	GL11.glVertex2d(xa2, ya2);
	GL11.glEnd();
	
	// setting name
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	FontRenderer fr = WMinecraft.getFontRenderer();
	fr.drawString(setting.getName(), x1, y1 + 2, 0xf0f0f0);
	fr.drawString(setting.getSelected().toString(), x4 + 2, y1 + 2,
		0xf0f0f0);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
}
 
Example 18
Source File: GuiEditSingleNBT.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void drawCenteredString(FontRenderer par1FontRenderer, String par2Str, int par3, int par4, int par5) {
    par1FontRenderer.drawString(par2Str, par3 - par1FontRenderer.getStringWidth(par2Str) / 2, par4, par5);
}
 
Example 19
Source File: EntityInRangeSensor.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void drawAdditionalInfo(FontRenderer fontRenderer){
    fontRenderer.drawString("Entity filter", 195, 48, 4210752);
}
 
Example 20
Source File: RenderUtils.java    From SimplyJetpacks with MIT License 4 votes vote down vote up
public static void drawStringCenter(String string, FontRenderer fontRenderer, int x, int y, int color, boolean shadow) {
    fontRenderer.drawString(string, x - fontRenderer.getStringWidth(string) / 2, y, color, shadow);
}