Search in sources :

Example 6 with ITextProperties

use of net.minecraft.util.text.ITextProperties in project Magma-1.16.x by magmafoundation.

the class GuiUtils method drawHoveringText.

/**
 * Use this version if calling from somewhere where ItemStack context is available.
 *
 * @see #drawHoveringText(MatrixStack, List, int, int, int, int, int, int, int, int, FontRenderer)
 */
// TODO, Validate rendering is the same as the original
public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) {
    if (!textLines.isEmpty()) {
        RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mStack, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
        if (MinecraftForge.EVENT_BUS.post(event))
            return;
        mouseX = event.getX();
        mouseY = event.getY();
        screenWidth = event.getScreenWidth();
        screenHeight = event.getScreenHeight();
        maxTextWidth = event.getMaxWidth();
        font = event.getFontRenderer();
        RenderSystem.disableRescaleNormal();
        RenderSystem.disableDepthTest();
        int tooltipTextWidth = 0;
        for (ITextProperties textLine : textLines) {
            int textLineWidth = font.width(textLine);
            if (textLineWidth > tooltipTextWidth)
                tooltipTextWidth = textLineWidth;
        }
        boolean needsWrap = false;
        int titleLinesCount = 1;
        int tooltipX = mouseX + 12;
        if (tooltipX + tooltipTextWidth + 4 > screenWidth) {
            tooltipX = mouseX - 16 - tooltipTextWidth;
            if (// if the tooltip doesn't fit on the screen
            tooltipX < 4) {
                if (mouseX > screenWidth / 2)
                    tooltipTextWidth = mouseX - 12 - 8;
                else
                    tooltipTextWidth = screenWidth - 16 - mouseX;
                needsWrap = true;
            }
        }
        if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth) {
            tooltipTextWidth = maxTextWidth;
            needsWrap = true;
        }
        if (needsWrap) {
            int wrappedTooltipWidth = 0;
            List<ITextProperties> wrappedTextLines = new ArrayList<>();
            for (int i = 0; i < textLines.size(); i++) {
                ITextProperties textLine = textLines.get(i);
                List<ITextProperties> wrappedLine = font.getSplitter().splitLines(textLine, tooltipTextWidth, Style.EMPTY);
                if (i == 0)
                    titleLinesCount = wrappedLine.size();
                for (ITextProperties line : wrappedLine) {
                    int lineWidth = font.width(line);
                    if (lineWidth > wrappedTooltipWidth)
                        wrappedTooltipWidth = lineWidth;
                    wrappedTextLines.add(line);
                }
            }
            tooltipTextWidth = wrappedTooltipWidth;
            textLines = wrappedTextLines;
            if (mouseX > screenWidth / 2)
                tooltipX = mouseX - 16 - tooltipTextWidth;
            else
                tooltipX = mouseX + 12;
        }
        int tooltipY = mouseY - 12;
        int tooltipHeight = 8;
        if (textLines.size() > 1) {
            tooltipHeight += (textLines.size() - 1) * 10;
            if (textLines.size() > titleLinesCount)
                // gap between title lines and next lines
                tooltipHeight += 2;
        }
        if (tooltipY < 4)
            tooltipY = 4;
        else if (tooltipY + tooltipHeight + 4 > screenHeight)
            tooltipY = screenHeight - tooltipHeight - 4;
        final int zLevel = 400;
        RenderTooltipEvent.Color colorEvent = new RenderTooltipEvent.Color(stack, textLines, mStack, tooltipX, tooltipY, font, backgroundColor, borderColorStart, borderColorEnd);
        MinecraftForge.EVENT_BUS.post(colorEvent);
        backgroundColor = colorEvent.getBackground();
        borderColorStart = colorEvent.getBorderStart();
        borderColorEnd = colorEvent.getBorderEnd();
        mStack.pushPose();
        Matrix4f mat = mStack.last().pose();
        // TODO, lots of unnessesary GL calls here, we can buffer all these together.
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
        drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd);
        MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, textLines, mStack, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight));
        IRenderTypeBuffer.Impl renderType = IRenderTypeBuffer.immediate(Tessellator.getInstance().getBuilder());
        mStack.translate(0.0D, 0.0D, zLevel);
        int tooltipTop = tooltipY;
        for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
            ITextProperties line = textLines.get(lineNumber);
            if (line != null)
                font.drawInBatch(LanguageMap.getInstance().getVisualOrder(line), (float) tooltipX, (float) tooltipY, -1, true, mat, renderType, false, 0, 15728880);
            if (lineNumber + 1 == titleLinesCount)
                tooltipY += 2;
            tooltipY += 10;
        }
        renderType.endBatch();
        mStack.popPose();
        MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, mStack, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight));
        RenderSystem.enableDepthTest();
        RenderSystem.enableRescaleNormal();
    }
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties) ArrayList(java.util.ArrayList) Matrix4f(net.minecraft.util.math.vector.Matrix4f) RenderTooltipEvent(net.minecraftforge.client.event.RenderTooltipEvent) IRenderTypeBuffer(net.minecraft.client.renderer.IRenderTypeBuffer)

Example 7 with ITextProperties

use of net.minecraft.util.text.ITextProperties in project LoliServer by Loli-Server.

the class GuiUtils method drawHoveringText.

/**
 * Use this version if calling from somewhere where ItemStack context is available.
 *
 * @see #drawHoveringText(MatrixStack, List, int, int, int, int, int, int, int, int, FontRenderer)
 */
// TODO, Validate rendering is the same as the original
public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) {
    if (!textLines.isEmpty()) {
        RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mStack, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
        if (MinecraftForge.EVENT_BUS.post(event))
            return;
        mouseX = event.getX();
        mouseY = event.getY();
        screenWidth = event.getScreenWidth();
        screenHeight = event.getScreenHeight();
        maxTextWidth = event.getMaxWidth();
        font = event.getFontRenderer();
        RenderSystem.disableRescaleNormal();
        RenderSystem.disableDepthTest();
        int tooltipTextWidth = 0;
        for (ITextProperties textLine : textLines) {
            int textLineWidth = font.width(textLine);
            if (textLineWidth > tooltipTextWidth)
                tooltipTextWidth = textLineWidth;
        }
        boolean needsWrap = false;
        int titleLinesCount = 1;
        int tooltipX = mouseX + 12;
        if (tooltipX + tooltipTextWidth + 4 > screenWidth) {
            tooltipX = mouseX - 16 - tooltipTextWidth;
            if (// if the tooltip doesn't fit on the screen
            tooltipX < 4) {
                if (mouseX > screenWidth / 2)
                    tooltipTextWidth = mouseX - 12 - 8;
                else
                    tooltipTextWidth = screenWidth - 16 - mouseX;
                needsWrap = true;
            }
        }
        if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth) {
            tooltipTextWidth = maxTextWidth;
            needsWrap = true;
        }
        if (needsWrap) {
            int wrappedTooltipWidth = 0;
            List<ITextProperties> wrappedTextLines = new ArrayList<>();
            for (int i = 0; i < textLines.size(); i++) {
                ITextProperties textLine = textLines.get(i);
                List<ITextProperties> wrappedLine = font.getSplitter().splitLines(textLine, tooltipTextWidth, Style.EMPTY);
                if (i == 0)
                    titleLinesCount = wrappedLine.size();
                for (ITextProperties line : wrappedLine) {
                    int lineWidth = font.width(line);
                    if (lineWidth > wrappedTooltipWidth)
                        wrappedTooltipWidth = lineWidth;
                    wrappedTextLines.add(line);
                }
            }
            tooltipTextWidth = wrappedTooltipWidth;
            textLines = wrappedTextLines;
            if (mouseX > screenWidth / 2)
                tooltipX = mouseX - 16 - tooltipTextWidth;
            else
                tooltipX = mouseX + 12;
        }
        int tooltipY = mouseY - 12;
        int tooltipHeight = 8;
        if (textLines.size() > 1) {
            tooltipHeight += (textLines.size() - 1) * 10;
            if (textLines.size() > titleLinesCount)
                // gap between title lines and next lines
                tooltipHeight += 2;
        }
        if (tooltipY < 4)
            tooltipY = 4;
        else if (tooltipY + tooltipHeight + 4 > screenHeight)
            tooltipY = screenHeight - tooltipHeight - 4;
        final int zLevel = 400;
        RenderTooltipEvent.Color colorEvent = new RenderTooltipEvent.Color(stack, textLines, mStack, tooltipX, tooltipY, font, backgroundColor, borderColorStart, borderColorEnd);
        MinecraftForge.EVENT_BUS.post(colorEvent);
        backgroundColor = colorEvent.getBackground();
        borderColorStart = colorEvent.getBorderStart();
        borderColorEnd = colorEvent.getBorderEnd();
        mStack.pushPose();
        Matrix4f mat = mStack.last().pose();
        // TODO, lots of unnessesary GL calls here, we can buffer all these together.
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
        drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart);
        drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd);
        MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, textLines, mStack, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight));
        IRenderTypeBuffer.Impl renderType = IRenderTypeBuffer.immediate(Tessellator.getInstance().getBuilder());
        mStack.translate(0.0D, 0.0D, zLevel);
        int tooltipTop = tooltipY;
        for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
            ITextProperties line = textLines.get(lineNumber);
            if (line != null)
                font.drawInBatch(LanguageMap.getInstance().getVisualOrder(line), (float) tooltipX, (float) tooltipY, -1, true, mat, renderType, false, 0, 15728880);
            if (lineNumber + 1 == titleLinesCount)
                tooltipY += 2;
            tooltipY += 10;
        }
        renderType.endBatch();
        mStack.popPose();
        MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, mStack, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight));
        RenderSystem.enableDepthTest();
        RenderSystem.enableRescaleNormal();
    }
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties) ArrayList(java.util.ArrayList) Matrix4f(net.minecraft.util.math.vector.Matrix4f) RenderTooltipEvent(net.minecraftforge.client.event.RenderTooltipEvent) IRenderTypeBuffer(net.minecraft.client.renderer.IRenderTypeBuffer)

Example 8 with ITextProperties

use of net.minecraft.util.text.ITextProperties in project AstralSorcery by HellFirePvP.

the class ScreenJournalOverlayPerkStatistics method drawHeader.

private void drawHeader(MatrixStack renderStack) {
    ITextProperties title = new TranslationTextComponent("perk.reader.astralsorcery.gui");
    List<IReorderingProcessor> lines = font.trimStringToWidth(title, MathHelper.floor(HEADER_WIDTH / 1.4F));
    int step = 14;
    float offsetTop = guiTop + 15 - (lines.size() * step) / 2F;
    renderStack.push();
    renderStack.translate(0, offsetTop, 0);
    for (int i = 0; i < lines.size(); i++) {
        IReorderingProcessor line = lines.get(i);
        float offsetLeft = width / 2F - (font.func_243245_a(line) * 1.4F) / 2F;
        renderStack.push();
        renderStack.translate(offsetLeft, i * step, 0);
        renderStack.scale(1.4F, 1.4F, 1F);
        RenderingDrawUtils.renderStringAt(line, renderStack, font, 0xEE333333, false);
        renderStack.pop();
    }
    renderStack.pop();
}
Also used : IReorderingProcessor(net.minecraft.util.IReorderingProcessor) ITextProperties(net.minecraft.util.text.ITextProperties) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

Example 9 with ITextProperties

use of net.minecraft.util.text.ITextProperties in project AstralSorcery by HellFirePvP.

the class RenderingOverlayUtils method renderDefaultItemDisplay.

public static void renderDefaultItemDisplay(MatrixStack renderStack, List<Tuple<ItemStack, Integer>> itemStacks) {
    int heightNormal = 26;
    int heightSplit = 13;
    int width = 26;
    int offsetX = 30;
    int offsetY = 15;
    ItemRenderer itemRender = Minecraft.getInstance().getItemRenderer();
    FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    // Draw background frame
    int tempY = offsetY;
    for (int i = 0; i < itemStacks.size(); i++) {
        boolean first = i == 0;
        boolean last = i + 1 == itemStacks.size();
        float currentY = tempY;
        if (first) {
            // Draw upper half of the 1st slot
            TexturesAS.TEX_OVERLAY_ITEM_FRAME.bindTexture();
            RenderingUtils.draw(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX, buf -> {
                Matrix4f offset = renderStack.getLast().getMatrix();
                buf.pos(offset, offsetX, currentY + heightSplit, 10).tex(0, 0.5F).endVertex();
                buf.pos(offset, offsetX + width, currentY + heightSplit, 10).tex(1, 0.5F).endVertex();
                buf.pos(offset, offsetX + width, currentY, 10).tex(1, 0).endVertex();
                buf.pos(offset, offsetX, currentY, 10).tex(0, 0).endVertex();
            });
            tempY += heightSplit;
        } else {
            // Draw lower half and upper next half of the sequence
            TexturesAS.TEX_OVERLAY_ITEM_FRAME_EXTENSION.bindTexture();
            RenderingUtils.draw(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX, buf -> {
                Matrix4f offset = renderStack.getLast().getMatrix();
                buf.pos(offset, offsetX, currentY + heightNormal, 10).tex(0, 1).endVertex();
                buf.pos(offset, offsetX + width, currentY + heightNormal, 10).tex(1, 1).endVertex();
                buf.pos(offset, offsetX + width, currentY, 10).tex(1, 0).endVertex();
                buf.pos(offset, offsetX, currentY, 10).tex(0, 0).endVertex();
            });
            tempY += heightNormal;
        }
        if (last) {
            float drawY = tempY;
            // Draw lower half of the slot
            TexturesAS.TEX_OVERLAY_ITEM_FRAME.bindTexture();
            RenderingUtils.draw(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX, buf -> {
                Matrix4f offset = renderStack.getLast().getMatrix();
                buf.pos(offset, offsetX, drawY + heightSplit, 10).tex(0, 1).endVertex();
                buf.pos(offset, offsetX + width, drawY + heightSplit, 10).tex(1, 1).endVertex();
                buf.pos(offset, offsetX + width, drawY, 10).tex(1, 0.5F).endVertex();
                buf.pos(offset, offsetX, drawY, 10).tex(0, 0.5F).endVertex();
            });
            tempY += heightSplit;
        }
    }
    RenderSystem.disableBlend();
    BlockAtlasTexture.getInstance().bindTexture();
    // Draw itemstacks on frame
    tempY = offsetY;
    for (Tuple<ItemStack, Integer> stackTpl : itemStacks) {
        renderStack.push();
        renderStack.translate(offsetX + 5, tempY + 5, 0);
        RenderingUtils.renderItemStackGUI(renderStack, stackTpl.getA(), null);
        renderStack.pop();
        tempY += heightNormal;
    }
    // Draw itemstack counts
    renderStack.push();
    renderStack.translate(offsetX + 14, offsetY + 16, 0);
    int txtColor = 0x00DDDDDD;
    for (Tuple<ItemStack, Integer> stackTpl : itemStacks) {
        ItemStack stack = stackTpl.getA();
        FontRenderer fr;
        if ((fr = stack.getItem().getFontRenderer(stack)) == null) {
            fr = fontRenderer;
        }
        String amountStr = String.valueOf(stackTpl.getB());
        if (stackTpl.getB() == -1) {
            // +Inf
            amountStr = "\u221E";
        }
        ITextProperties prop = new StringTextComponent(amountStr);
        int length = fontRenderer.getStringPropertyWidth(prop);
        renderStack.push();
        renderStack.translate(-length / 3F, 0, 500);
        renderStack.scale(0.7F, 0.7F, 1F);
        if (amountStr.length() > 3) {
            renderStack.scale(0.9F, 0.9F, 1F);
        }
        RenderingDrawUtils.renderStringAt(fr, renderStack, prop, txtColor);
        renderStack.pop();
        renderStack.translate(0, heightNormal, 0);
    }
    renderStack.pop();
}
Also used : Matrix4f(net.minecraft.util.math.vector.Matrix4f) ItemRenderer(net.minecraft.client.renderer.ItemRenderer) ITextProperties(net.minecraft.util.text.ITextProperties) StringTextComponent(net.minecraft.util.text.StringTextComponent) FontRenderer(net.minecraft.client.gui.FontRenderer) ItemStack(net.minecraft.item.ItemStack)

Example 10 with ITextProperties

use of net.minecraft.util.text.ITextProperties in project AstralSorcery by HellFirePvP.

the class RenderingUtils method mcdefault_renderItemOverlayIntoGUI.

// TODO wait for mojang to do their work and actually port this method so i don't have to do this myself
@Deprecated
public static void mcdefault_renderItemOverlayIntoGUI(FontRenderer fr, MatrixStack renderStack, ItemStack stack, float pTicks, @Nullable String text) {
    if (stack.isEmpty()) {
        return;
    }
    // TODO ugh.
    RenderSystem.disableLighting();
    renderStack.push();
    renderStack.translate(0, 0, 100F);
    if (stack.getCount() > 1 || text != null) {
        ITextProperties display = new StringTextComponent(ObjectUtils.firstNonNull(text, String.valueOf(stack.getCount())));
        int length = fr.getStringPropertyWidth(display);
        renderStack.push();
        renderStack.translate(17 - length, 9, 0);
        RenderingDrawUtils.renderStringAt(display, renderStack, fr, 0xFFFFFFFF, true);
        renderStack.pop();
    }
    if (stack.getItem().showDurabilityBar(stack)) {
        RenderSystem.disableDepthTest();
        RenderSystem.disableTexture();
        RenderSystem.disableAlphaTest();
        RenderSystem.disableBlend();
        float health = (float) stack.getItem().getDurabilityForDisplay(stack);
        float durabilityPercent = 13F - health * 13F;
        int color = stack.getItem().getRGBDurabilityForDisplay(stack);
        RenderingUtils.draw(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX, buf -> {
            RenderingGuiUtils.rect(buf, renderStack, 2, 13, 0, 13, 2).color(0, 0, 0, 255).draw();
            RenderingGuiUtils.rect(buf, renderStack, 2, 13, 0, durabilityPercent, 1).color(color >> 16 & 255, color >> 8 & 255, color & 255, 255).draw();
        });
        RenderSystem.enableBlend();
        RenderSystem.enableAlphaTest();
        RenderSystem.enableTexture();
        RenderSystem.enableDepthTest();
    }
    ClientPlayerEntity player = Minecraft.getInstance().player;
    float cooldownPercent = player == null ? 0F : player.getCooldownTracker().getCooldown(stack.getItem(), pTicks);
    if (cooldownPercent > 0F) {
        RenderSystem.disableDepthTest();
        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        RenderingUtils.draw(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX, buf -> {
            RenderingGuiUtils.rect(buf, renderStack, 0, 16F * (1F - cooldownPercent), 0, 16, 16F * cooldownPercent).color(255, 255, 255, 127).draw();
        });
        RenderSystem.enableTexture();
        RenderSystem.enableDepthTest();
    }
    renderStack.pop();
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties) StringTextComponent(net.minecraft.util.text.StringTextComponent) ClientPlayerEntity(net.minecraft.client.entity.player.ClientPlayerEntity)

Aggregations

ITextProperties (net.minecraft.util.text.ITextProperties)36 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)19 StringTextComponent (net.minecraft.util.text.StringTextComponent)13 ArrayList (java.util.ArrayList)9 FontRenderer (net.minecraft.client.gui.FontRenderer)7 IReorderingProcessor (net.minecraft.util.IReorderingProcessor)7 List (java.util.List)6 Matrix4f (net.minecraft.util.math.vector.Matrix4f)6 IRenderTypeBuffer (net.minecraft.client.renderer.IRenderTypeBuffer)4 ITextComponent (net.minecraft.util.text.ITextComponent)4 ItemStack (net.minecraft.item.ItemStack)3 RenderTooltipEvent (net.minecraftforge.client.event.RenderTooltipEvent)3 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)2 MoonPhase (hellfirepvp.astralsorcery.common.base.MoonPhase)2 IWeakConstellation (hellfirepvp.astralsorcery.common.constellation.IWeakConstellation)2 PerkStatistic (hellfirepvp.astralsorcery.common.perk.reader.PerkStatistic)2 LinkedList (java.util.LinkedList)2 Minecraft (net.minecraft.client.Minecraft)2 Lists (com.google.common.collect.Lists)1 LivingData (com.lying.variousoddities.capabilities.LivingData)1