Search in sources :

Example 51 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project BetterQuesting by Funwayguy.

the class PanelTextBox method setText.

public PanelTextBox setText(String text) {
    this.text = text;
    IGuiRect bounds = this.getTransform();
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    if (autoFit) {
        List<String> sl = fr.listFormattedStringToWidth(text, bounds.getWidth());
        lines = sl.size() - 1;
        this.transform.h = fr.FONT_HEIGHT * sl.size();
    } else {
        lines = (bounds.getHeight() / fr.FONT_HEIGHT) - 1;
    }
    return this;
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 52 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project BetterQuesting by Funwayguy.

the class PanelTextBox method drawPanel.

@Override
public void drawPanel(int mx, int my, float partialTick) {
    IGuiRect bounds = this.getTransform();
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    int w = fr.getStringWidth(text);
    int bw = bounds.getWidth();
    if (align == 2 && bw >= w) {
        RenderUtils.drawSplitString(fr, text, bounds.getX() + bounds.getWidth() - w, bounds.getY(), bounds.getWidth(), color.getRGB(), shadow, 0, lines);
    } else if (align == 1 && bw >= w) {
        RenderUtils.drawSplitString(fr, text, bounds.getX() + bounds.getWidth() / 2 - w / 2, bounds.getY(), bounds.getWidth(), color.getRGB(), shadow, 0, lines);
    } else {
        RenderUtils.drawSplitString(fr, text, bounds.getX(), bounds.getY(), bounds.getWidth(), color.getRGB(), shadow, 0, lines);
    }
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 53 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project BetterQuesting by Funwayguy.

the class PanelTextBox method initPanel.

@Override
public void initPanel() {
    IGuiRect bounds = this.getTransform();
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    if (!autoFit) {
        lines = (bounds.getHeight() / fr.FONT_HEIGHT) - 1;
        return;
    }
    List<String> sl = fr.listFormattedStringToWidth(text, bounds.getWidth());
    lines = sl.size() - 1;
    this.transform.h = fr.FONT_HEIGHT * sl.size();
}
Also used : IGuiRect(betterquesting.api2.client.gui.misc.IGuiRect) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 54 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project EnderIO by SleepyTrousers.

the class GuiCapBank method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    requestStateUpdate();
    GlStateManager.color(1, 1, 1);
    bindGuiTexture();
    int sx = (width - xSize) / 2;
    int sy = (height - ySize) / 2;
    drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
    for (int i = 0; i < buttonList.size(); ++i) {
        GuiButton guibutton = buttonList.get(i);
        guibutton.drawButton(mc, 0, 0, par1);
    }
    int midX = sx + xSize / 2;
    String str = Lang.GUI_CAPBANK_MAX_IO.get() + " " + LangPower.RFt(network.getMaxIO());
    FontRenderer fr = getFontRenderer();
    int swid = fr.getStringWidth(str);
    int x = midX - swid / 2;
    int y = guiTop + 5;
    drawString(fr, str, x, y, -1);
    str = Lang.GUI_CAPBANK_MAX_INPUT.get() + ":";
    swid = fr.getStringWidth(str);
    x = guiLeft + inputX - swid - 26;
    y = guiTop + inputY + 2;
    drawString(fr, str, x, y, -1);
    str = Lang.GUI_CAPBANK_MAX_OUTPUT.get() + ":";
    swid = fr.getStringWidth(str);
    x = guiLeft + outputX - swid - 26;
    y = guiTop + outputY + 2;
    drawString(fr, str, x, y, -1);
    super.drawGuiContainerBackgroundLayer(par1, par2, par3);
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 55 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project EnderIO by SleepyTrousers.

the class ItemSettings method renderCustomOptions.

@Override
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
    FontRenderer fr = gui.getFontRenderer();
    GlStateManager.color(1, 1, 1);
    IconEIO.map.render(EnderWidget.BUTTON_DOWN, left + priLeft, top - 5, priWidth, 16, 0, true);
    String str = itemConduit.getOutputPriority(gui.getDir()) + "";
    int sw = fr.getStringWidth(str);
    String priority = Lang.GUI_PRIORITY.get();
    fr.drawString(priority, left + 12, top + 25, ColorUtil.getRGB(Color.black));
    fr.drawString(str, left + priLeft + priWidth - sw - gap, top + 25, ColorUtil.getRGB(Color.black));
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

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