Search in sources :

Example 6 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project Totemic by TeamTotemic.

the class PageCeremony method renderScreen.

@Override
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    relativeMouseX = mx;
    relativeMouseY = my;
    Minecraft mc = Minecraft.getMinecraft();
    TextureManager render = mc.renderEngine;
    FontRenderer font = mc.fontRenderer;
    List<MusicInstrument> instruments = ceremony.getSelectors();
    int instrLeft = gui.getLeft() + gui.getWidth() / 2 - 10 * instruments.size();
    for (int i = 0; i < instruments.size(); i++) {
        ItemStack item = instruments.get(i).getItem();
        if (!item.isEmpty())
            renderItem(gui, instrLeft + 20 * i, gui.getTop() + 31, item, false);
    }
    if (!tooltipStack.isEmpty())
        RenderHelper.renderTooltip(mx, my, tooltipStack.getTooltip(mc.player, TooltipFlags.NORMAL));
    String text = I18n.format("totemicmisc.musicSelector");
    font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 14, 0x999999);
    boolean unicode = font.getUnicodeFlag();
    font.setUnicodeFlag(true);
    text = I18n.format(TotemUtil.getMusicNeeded(ceremony.getMusicNeeded()));
    font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 90, 0x000000);
    text = I18n.format(getUnlocalizedName());
    font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 150, 0x000000);
    font.setUnicodeFlag(unicode);
    render.bindTexture(ceremonyOverlay);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.color(1F, 1F, 1F, 1F);
    ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
    GlStateManager.disableBlend();
    tooltipStack = tooltipContainerStack = ItemStack.EMPTY;
    tooltipEntry = false;
    mouseDownLastTick = Mouse.isButtonDown(0);
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) MusicInstrument(pokefenn.totemic.api.music.MusicInstrument) GuiScreen(net.minecraft.client.gui.GuiScreen) FontRenderer(net.minecraft.client.gui.FontRenderer) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft)

Example 7 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project Totemic by TeamTotemic.

the class PageText method renderText.

@SideOnly(Side.CLIENT)
public static void renderText(int x, int y, int width, int height, String unlocalizedText) {
    FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
    boolean unicode = renderer.getUnicodeFlag();
    renderer.setUnicodeFlag(true);
    String text = I18n.format(unlocalizedText);
    String[] textEntries = text.split("<br>");
    for (String entry : textEntries) {
        for (// This method handles both format and line wraps, no need to write one yourself. Fix lines going off the edge.
        String line : // This method handles both format and line wraps, no need to write one yourself. Fix lines going off the edge.
        renderer.listFormattedStringToWidth(entry, width)) {
            y += 10;
            renderer.drawString(line, x, y, 0);
        }
        y += 10;
    }
    renderer.setUnicodeFlag(unicode);
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project SecurityCraft by Geforce132.

the class GuiItemButton method drawButton.

/**
 * Draws this button to the screen.
 */
@Override
public void drawButton(Minecraft par1, int par2, int par3, float f) {
    if (visible) {
        FontRenderer var4 = par1.fontRenderer;
        par1.getTextureManager().bindTexture(BUTTON_TEXTURES);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
        int var5 = getHoverState(hovered);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        this.drawTexturedModalRect(x, y, 0, 46 + var5 * 20, width / 2, height);
        this.drawTexturedModalRect(x + width / 2, y, 200 - width / 2, 46 + var5 * 20, width / 2, height);
        if (blockToRender != null) {
            // (this.width / 2) - 8
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(blockToRender), x + 2, y + 3);
            itemRenderer.renderItemOverlayIntoGUI(par1.fontRenderer, new ItemStack(blockToRender), x + 2, y + 3, "");
        } else {
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(itemToRender), x + 2, y + 2);
            itemRenderer.renderItemOverlayIntoGUI(par1.fontRenderer, new ItemStack(itemToRender), x + 2, y + 2, "");
            GL11.glDisable(GL11.GL_LIGHTING);
        }
        mouseDragged(par1, par2, par3);
        int var6 = 14737632;
        if (!enabled)
            var6 = 10526880;
        else if (hovered)
            var6 = 16777120;
        drawCenteredString(var4, displayString, x + width / 2, y + (height - 8) / 2, var6);
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer) ItemStack(net.minecraft.item.ItemStack)

Example 9 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project SecurityCraft by Geforce132.

the class GuiLinkedText method drawButton.

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float f) {
    if (visible) {
        FontRenderer fontrenderer = mc.fontRenderer;
        mouseDragged(mc, mouseX, mouseY);
        drawCenteredString(fontrenderer, TextFormatting.UNDERLINE + displayString, x + width / 2, y + (height - 8) / 2, textColor);
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 10 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project SecurityCraft by Geforce132.

the class GuiItemButton method drawButton.

/**
 * Draws this button to the screen.
 */
@Override
public void drawButton(Minecraft par1, int par2, int par3) {
    if (visible) {
        FontRenderer var4 = par1.fontRendererObj;
        par1.getTextureManager().bindTexture(buttonTextures);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
        int var5 = getHoverState(hovered);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        this.drawTexturedModalRect(xPosition, yPosition, 0, 46 + var5 * 20, width / 2, height);
        this.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + var5 * 20, width / 2, height);
        if (blockToRender != null) {
            // (this.width / 2) - 8
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(blockToRender), xPosition + 2, yPosition + 3);
            itemRenderer.renderItemOverlayIntoGUI(par1.fontRendererObj, new ItemStack(blockToRender), xPosition + 2, yPosition + 3, "");
        } else {
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(itemToRender), xPosition + 2, yPosition + 2);
            itemRenderer.renderItemOverlayIntoGUI(par1.fontRendererObj, new ItemStack(itemToRender), xPosition + 2, yPosition + 2, "");
            GL11.glDisable(GL11.GL_LIGHTING);
        }
        mouseDragged(par1, par2, par3);
        int var6 = 14737632;
        if (!enabled)
            var6 = 10526880;
        else if (hovered)
            var6 = 16777120;
        drawCenteredString(var4, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, var6);
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer) ItemStack(net.minecraft.item.ItemStack)

Aggregations

FontRenderer (net.minecraft.client.gui.FontRenderer)266 ScaledResolution (net.minecraft.client.gui.ScaledResolution)45 Minecraft (net.minecraft.client.Minecraft)39 ItemStack (net.minecraft.item.ItemStack)30 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)13 ArrayList (java.util.ArrayList)12 Tessellator (net.minecraft.client.renderer.Tessellator)11 RenderItem (net.minecraft.client.renderer.RenderItem)10 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)10 EntityPlayer (net.minecraft.entity.player.EntityPlayer)8 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)7 IBlockState (net.minecraft.block.state.IBlockState)6 Block (net.minecraft.block.Block)5 GuiButton (net.minecraft.client.gui.GuiButton)5 List (java.util.List)4 RenderManager (net.minecraft.client.renderer.entity.RenderManager)4 ResourceLocation (net.minecraft.util.ResourceLocation)4 IGuiRect (betterquesting.api2.client.gui.misc.IGuiRect)3 Bounds (ivorius.reccomplex.gui.table.Bounds)3 Item (net.minecraft.item.Item)3