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));
}
}
}
}
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"));
}
}
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;
}
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);
}
}
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();
}
}
}
Aggregations