Search in sources :

Example 31 with FontRenderer

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

the class MobNameOverlayRenderHelper method doItemOverlayIntoGUI.

@SideOnly(Side.CLIENT)
public static void doItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition) {
    if (EnderIO.proxy.getClientPlayer().isSneaking() || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        CapturedMob capturedMob = CapturedMob.create(stack);
        if (capturedMob != null) {
            String name = capturedMob.getDisplayName();
            int idx = (int) ((EnderIO.proxy.getTickCount() / 4) % name.length());
            name = (name + " " + name).substring(idx, idx + 3);
            FontRenderer fr = Minecraft.getMinecraft().getRenderManager().getFontRenderer();
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableBlend();
            GlStateManager.enableBlend();
            fr.drawStringWithShadow(name, xPosition + 8 - fr.getStringWidth(name) / 2, yPosition + 5, 0xFF0030B0);
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
            GlStateManager.enableBlend();
        }
    }
}
Also used : CapturedMob(crazypants.enderio.util.CapturedMob) FontRenderer(net.minecraft.client.gui.FontRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 32 with FontRenderer

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

the class GuiDialingDeviceNoTelepad method renderInfoMessage.

private void renderInfoMessage(int sx, int sy, @Nonnull String txt, int color) {
    FontRenderer fnt = Minecraft.getMinecraft().fontRenderer;
    fnt.drawString(txt, sx + xSize / 2 - fnt.getStringWidth(txt) / 2, sy + progressY + fnt.FONT_HEIGHT + 6, color);
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 33 with FontRenderer

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

the class GuiTargetList method drawElement.

@Override
protected void drawElement(int elementIndex, int x, int y, int heightIn, @Nonnull BufferBuilder renderer) {
    TelepadTarget targ = getElementAt(elementIndex);
    String name = targ.getName();
    if (name.trim().length() == 0) {
        name = Lang.GUI_TELEPAD_UNNAMED_LOCATION.get();
    }
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    fr.drawString(name, x + 4, y + 2, 0xffffff, true);
    if (getSelectedElement() == targ) {
        Rectangle iconBounds = getIconBounds(y);
        EnderWidget icon = EnderWidget.X_BUT;
        // TODO no access to these vars anymore
        // if(iconBounds.contains(mouseX, mouseY)) {
        // icon = EnderWidget.X_BUT_HOVER;
        // }
        EnderWidget.map.render(icon, iconBounds.x, iconBounds.y, iconBounds.width, iconBounds.height, 0, true);
    }
}
Also used : TelepadTarget(crazypants.enderio.base.item.coordselector.TelepadTarget) Rectangle(java.awt.Rectangle) FontRenderer(net.minecraft.client.gui.FontRenderer) EnderWidget(com.enderio.core.client.render.EnderWidget)

Example 34 with FontRenderer

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

the class GuiTelePad method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    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, this.xSize, this.ySize);
    // draw power / fluid background
    int u = TelePadConfig.telepadFluidUse.get() > 0 ? 200 : 187;
    int v = 0;
    drawTexturedModalRect(sx + powerX - 1, sy + powerY - 1, u, v, 12, 122);
    if (TelePadConfig.telepadFluidUse.get() > 0 && te.getFluidAmount() > 0) {
        RenderUtil.renderGuiTank(te.getTank(), sx + fluidX, sy + fluidY, 0, 10, fluidScale);
        bindGuiTexture();
        drawTexturedModalRect(sx + fluidX, sy + fluidY, 213, v, 10, fluidScale);
    }
    int progressScaled = Util.getProgressScaled(progressScale, te);
    drawTexturedModalRect(sx + progressX, sy + progressY, 0, ySize, progressScaled, 10);
    FontRenderer fnt = getFontRenderer();
    String[] text = { "X", "Y", "Z", "DIM" };
    for (int i = 0; i < text.length; i++) {
        TextFieldEnder f = textFields.get(i);
        fnt.drawString(NullHelper.first(text[i]), f.x - (fnt.getStringWidth(NullHelper.first(text[i], "")) / 2) - 10, f.y + ((f.height - fnt.FONT_HEIGHT) / 2) + 1, 0x000000);
        if (!f.getCanLoseFocus()) {
            IconEIO.map.render(IconEIO.LOCK_LOCKED, f.x + f.width - 2, f.y - 2, true);
        }
    }
    Entity e = te.getCurrentTarget();
    if (e != null) {
        String name = e.getName();
        fnt.drawString(name, sx + xSize / 2 - fnt.getStringWidth(name) / 2, sy + progressY + fnt.FONT_HEIGHT + 6, 0x000000);
    } else if (te.wasBlocked()) {
        String s = Lang.GUI_TELEPAD_ERROR_BLOCKED.get();
        fnt.drawString(s, sx + xSize / 2 - fnt.getStringWidth(s) / 2, sy + progressY + fnt.FONT_HEIGHT + 6, 0xAA0000);
    }
    String name = te.getTarget().getName();
    fnt.drawStringWithShadow(name, sx + xSize / 2 - fnt.getStringWidth(name) / 2, getGuiTop() + 10, 0xffffff);
    super.drawGuiContainerBackgroundLayer(p_146976_1_, p_146976_2_, p_146976_3_);
}
Also used : Entity(net.minecraft.entity.Entity) FontRenderer(net.minecraft.client.gui.FontRenderer) TextFieldEnder(com.enderio.core.client.gui.widget.TextFieldEnder)

Example 35 with FontRenderer

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

the class GuiVacuumChest method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) {
    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, this.xSize, this.ySize);
    int headerColor = 0x404040;
    FontRenderer fr = getFontRenderer();
    fr.drawString(headerChest, sx + 7, sy + 6, headerColor);
    fr.drawString(headerFilter, sx + 7, sy + 74, headerColor);
    fr.drawString(headerRange, sx + xSize - 7 - fr.getStringWidth(headerRange), sy + 74, headerColor);
    fr.drawString(headerInventory, sx + 7, sy + 111, headerColor);
    IconEIO.map.render(EnderWidget.BUTTON_DOWN, sx + RANGE_LEFT, sy + RANGE_TOP, RANGE_WIDTH, 16, 0, true);
    String str = Integer.toString((int) te.getRange());
    int sw = fr.getStringWidth(str);
    fr.drawString(str, sx + RANGE_LEFT + RANGE_WIDTH - sw - 5, sy + RANGE_TOP + 5, ColorUtil.getRGB(Color.black));
    super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY);
}
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