Search in sources :

Example 41 with FontRenderer

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

the class GuiCombustionGenerator method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    bindGuiTexture();
    int sx = (width - xSize) / 2;
    int sy = (height - ySize) / 2;
    drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
    TileCombustionGenerator gen = getTileEntity();
    CombustionMath math = gen.getMath();
    FontRenderer fr = getFontRenderer();
    int output = 0;
    if (gen.isActive()) {
        output = math.getEnergyPerTick();
    }
    String txt = Lang.GUI_COMBGEN_OUTPUT.get(LangPower.RFt(output));
    int sw = fr.getStringWidth(txt);
    fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, guiTop + fr.FONT_HEIGHT / 2 + 3, ColorUtil.getRGB(Color.WHITE));
    int x = guiLeft + 48;
    int y = guiTop + 21;
    final SmartTank coolantTank = gen.getCoolantTank();
    if (!coolantTank.isEmpty()) {
        x = guiLeft + 114;
        // right tank
        final int fluidAmount = coolantTank.getFluidAmount();
        final FluidStack fluid = coolantTank.getFluid();
        if (fluidAmount > CENTER) {
            RenderUtil.renderGuiTank(fluid, coolantTank.getCapacity() - CENTER, fluidAmount - CENTER, x, y, zLevel, 15, 47);
        }
        if (gen.isActive()) {
            txt = LangFluid.tMB(math.getTicksPerCoolant());
            sw = fr.getStringWidth(txt);
            fr.drawStringWithShadow(txt, x - sw / 2 + 7, y + fr.FONT_HEIGHT / 2 + 47, ColorUtil.getRGB(Color.WHITE));
        }
        // center coolant chamber
        RenderUtil.renderGuiTank(fluid, CENTER, Math.min(fluidAmount, CENTER), guiLeft + 72, guiTop + 28, zLevel, 33, 33);
        // draw some gui over the top again to make the center shape
        bindGuiTexture();
        drawTexturedModalRect(guiLeft + 72, guiTop + 28, 0, 223, 33, 33);
    }
    final SmartTank fuelTank = gen.getFuelTank();
    if (!fuelTank.isEmpty()) {
        // left tank
        x = guiLeft + 48;
        final int fluidAmount = fuelTank.getFluidAmount();
        final FluidStack fluid = fuelTank.getFluid();
        if (fluidAmount > CENTER) {
            RenderUtil.renderGuiTank(fluid, fuelTank.getCapacity() - CENTER, fluidAmount - CENTER, x, y, zLevel, 15, 47);
        }
        if (gen.isActive()) {
            txt = LangFluid.tMB(math.getTicksPerFuel());
            sw = fr.getStringWidth(txt);
            fr.drawStringWithShadow(txt, x - sw / 2 + 7, y + fr.FONT_HEIGHT / 2 + 47, ColorUtil.getRGB(Color.WHITE));
        }
        // center tank
        RenderUtil.renderGuiTank(fluid, CENTER, Math.min(fluidAmount, CENTER), guiLeft + 81, guiTop + 38, zLevel, 14, 14);
    }
    bindGuiTexture();
    super.drawGuiContainerBackgroundLayer(par1, par2, par3);
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) FontRenderer(net.minecraft.client.gui.FontRenderer) SmartTank(com.enderio.core.common.fluid.SmartTank)

Example 42 with FontRenderer

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

the class GuiFarmStation method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    bindGuiTexture();
    int sx = (width - xSize) / 2;
    int sy = (height - ySize) / 2;
    GlStateManager.enableAlpha();
    drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);
    bindGuiTexture();
    super.drawGuiContainerBackgroundLayer(par1, par2, par3);
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    GlStateManager.disableDepth();
    GlStateManager.enableBlend();
    fr.drawString("SW", sx + 55, sy + 48, ColorUtil.getARGB(1f, 1f, 0.35f, 1f), true);
    fr.drawString("NW", sx + 55, sy + 66, ColorUtil.getARGB(1f, 1f, 0.35f, 1f), true);
    fr.drawString("SE", sx + 73, sy + 48, ColorUtil.getARGB(1f, 1f, 0.35f, 1f), true);
    fr.drawString("NE", sx + 73, sy + 66, ColorUtil.getARGB(1f, 1f, 0.35f, 1f), true);
    GlStateManager.disableBlend();
    GlStateManager.enableDepth();
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 43 with FontRenderer

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

the class GuiSensor method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindGuiTexture();
    int sx = (width - xSize) / 2;
    int sy = (height - ySize) / 2;
    drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
    super.drawGuiContainerBackgroundLayer(par1, par2, par3);
    String txt = EnderIO.lang.localize("gui.inventorySensor.control1").trim();
    FontRenderer fr = getFontRenderer();
    fr.drawString(txt, startTF.x - 3 - fr.getStringWidth(txt), startTF.y + 3, 0x000000);
    txt = EnderIO.lang.localize("gui.inventorySensor.control2").trim();
    fr.drawString(txt, stopTF.x - 3 - fr.getStringWidth(txt), stopTF.y + 3, 0x000000);
    checkForTextChange();
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 44 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project OpenModularTurrets by OpenModularTurretsTeam.

the class ConfigureGui method drawGuiContainerForegroundLayer.

@SuppressWarnings("unchecked")
@Override
protected void drawGuiContainerForegroundLayer(int param1, int param2) {
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    fontRenderer.drawString(safeLocalize(OMTNames.Localizations.GUI.TARGETING_OPTIONS) + ": ", 10, 8, 0);
    fontRenderer.drawString(safeLocalize(OMTNames.Localizations.GUI.ADD_TRUSTED_PLAYER) + ": ", 10, 87, 0);
    if (this.base.getTrustedPlayers().size() == 0) {
        fontRenderer.drawString("\u00A7f" + safeLocalize(OMTNames.Localizations.GUI.NO_TRUSTED_PLAYERS), 10, 124, 0);
    } else {
        fontRenderer.drawString(base.getTrustedPlayers().get(base.trustedPlayerIndex).getName() + "'s " + safeLocalize(OMTNames.Localizations.GUI.PERMISSIONS), 10, 124, 0);
    }
    textFieldAddTrustedPlayer.drawTextBox();
    drawTooltips();
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 45 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project OpenModularTurrets by OpenModularTurretsTeam.

the class ConfigureGui method initGui.

@SuppressWarnings("unchecked")
@Override
public void initGui() {
    super.initGui();
    this.buttonList.clear();
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    String mobsButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_MOBS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksMobs()));
    String neutralsButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_NEUTRALS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksNeutrals()));
    String playersButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_PLAYERS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksPlayers()));
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    textFieldAddTrustedPlayer = new GuiTextField(0, fontRenderer, 11, 99, 100, 18);
    textFieldAddTrustedPlayer.setMaxStringLength(50);
    textFieldAddTrustedPlayer.setFocused(true);
    this.buttonList.add(new GuiButton(1, x + 10, y + 20, 155, 20, mobsButton));
    this.buttonList.add(new GuiButton(2, x + 10, y + 40, 155, 20, neutralsButton));
    this.buttonList.add(new GuiButton(3, x + 10, y + 60, 155, 20, playersButton));
    this.buttonList.add(new GuiButton(4, x + 114, y + 98, 51, 20, "+"));
    this.buttonList.add(new GuiButton(5, x + 35, y + 135, 30, 20, "-"));
    this.buttonList.add(new GuiButton(6, x + 10, y + 135, 20, 20, "<<"));
    this.buttonList.add(new GuiButton(7, x + 145, y + 135, 20, 20, ">>"));
    if (this.base.getTrustedPlayers().size() > 0) {
        this.buttonList.add(new GuiButton(8, x + 70, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canOpenGUI ? "\u00A72Y" : "\u00A7cN"));
        this.buttonList.add(new GuiButton(9, x + 93, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canChangeTargeting ? "\u00A72Y" : "\u00A7cN"));
        this.buttonList.add(new GuiButton(10, x + 116, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).admin ? "\u00A72Y" : "\u00A7cN"));
    } else {
        this.buttonList.add(new GuiButton(8, x + 70, y + 135, 23, 20, "?"));
        this.buttonList.add(new GuiButton(9, x + 93, y + 135, 23, 20, "?"));
        this.buttonList.add(new GuiButton(10, x + 116, y + 135, 23, 20, "?"));
    }
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) FontRenderer(net.minecraft.client.gui.FontRenderer) TextComponentString(net.minecraft.util.text.TextComponentString) GuiTextField(net.minecraft.client.gui.GuiTextField)

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