Search in sources :

Example 26 with ITextProperties

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

the class ScreenJournalConstellationDetail method drawPageConstellation.

private void drawPageConstellation(MatrixStack renderStack, float partial) {
    ITextProperties cstName = this.constellation.getConstellationName();
    int width = font.getStringPropertyWidth(cstName);
    renderStack.push();
    renderStack.translate(guiLeft + (305 - (width * 1.8F / 2F)), guiTop + 26, this.getGuiZLevel());
    renderStack.scale(1.8F, 1.8F, 1);
    RenderingDrawUtils.renderStringAt(cstName, renderStack, font, 0xFFC3C3C3, true);
    renderStack.pop();
    ITextProperties dstInfo = constellation.getConstellationTypeDescription();
    if (!detailed) {
        dstInfo = new TranslationTextComponent("astralsorcery.journal.constellation.unknown");
    }
    width = font.getStringPropertyWidth(dstInfo);
    renderStack.push();
    renderStack.translate(guiLeft + (305 - (width / 2F)), guiTop + 219, this.getGuiZLevel());
    RenderingDrawUtils.renderStringAt(dstInfo, renderStack, font, 0xFFDDDDDD, true);
    renderStack.pop();
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    Random rand = new Random(0x4196A15C91A5E199L);
    boolean known = ResearchHelper.getClientProgress().hasConstellationDiscovered(constellation);
    RenderingConstellationUtils.renderConstellationIntoGUI(known ? constellation.getConstellationColor() : constellation.getTierRenderColor(), constellation, renderStack, guiLeft + 40, guiTop + 60, this.getGuiZLevel(), 150, 150, 2F, () -> 0.6F + 0.4F * RenderingConstellationUtils.conCFlicker(ClientScheduler.getClientTick(), partial, 12 + rand.nextInt(10)), true, false);
    RenderSystem.disableBlend();
}
Also used : Random(java.util.Random) ITextProperties(net.minecraft.util.text.ITextProperties) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

Example 27 with ITextProperties

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

the class ScreenJournalConstellationDetail method buildCapeText.

private void buildCapeText() {
    if (this.constellation instanceof IWeakConstellation) {
        if (ResearchHelper.getClientProgress().getTierReached().isThisLaterOrEqual(ProgressionTier.TRAIT_CRAFT)) {
            ITextComponent txtMantle = ((IWeakConstellation) this.constellation).getInfoMantleEffect();
            ITextProperties headTxt = new TranslationTextComponent("astralsorcery.journal.constellation.mantle");
            locTextMantle.add(localize(headTxt));
            locTextMantle.add(IReorderingProcessor.field_242232_a);
            List<IReorderingProcessor> lines = new LinkedList<>();
            for (String segment : txtMantle.getString().split("<NL>")) {
                lines.addAll(font.trimStringToWidth(new StringTextComponent(segment), JournalPage.DEFAULT_WIDTH));
                lines.add(IReorderingProcessor.field_242232_a);
            }
            locTextMantle.addAll(lines);
            locTextMantle.add(IReorderingProcessor.field_242232_a);
        }
    }
}
Also used : IReorderingProcessor(net.minecraft.util.IReorderingProcessor) ITextProperties(net.minecraft.util.text.ITextProperties) ITextComponent(net.minecraft.util.text.ITextComponent) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) StringTextComponent(net.minecraft.util.text.StringTextComponent) LinkedList(java.util.LinkedList) IWeakConstellation(hellfirepvp.astralsorcery.common.constellation.IWeakConstellation)

Example 28 with ITextProperties

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

the class ScreenJournalConstellationOverview method drawConstellation.

private Rectangle drawConstellation(MatrixStack renderStack, IConstellation display, double offsetX, double offsetY, float zLevel, float partial, int mouseX, int mouseY) {
    Rectangle rect = new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), width, height);
    renderStack.push();
    renderStack.translate(offsetX + (width / 2F), offsetY + (width / 2F), zLevel);
    if (rect.contains(mouseX, mouseY)) {
        renderStack.scale(1.1F, 1.1F, 1F);
    }
    renderStack.translate(-(width / 2F), -(width / 2F), zLevel);
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    Random rand = new Random(0x4196A15C91A5E199L);
    RenderingConstellationUtils.renderConstellationIntoGUI(display.getConstellationColor(), display, renderStack, 0, 0, 0, 95, 95, 1.6F, () -> 0.5F + 0.5F * RenderingConstellationUtils.conCFlicker(ClientScheduler.getClientTick(), partial, 12 + rand.nextInt(10)), true, false);
    RenderSystem.disableBlend();
    ITextProperties cstName = display.getConstellationName();
    float fullLength = (width / 2F) - (font.getStringPropertyWidth(cstName) / 2F);
    renderStack.translate(fullLength, 90, 10);
    RenderingDrawUtils.renderStringAt(cstName, renderStack, font, 0xBBDDDDDD, false);
    renderStack.pop();
    return rect;
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties)

Example 29 with ITextProperties

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

the class ScreenJournalClusterRenderer method drawMouseHighlight.

public void drawMouseHighlight(MatrixStack renderStack, float zLevel, int mouseX, int mouseY) {
    Rectangle frame = new Rectangle(renderOffsetX, renderOffsetY, renderGuiWidth, renderGuiHeight);
    if (frame.contains(mouseX, mouseY)) {
        for (Rectangle r : clickableNodes.keySet()) {
            if (r.contains(mouseX, mouseY)) {
                ITextProperties name = clickableNodes.get(r).getName();
                renderStack.push();
                renderStack.translate(r.getX(), r.getY(), zLevel + 200);
                renderStack.scale(progressionSizeHandler.getScalingFactor(), progressionSizeHandler.getScalingFactor(), 1F);
                RenderingDrawUtils.renderBlueTooltipComponents(renderStack, 0, 0, 0, Lists.newArrayList(name), Minecraft.getInstance().fontRenderer, false);
                renderStack.pop();
            }
        }
    }
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties)

Example 30 with ITextProperties

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

the class ScreenJournalProgressionRenderer method drawProgressionPart.

public void drawProgressionPart(MatrixStack renderStack, float zLevel, int mouseX, int mouseY) {
    drawBackground(renderStack, zLevel);
    drawClusters(renderStack, zLevel);
    focusedClusterMouse = tryFocusCluster(mouseX, mouseY);
    float scaleX = this.mousePointScaled.getPosX();
    float scaleY = this.mousePointScaled.getPosY();
    if (sizeHandler.getScalingFactor() >= 6.1D && focusedClusterZoom != null && clusterRenderer != null) {
        JournalCluster cluster = JournalProgressionClusterMapping.getClusterMapping(focusedClusterZoom);
        drawClusterBackground(renderStack, cluster.clusterBackgroundTexture, zLevel);
        clusterRenderer.drawClusterScreen(renderStack, this.parentGui, zLevel);
        scaleX = clusterRenderer.getMouseX();
        scaleY = clusterRenderer.getMouseY();
    }
    if (focusedClusterMouse != null) {
        JournalCluster cluster = JournalProgressionClusterMapping.getClusterMapping(focusedClusterMouse);
        float width = this.sizeHandler.scaledDistanceX(cluster.x, cluster.maxX);
        float height = this.sizeHandler.scaledDistanceY(cluster.y, cluster.maxY);
        Point.Float offset = this.sizeHandler.scalePointToGui(this.parentGui, this.mousePointScaled, new Point.Float(cluster.x, cluster.y));
        float scale = sizeHandler.getScalingFactor();
        float br = 1F;
        if (scale > 8.01F) {
            br = 0F;
        } else if (scale >= 6F) {
            br = 1F - ((scale - 6F) / 2F);
        }
        ITextProperties name = focusedClusterMouse.getName();
        float length = Minecraft.getInstance().fontRenderer.getStringPropertyWidth(name) * 1.4F;
        int alpha = 0xCC;
        alpha *= br;
        alpha = Math.max(alpha, 5);
        int color = 0x5A28FF | (alpha << 24);
        renderStack.push();
        renderStack.translate(offset.x + (width / 2F) - length / 2D, offset.y + (height / 3F), 0);
        renderStack.scale(1.4F, 1.4F, 1F);
        RenderingDrawUtils.renderStringAt(name, renderStack, null, color, true);
        renderStack.pop();
    }
    drawStarParallaxLayers(renderStack, scaleX, scaleY, zLevel);
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties) ScalingPoint(hellfirepvp.astralsorcery.client.screen.helper.ScalingPoint) ScalingPoint(hellfirepvp.astralsorcery.client.screen.helper.ScalingPoint)

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