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