Jump to content

"Pages" book tag not processing properly?


Acrogenous

Recommended Posts

so I created a "makeBook" method that adds a written book with information in it to a players inventory;

public static void makeBook(EntityPlayer player, String title, String author,String... pages)
    {
        NBTTagList pagesTag = new NBTTagList();
        NBTTagCompound compound = new NBTTagCompound();
        compound.setString("author",author);
        compound.setString("title",title);


        for(int i = 0; i < pages.length; )
        {
            pagesTag.appendTag(new NBTTagString(pages[i]));
            i++;
        }

        compound.setTag("pages",pagesTag);
        ItemStack book = new ItemStack(Items.WRITTEN_BOOK);
        book.setTagCompound(compound);
        player.addItemStackToInventory(book);
    }

and then I pass this line of code in another class:

makeBook(player,"title","author","CHAPTER 1 In this world, all around us there is a force");

and no matter if I add \n or any other thing like that the book always looks like this

image.png.87555f053c94ea73136a6b120a33cb3c.png

(the title and author work however)

any ideas how I make it A; display all the text and B; format it

thanks in advance

~Acro

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.