Search in sources :

Example 11 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project ImmersiveEngineering by BluSunrize.

the class GuiClickableList method drawButton.

@Override
public void drawButton(Minecraft mc, int mx, int my) {
    FontRenderer fr = gui.manual.fontRenderer;
    boolean uni = fr.getUnicodeFlag();
    fr.setUnicodeFlag(true);
    int mmY = my - this.yPosition;
    GlStateManager.pushMatrix();
    GlStateManager.scale(textScale, textScale, textScale);
    GlStateManager.translate(xPosition / textScale, yPosition / textScale, 0);
    GlStateManager.color(1, 1, 1);
    this.hovered = mx >= xPosition && mx < xPosition + width && my >= yPosition && my < yPosition + height;
    for (int i = 0; i < Math.min(perPage, entries.length); i++) {
        int col = gui.manual.getTextColour();
        if (hovered && mmY >= i * getFontHeight() && mmY < (i + 1) * getFontHeight())
            col = gui.manual.getHighlightColour();
        if (i != 0)
            GlStateManager.translate(0, getFontHeight(), 0);
        int j = offset + i;
        if (j > entries.length - 1)
            j = entries.length - 1;
        String s = translationType == -1 ? entries[j] : translationType == 0 ? gui.manual.formatCategoryName(entries[j]) : gui.manual.formatEntryName(entries[j]);
        fr.drawString(s, 0, 0, col, false);
    }
    GlStateManager.scale(1 / textScale, 1 / textScale, 1 / textScale);
    GlStateManager.popMatrix();
    if (maxOffset > 0) {
        int h1 = offset * getFontHeight();
        int h2 = height - 8 - maxOffset * getFontHeight();
        this.drawGradientRect(xPosition + width, yPosition + h1, xPosition + width + 8, yPosition + h1 + h2, 0x0a000000, 0x0a000000);
        this.drawGradientRect(xPosition + width + 1, yPosition + h1, xPosition + width + 6, yPosition + h1 + h2, 0x28000000, 0x28000000);
        if (offset > 0)
            this.drawGradientRect(xPosition + width, yPosition, xPosition + width + 8, yPosition + h1, 0x0a000000, 0x0a000000);
        if (offset < maxOffset) {
            int h3 = (maxOffset - offset) * getFontHeight();
            this.drawGradientRect(xPosition + width, yPosition + height - 8 - h3, xPosition + width + 8, yPosition + height - 8, 0x0a000000, 0x11000000);
        }
    }
    fr.setUnicodeFlag(uni);
    //Handle DWheel
    int mouseWheel = Mouse.getEventDWheel();
    if (mouseWheel != 0 && maxOffset > 0 && Mouse.getEventNanoseconds() != prevWheelNano) {
        prevWheelNano = Mouse.getEventNanoseconds();
        if (mouseWheel < 0 && offset < maxOffset)
            offset++;
        if (mouseWheel > 0 && offset > 0)
            offset--;
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 12 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project MorePlanets by SteveKunG.

the class DarkEnergyTransformRecipeWrapper method drawInfo.

@Override
public void drawInfo(Minecraft mc, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
    int time = this.time / 20;
    String text = "Transform Time : " + time + "s * Count";
    FontRenderer fontRendererObj = mc.fontRenderer;
    int width = fontRendererObj.getStringWidth(text) / 2;
    mc.fontRenderer.drawString(text, recipeWidth - 60 - width, 38, Color.gray.getRGB());
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 13 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project MorePlanets by SteveKunG.

the class RocketCrusherRecipesWrapper method drawInfo.

@Override
public void drawInfo(Minecraft mc, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
    FurnaceRecipes furnaceRecipes = FurnaceRecipes.instance();
    float experience = 0;
    try {
        experience = furnaceRecipes.getSmeltingExperience(this.recipe.getRecipeOutput());
    } catch (Exception e) {
    }
    if (experience > 0) {
        String experienceString = GCCoreUtil.translateWithFormat("gui.jei.category.smelting.experience", experience);
        FontRenderer fontRendererObj = mc.fontRenderer;
        int stringWidth = fontRendererObj.getStringWidth(experienceString);
        fontRendererObj.drawString(experienceString, recipeWidth + 6 - stringWidth, 8, Color.gray.getRGB());
    }
}
Also used : FurnaceRecipes(net.minecraft.item.crafting.FurnaceRecipes) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 14 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project SilentGems by SilentChaos512.

the class AltarRecipeJei method drawInfo.

@Override
public void drawInfo(@Nonnull Minecraft mc, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
    if (recipe.getCatalyst() != null) {
        FontRenderer fontRender = mc.fontRenderer;
        String str = SilentGems.localizationHelper.getLocalizedString("jei", "recipe.altar.catalyst");
        int width = fontRender.getStringWidth(str);
        fontRender.drawStringWithShadow(str, 40 - width - 2, 30, 0xFFFFFF);
    }
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 15 with FontRenderer

use of net.minecraft.client.gui.FontRenderer in project SilentGems by SilentChaos512.

the class EquipmentTooltips method renderForShield.

private void renderForShield(RenderTooltipEvent.PostText event, ItemStack stack) {
    Minecraft mc = Minecraft.getMinecraft();
    FontRenderer fontRenderer = event.getFontRenderer();
    ItemStack currentEquip = mc.player.getHeldItemMainhand();
    double scale = 0.75;
    int x = (int) (event.getX() / scale);
    int y = (int) ((event.getY() - 16) / scale);
    int durability = getDurability(stack, 0);
    int equippedDurability = getDurability(currentEquip, durability);
    float magicProtection = stack.getItem() instanceof ItemGemShield ? 100f * ToolHelper.getMagicProtection(stack) : 0f;
    float equippedMagicProtection = currentEquip.getItem() instanceof ItemGemShield ? 100f * ToolHelper.getMagicProtection(currentEquip) : 0f;
    boolean bothAreShield = stack.getItem() instanceof ItemShield && currentEquip.getItem() instanceof ItemShield;
    GlStateManager.pushMatrix();
    GlStateManager.color(1f, 1f, 1f, 1f);
    GlStateManager.scale(scale, scale, scale);
    mc.renderEngine.bindTexture(TEXTURE);
    // Durability
    x = renderStat(mc, fontRenderer, 0, x, y, durability, equippedDurability, StackHelper.isValid(currentEquip));
    x = renderStat(mc, fontRenderer, 9, x, y, magicProtection, equippedMagicProtection, bothAreShield);
    lastWidth = (int) (x * scale - event.getX());
    GlStateManager.popMatrix();
}
Also used : ItemShield(net.minecraft.item.ItemShield) ItemGemShield(net.silentchaos512.gems.item.tool.ItemGemShield) FontRenderer(net.minecraft.client.gui.FontRenderer) ItemStack(net.minecraft.item.ItemStack) 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