Search in sources :

Example 36 with ITextProperties

use of net.minecraft.util.text.ITextProperties in project Vampirism by TeamLapen.

the class GuideHelper method createItemTaskDescription.

/**
 * Create a simple page informing the reader about a task that can be used to obtain an item
 */
public static PageItemStack createItemTaskDescription(Task task) {
    assert task.getReward() instanceof ItemReward;
    Ingredient ingredient = Ingredient.of(((ItemReward) task.getReward()).getAllPossibleRewards().stream());
    List<ITextProperties> text = new ArrayList<>();
    StringTextComponent newLine = new StringTextComponent("\n");
    IPlayableFaction<?> f = task.getFaction();
    String type = f == null ? "" : f.getName().getString() + " ";
    text.add(new TranslationTextComponent("text.vampirism.task.reward_obtain", type));
    text.add(newLine);
    text.add(newLine);
    text.add(task.getTranslation());
    text.add(newLine);
    text.add(new TranslationTextComponent("text.vampirism.task.prerequisites"));
    text.add(newLine);
    TaskUnlocker[] unlockers = task.getUnlocker();
    if (unlockers.length > 0) {
        for (TaskUnlocker u : unlockers) {
            text.add(new StringTextComponent("- ").append(u.getDescription()).append(newLine));
        }
    } else {
        text.add(new TranslationTextComponent("text.vampirism.task.prerequisites.none"));
    }
    return new PageItemStack(ITextProperties.composite(text), ingredient);
}
Also used : Ingredient(net.minecraft.item.crafting.Ingredient) ItemReward(de.teamlapen.vampirism.player.tasks.reward.ItemReward) ITextProperties(net.minecraft.util.text.ITextProperties) TaskUnlocker(de.teamlapen.vampirism.api.entity.player.task.TaskUnlocker) ArrayList(java.util.ArrayList) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) StringTextComponent(net.minecraft.util.text.StringTextComponent) PageItemStack(de.maxanier.guideapi.page.PageItemStack)

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