The bug
When I use an anvil (repair & name) on "Book and Quill" after naming I can't write something in this book. I can sign it but it stay are not writed.
How to reproduce
Get a new blank book and quill.
Rename it.
Try to type in it, it won't work.
Code analysis
Based on 1.11 decompiled using MCP 9.35 rc1
The constructor net.minecraft.client.gui.GuiScreenBook.GuiScreenBook(EntityPlayer, ItemStack, boolean)
tests if the book has the tag
tag and if this is the case tries to use its pages
value. Because this tag does not exist an empty list is returned. The problem is that the test for bookTotalPages < 1
(= empty list) only sets the bookTotalPages
attribute value to 1, but does not add an empty string to the pages. Because of this the player is unable to write something.
Suggested fix (1.11)
public GuiScreenBook(EntityPlayer player, ItemStack book, boolean isUnsigned)
{
this.editingPlayer = player;
this.bookObj = book;
this.bookIsUnsigned = isUnsigned;
if (book.hasTagCompound())
{
NBTTagCompound nbttagcompound = book.getTagCompound();
this.bookPages = nbttagcompound.getTagList("pages", 8).copy();
this.bookTotalPages = this.bookPages.tagCount();
if (this.bookTotalPages < 1)
{
// Added the following line
this.bookPages.appendTag(new NBTTagString(""));
this.bookTotalPages = 1;
}
}
if (this.bookPages == null && isUnsigned)
{
this.bookPages = new NBTTagList();
this.bookPages.appendTag(new NBTTagString(""));
this.bookTotalPages = 1;
}
}
Linked issues
is duplicated by 32
Comments 44
This still applies in 1.4.5.
Also, it does not apply to books that have already been written in. Only new, un-edited books.
As a small sidenote: It would be great if you could use the cursorkeys to move the input cursor, when you need to edit something on top you have to delete all text and type it again. π
Could somebody please edit the title of this issue?
[edit] Thank you very much, it's easier to find now π