Search in sources :

Example 1 with Person

use of ivorius.reccomplex.random.Person in project RecurrentComplex by Ivorforce.

the class Book method poem.

public static ItemStack poem(Random random) {
    ItemStack stack = new ItemStack(Items.WRITTEN_BOOK);
    Person author = Person.randomHuman(random, random.nextFloat() < 0.9f);
    Poem poem = Poem.randomPoem(random, 32, author);
    stack.setTagInfo("pages", NBTTagLists.write(bookPages(poem.getText()).stream().map(Book::toJSON).map(NBTTagString::new).collect(Collectors.toList())));
    stack.setTagInfo("author", new NBTTagString(author.getFullName()));
    stack.setTagInfo("title", new NBTTagString(poem.getTitle()));
    return stack;
}
Also used : Poem(ivorius.reccomplex.random.Poem) NBTTagString(net.minecraft.nbt.NBTTagString) ItemStack(net.minecraft.item.ItemStack) Person(ivorius.reccomplex.random.Person)

Aggregations

Person (ivorius.reccomplex.random.Person)1 Poem (ivorius.reccomplex.random.Poem)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagString (net.minecraft.nbt.NBTTagString)1