Search in sources :

Example 66 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.

the class GuiCustomButton method drawButton.

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
    if (this.visible) {
        FontRenderer fontrenderer = mc.fontRenderer;
        mc.getTextureManager().bindTexture(buttonTextures);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
        int k = this.getHoverState(this.hovered);
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        GlStateManager.blendFunc(770, 771);
        GuiUtils.drawContinuousTexturedBox(buttonTextures, this.x, this.y, uX + (value ? 20 : 0), uY + (k - 1) * 20, this.width, this.height, this.textureWidth, this.textureHeight, 2, 3, 2, 2, this.zLevel);
        // this.drawTexturedModalRect(this.x, this.y, uX +
        // (value ? 20 : 0), uY + (k - 1) * 20, this.width, this.height);
        this.mouseDragged(mc, mouseX, mouseY);
        int color = 14737632;
        if (packedFGColour != 0) {
            color = packedFGColour;
        } else if (!this.enabled) {
            color = 10526880;
        } else if (this.hovered) {
            color = 16777120;
        }
        String buttonText = this.displayString;
        int strWidth = mc.fontRenderer.getStringWidth(buttonText);
        int ellipsisWidth = mc.fontRenderer.getStringWidth("...");
        if (strWidth > width - 6 && strWidth > ellipsisWidth)
            buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "...";
        this.drawCenteredString(mc.fontRenderer, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 67 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.

the class GuiEnumButton method drawButton.

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
    if (this.visible) {
        FontRenderer fontrenderer = mc.fontRenderer;
        mc.getTextureManager().bindTexture(textureLocation);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
        E value = getValue();
        int ordinal = value.ordinal();
        int i = this.getHoverState(this.hovered);
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        this.drawTexturedModalRect(this.x, this.y, ordinal * width, (i - 1) * height, this.width, this.height);
        this.mouseDragged(mc, mouseX, mouseY);
        int j = 14737632;
        if (packedFGColour != 0) {
            j = packedFGColour;
        } else if (!this.enabled) {
            j = 10526880;
        } else if (this.hovered) {
            j = 16777120;
        }
        this.drawCenteredString(fontrenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, j);
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 68 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.

the class GuiSlotButton method drawButton.

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
    GlStateManager.disableLighting();
    FontRenderer fontrenderer = mc.fontRenderer;
    mc.getTextureManager().bindTexture(texture);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
    int i = this.getHoverState(this.hovered);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    this.drawTexturedModalRect(this.x, this.y, 0, 0 + (i - 1) * 18, this.width, this.height);
    this.mouseDragged(mc, mouseX, mouseY);
    if (!stack.isEmpty()) {
        RenderHelper.enableGUIStandardItemLighting();
        this.zLevel = 100.0F;
        this.itemRender.zLevel = 100.0F;
        GlStateManager.enableDepth();
        this.itemRender.renderItemAndEffectIntoGUI(this.mc.player, stack, this.x + 1, this.y + 1);
        this.itemRender.renderItemOverlayIntoGUI(fontrenderer, stack, this.x + 1, this.y + 1, "");
        this.itemRender.zLevel = 0.0F;
        this.zLevel = 0.0F;
        RenderHelper.disableStandardItemLighting();
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 69 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.

the class GuiStringList method drawSlot.

@Override
protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) {
    GlStateManager.disableLighting();
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
    int factor = scaledResolution.getScaleFactor();
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glScissor(left * factor, Minecraft.getMinecraft().displayHeight - top * factor - listHeight * factor, listWidth * factor, listHeight * factor);
    String string = stringList.get(var1);
    int color = 0xFFFFFF;
    Rectangle slotRect = new Rectangle(this.left + 3, var3, fontRenderer.getStringWidth(string), fontRenderer.FONT_HEIGHT);
    if (slotRect.contains(mouseX, mouseY)) {
        color = 0xFFD700;
    }
    fontRenderer.drawString(string, this.left + 3, var3, color);
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
    GlStateManager.enableLighting();
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) Rectangle(org.lwjgl.util.Rectangle) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 70 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.

the class GuiTriggerButton method drawButtonForegroundLayer.

@Override
public void drawButtonForegroundLayer(int mouseX, int mouseY) {
    if (this.tooltip != null) {
        try {
            Minecraft mc = Minecraft.getMinecraft();
            FontRenderer fontrenderer = mc.fontRenderer;
            String localizedToolTip = I18n.format(tooltip);
            GuiUtils.drawHoveringText(Arrays.<String>asList(new String[] { localizedToolTip }), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, fontrenderer);
        } catch (Exception e) {
        }
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer) Minecraft(net.minecraft.client.Minecraft)

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