Search in sources :

Example 11 with ITextProperties

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

the class RenderPageRecipeTemplate method addInputInformation.

protected void addInputInformation(ItemStack stack, @Nullable Ingredient stackIngredient, List<ITextProperties> tooltip) {
    try {
        tooltip.addAll(stack.getTooltip(Minecraft.getInstance().player, Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL));
    } catch (Exception exc) {
        tooltip.add(new TranslationTextComponent("astralsorcery.misc.tooltipError").mergeStyle(TextFormatting.RED));
    }
    BookLookupInfo info = BookLookupRegistry.findPage(Minecraft.getInstance().player, LogicalSide.CLIENT, stack);
    if (info != null && info.canSee(ResearchHelper.getProgress(Minecraft.getInstance().player, LogicalSide.CLIENT)) && !info.getResearchNode().equals(this.getResearchNode())) {
        tooltip.add(StringTextComponent.EMPTY);
        tooltip.add(new TranslationTextComponent("astralsorcery.misc.craftInformation").mergeStyle(TextFormatting.GRAY));
    }
    if (stackIngredient != null && Minecraft.getInstance().gameSettings.advancedItemTooltips) {
        ITag<Item> itemTag = IngredientHelper.guessTag(stackIngredient);
        if (itemTag instanceof ITag.INamedTag) {
            tooltip.add(StringTextComponent.EMPTY);
            tooltip.add(new TranslationTextComponent("astralsorcery.misc.input.tag", ((ITag.INamedTag<Item>) itemTag).getName().toString()).mergeStyle(TextFormatting.GRAY));
        }
        if (stackIngredient instanceof FluidIngredient) {
            List<FluidStack> fluids = ((FluidIngredient) stackIngredient).getFluids();
            if (!fluids.isEmpty()) {
                ITextProperties cmp = null;
                for (FluidStack f : fluids) {
                    if (cmp == null) {
                        cmp = f.getFluid().getAttributes().getDisplayName(f);
                    } else {
                        cmp = new TranslationTextComponent("astralsorcery.misc.input.fluid.chain", cmp, f.getFluid().getAttributes().getDisplayName(f)).mergeStyle(TextFormatting.GRAY);
                    }
                }
                tooltip.add(StringTextComponent.EMPTY);
                tooltip.add(new TranslationTextComponent("astralsorcery.misc.input.fluid", cmp).mergeStyle(TextFormatting.GRAY));
            }
        }
    }
}
Also used : Item(net.minecraft.item.Item) FluidIngredient(hellfirepvp.astralsorcery.common.crafting.helper.ingredient.FluidIngredient) FluidStack(net.minecraftforge.fluids.FluidStack) BookLookupInfo(hellfirepvp.astralsorcery.common.auxiliary.book.BookLookupInfo) ITextProperties(net.minecraft.util.text.ITextProperties) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

Example 12 with ITextProperties

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

the class RenderPageRecipeTemplate method addAltarRecipeTooltip.

protected void addAltarRecipeTooltip(SimpleAltarRecipe altarRecipe, List<ITextProperties> toolTip) {
    if (altarRecipe.getStarlightRequirement() > 0) {
        AltarType highestPossible = null;
        ProgressionTier reached = ResearchHelper.getClientProgress().getTierReached();
        for (AltarType type : AltarType.values()) {
            if ((highestPossible == null || !type.isThisLEThan(highestPossible)) && reached.isThisLaterOrEqual(type.getAssociatedTier().getRequiredProgress())) {
                highestPossible = type;
            }
        }
        if (highestPossible != null) {
            long indexSel = (ClientScheduler.getClientTick() / 30) % (highestPossible.ordinal() + 1);
            AltarType typeSelected = AltarType.values()[((int) indexSel)];
            ITextProperties itemName = typeSelected.getAltarItemRepresentation().getDisplayName();
            ITextProperties starlightRequired = getAltarStarlightAmountDescription(itemName, altarRecipe.getStarlightRequirement(), typeSelected.getStarlightCapacity());
            ITextProperties starlightRequirementDescription = new TranslationTextComponent("astralsorcery.journal.recipe.altar.starlight.desc");
            toolTip.add(starlightRequirementDescription);
            toolTip.add(starlightRequired);
        }
    }
    if (altarRecipe instanceof AltarUpgradeRecipe) {
        toolTip.add(new TranslationTextComponent("astralsorcery.journal.recipe.altar.upgrade"));
    }
}
Also used : AltarType(hellfirepvp.astralsorcery.common.block.tile.altar.AltarType) ITextProperties(net.minecraft.util.text.ITextProperties) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) AltarUpgradeRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.altar.AltarUpgradeRecipe) ProgressionTier(hellfirepvp.astralsorcery.common.data.research.ProgressionTier)

Example 13 with ITextProperties

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

the class RenderPageStructure method renderSizeDescription.

private float renderSizeDescription(MatrixStack renderStack, float offsetX, float offsetY, float zLevel) {
    Vector3 size = new Vector3(this.structure.getMaximumOffset()).subtract(this.structure.getMinimumOffset()).add(1, 1, 1);
    FontRenderer fr = RenderablePage.getFontRenderer();
    float scale = 1.3F;
    ITextProperties description = new StringTextComponent(String.format("%s - %s - %s", size.getBlockX(), size.getBlockY(), size.getBlockZ()));
    float length = fr.getStringPropertyWidth(description) * scale;
    RenderSystem.disableDepthTest();
    renderStack.push();
    renderStack.translate(offsetX, offsetY, zLevel);
    renderStack.scale(scale, scale, scale);
    RenderingDrawUtils.renderStringAt(description, renderStack, fr, 0x00DDDDDD, true);
    renderStack.pop();
    this.drawSlice.ifPresent(yLevel -> {
        int min = this.getCurrentMinSlice();
        int max = this.getCurrentMaxSlice();
        int height = max - min;
        int level = yLevel - min;
        ITextProperties slice = new StringTextComponent(String.format("%s / %s", level + 1, height + 1));
        renderStack.push();
        renderStack.translate(offsetX, offsetY + 14, zLevel);
        renderStack.scale(scale, scale, scale);
        RenderingDrawUtils.renderStringAt(slice, renderStack, fr, 0x00DDDDDD, true);
        renderStack.pop();
    });
    RenderSystem.enableDepthTest();
    return length + 8F;
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) StringTextComponent(net.minecraft.util.text.StringTextComponent) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 14 with ITextProperties

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

the class RenderPageStructure method postRender.

@Override
public void postRender(MatrixStack renderStack, float x, float y, float z, float pTicks, float mouseX, float mouseY) {
    renderStack.push();
    renderStack.translate(x + 160, y + 10, z);
    Rectangle rect = RenderingDrawUtils.drawInfoStar(renderStack, IDrawRenderTypeBuffer.defaultBuffer(), 15, pTicks);
    rect.translate((int) (x + 160), (int) (y + 10));
    renderStack.pop();
    if (rect.contains(mouseX, mouseY)) {
        RenderingDrawUtils.renderBlueTooltip(renderStack, x + 160, y + 10, z + 650, this.contentStacks, RenderablePage.getFontRenderer(), false);
    }
    if (this.switchView != null && this.switchView.contains(mouseX, mouseY)) {
        ITextProperties switchInfo = new TranslationTextComponent("astralsorcery.journal.structure.switch_view");
        RenderingDrawUtils.renderBlueTooltipComponents(renderStack, this.switchView.x + this.switchView.width / 2, this.switchView.y + this.switchView.height / 2, z + 500, Lists.newArrayList(switchInfo), RenderablePage.getFontRenderer(), false);
    }
    if (this.switchRequiredAir != null && this.switchRequiredAir.contains(mouseX, mouseY)) {
        ITextProperties switchInfo = new TranslationTextComponent("astralsorcery.journal.structure.required_air");
        RenderingDrawUtils.renderBlueTooltipComponents(renderStack, this.switchRequiredAir.x + this.switchRequiredAir.width / 2, this.switchRequiredAir.y + this.switchRequiredAir.height / 2, z + 500, Lists.newArrayList(switchInfo), RenderablePage.getFontRenderer(), false);
    }
}
Also used : ITextProperties(net.minecraft.util.text.ITextProperties) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

Example 15 with ITextProperties

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

the class ScreenConstellationPaper method drawPhaseInformation.

private void drawPhaseInformation(MatrixStack renderStack) {
    if (this.phases == null) {
        this.resolvePhases();
    }
    List<MoonPhase> phases = this.phases == null ? Collections.emptyList() : this.phases;
    if (phases.isEmpty()) {
        ITextProperties text = new TranslationTextComponent("astralsorcery.journal.constellation.unknown");
        RenderingDrawUtils.renderStringCentered(Minecraft.getInstance().fontRenderer, renderStack, text, guiLeft + guiWidth / 2 + 25, guiTop + 239, 1.8F, 0xAA4D4D4D);
    } else {
        int size = 16;
        int offsetX = (width / 2) - (phases.size() * (size + 2)) / 2;
        int offsetY = guiTop + 237;
        for (int i = 0; i < phases.size(); i++) {
            phases.get(i).getTexture().bindTexture();
            RenderSystem.enableBlend();
            Blending.DEFAULT.apply();
            RenderingGuiUtils.drawRect(renderStack, offsetX + (i * (size + 2)), offsetY, this.getGuiZLevel(), size, size);
            RenderSystem.disableBlend();
        }
    }
}
Also used : MoonPhase(hellfirepvp.astralsorcery.common.base.MoonPhase) ITextProperties(net.minecraft.util.text.ITextProperties) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

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