Search in sources :

Example 1 with IReorderingProcessor

use of net.minecraft.util.IReorderingProcessor in project Bookshelf by Darkhax-Minecraft.

the class RenderUtils method renderLinesReversed.

public static int renderLinesReversed(MatrixStack matrix, FontRenderer fontRenderer, int x, int y, int spacing, int defaultColor, List<IReorderingProcessor> lines) {
    final int lineCount = lines.size();
    for (int lineNum = lineCount - 1; lineNum >= 0; lineNum--) {
        final IReorderingProcessor lineFragment = lines.get(lineCount - 1 - lineNum);
        fontRenderer.draw(matrix, lineFragment, x, y - (lineNum + 1) * (spacing + 1), defaultColor);
    }
    return lineCount * (spacing + 1);
}
Also used : IReorderingProcessor(net.minecraft.util.IReorderingProcessor)

Example 2 with IReorderingProcessor

use of net.minecraft.util.IReorderingProcessor in project Bookshelf by Darkhax-Minecraft.

the class RenderUtils method renderLinesWrapped.

public static void renderLinesWrapped(MatrixStack matrix, FontRenderer fontRenderer, int x, int y, int spacing, int defaultColor, List<IReorderingProcessor> lines) {
    for (int lineNum = 0; lineNum < lines.size(); lineNum++) {
        final IReorderingProcessor lineFragment = lines.get(lineNum);
        fontRenderer.draw(matrix, lineFragment, x, y + lineNum * spacing, defaultColor);
    }
}
Also used : IReorderingProcessor(net.minecraft.util.IReorderingProcessor)

Example 3 with IReorderingProcessor

use of net.minecraft.util.IReorderingProcessor in project AgriCraft by AgriCraft.

the class AgriGenomeRenderer method renderTextOverlay.

public void renderTextOverlay(MatrixStack transforms, IAgriGenePair<?> genePair) {
    // Fetch font renderer
    FontRenderer fontRenderer = this.getFontRenderer();
    // Fetch styles
    Tuple<Style, Style> textFormats = this.getTextFormats(genePair.getGene());
    // Fetch colors
    int blackColor = STYLE_GENE.getColor() == null ? 0 : STYLE_GENE.getColor().getColor();
    int domColor = textFormats.getA().getColor() == null ? 0 : textFormats.getA().getColor().getColor();
    int recColor = textFormats.getB().getColor() == null ? 0 : textFormats.getB().getColor().getColor();
    // Fetch text components
    IReorderingProcessor geneText = genePair.getGene().getGeneDescription().mergeStyle(STYLE_GENE).func_241878_f();
    IReorderingProcessor domText = genePair.getDominant().getTooltip().func_241878_f();
    IReorderingProcessor recText = genePair.getRecessive().getTooltip().func_241878_f();
    // Calculate positions
    float y1 = 0;
    float x1 = (-fontRenderer.func_243245_a(geneText) + 0.0F) / 2;
    float y2 = y1 + 1.5F * fontRenderer.FONT_HEIGHT;
    float x2 = (-fontRenderer.func_243245_a(TEXT_SEPARATOR) + 0.0F) / 2;
    float delta = 1.0F;
    float dx_d = delta + fontRenderer.func_243245_a(domText);
    float dx_r = delta + fontRenderer.func_243245_a(TEXT_SEPARATOR);
    // Render text
    this.getFontRenderer().func_238422_b_(transforms, geneText, x1, y1, blackColor);
    this.getFontRenderer().func_238422_b_(transforms, TEXT_SEPARATOR, x2, y2, blackColor);
    this.getFontRenderer().func_238422_b_(transforms, domText, x2 - dx_d, y2, blackColor);
    this.getFontRenderer().func_238422_b_(transforms, recText, x2 + dx_r, y2, blackColor);
}
Also used : IReorderingProcessor(net.minecraft.util.IReorderingProcessor) Style(net.minecraft.util.text.Style) FontRenderer(net.minecraft.client.gui.FontRenderer)

Aggregations

IReorderingProcessor (net.minecraft.util.IReorderingProcessor)3 FontRenderer (net.minecraft.client.gui.FontRenderer)1 Style (net.minecraft.util.text.Style)1