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;
}
}
Related issues
is duplicated by
Comments


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.

Can confirm.

can confirm. sucks

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. 😞

@Alexander: see MC-1578 for information on that issue.

Confirmed in Snapshot 13w16a. I've never had this problem before now and never knew it's been going on for so long.

Confirmed for 1.5.2 in multiplayer. Please fix!

Confirmed for 1.6.2 SP/MP, the issue is not resolved.

Reopened with a better description. Missing detail was the book needed to be unused.

Bug still appears in snapshot 13w47c.

Still happens in 14w02c, but also works with ANY Nbt-tag when pages:[] does not exist/is empty.

Still in 14w03b.

Still happens in 14w05a. If the book and quill has been renamed or if it's enchanted with the /give command, it can't be edited.

Confirmed in 14w06b. I am making a teleporter on my map using a writable book and /clear, but i cannot give the player a renamed book. this is annoying.

This also applies to ANY tag added to the book with the /give command. I tested this in 14w08a, but it also applies to earlier snapshots.

I found a temporary fix: when using /give, add a page with nothing in it, and the book is writable.

Still applies to snapshot 14w20b.

Confirmed for 14w30c.

Confirmed for 14w31a.

Confirmed for 1.8.

Just to add to this, the only way around this bug is to create a page 2 by clicking on the arrow, then going back to page 1 and start typing.

Confirmed for 15w36d

Confirmed for 16w07b.

Confirmed for 1.9-pre2

Confirmed for 1.9.1-pre3.

Confirmed for 1.9.3-pre3.

Confirmed for 1.9.4.

The problem lies in the NBT tags. There is no NBT tag when the book is virgin but once any writing is placed, even if immediately erased before ever closing, an NBT tag is created and writing is allowed.

Confirmed for 16w20a.

Confirmed for 16w21a.

Confirmed for 16w21b.

Confirmed for 1.10-pre1.

Confirmed for 1.10-pre2.

Confirmed for 1.10.

Confirmed for 1.10.1.

Confirmed for 1.10.2.

Happened to 16w40a.

This is apparently a VERY old bug that i'd very much like remedied.

Confirmed for 1.11.2

Confirmed for 17w17b

Confirmed for 1.12.1

Just happened to me on 1.12.2

Affects 17w43b
Could somebody please edit the title of this issue?
[edit] Thank you very much, it's easier to find now 🙂