mojira.dev
MC-1685

Unable to write in a new blank Book and Quill after renaming it in an anvil

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

  1. Get a new blank book and quill.

  2. Rename it.

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

MC-1958 i cant write a book when i named it with a anvil MC-2048 You cannon type in a renamed Book and Quill that you have renamed in the anvil. MC-6864 Book and Quill requires update when renamed MC-7114 11 January 2013 MC-12441 Unable to write in Book and Quill after being renamed in an Anvil. MC-25551 Cannot type in renamed books MC-26543 Can't write on Rename book MC-26635 Cant write in book and quils. MC-35490 Cannot type in Book and Quill that has a Custom name MC-44781 Bug with renamed Book and Quils MC-45113 can not write on renamed book and quill until changing the page MC-47294 Using /give to get a custom named book cant be wrote in. MC-48159 Unable to Write in ReNamed Book and Quil MC-48993 Named book and quill makes you not able to write in it MC-49520 After using /give command can't write in writable book MC-54775 Renamed writable books can not be written in. MC-55184 Named Book and Quill can not be edited MC-55254 Renamed Book And Quills cant be typed in MC-55557 Named Books Can't Be Edited MC-56581 Cannot write in book when renamed with anvil MC-62030 Not Being able to write in book and quill MC-74060 Can't wright in renamed book MC-75504 You can't write in a book and quill with NBT Tag or with custom name MC-87670 Cant Write in book MC-95157 I can't write on book and quill once I rename this book. MC-96292 Unable to edit book and quill after renaming it MC-102008 Can't type in unsigned Book and Quills that have no NBT tag MC-104669 Unable to type in a named book and quill. MC-111742 Renamed Book and Quill won't take text MC-113996 Book and Quill cannot be edited after changing the name in an anvil MC-119616 New Book and Quill unable to be edited after renaming MC-119870 Renaming a Book and Quill makes it not possible to write in the book

Comments

migrated

Could somebody please edit the title of this issue?

[edit] Thank you very much, it's easier to find now 🙂

migrated

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.

CubeTheThird

Can confirm.

migrated

can confirm. sucks

migrated

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

CubeTheThird

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

chadgarion25

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

migrated

Confirmed for 1.5.2 in multiplayer. Please fix!

migrated

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

migrated

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

migrated

Bug still appears in snapshot 13w47c.

migrated

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

migrated

Still in 14w03b.

migrated

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.

migrated

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.

migrated

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.

migrated

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

migrated

Still applies to snapshot 14w20b.

Skylinerw

Confirmed for 14w30c.

migrated

Confirmed for 14w31a.

migrated

Confirmed for 1.8.

migrated

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.

qmagnet

Confirmed for 15w36d

migrated

Confirmed for 16w07b.

migrated

Confirmed for 1.9-pre2

migrated

Confirmed for 1.9.1-pre3.

migrated

Confirmed for 1.9.3-pre3.

migrated

Confirmed for 1.9.4.

migrated

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.

migrated

Confirmed for 16w20a.

migrated

Confirmed for 16w21a.

migrated

Confirmed for 16w21b.

migrated

Confirmed for 1.10-pre1.

migrated

Confirmed for 1.10-pre2.

migrated

Confirmed for 1.10.

migrated

Confirmed for 1.10.1.

migrated

Confirmed for 1.10.2.

migrated

Happened to 16w40a.

migrated

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

migrated

Confirmed for 1.11.2

migrated

Confirmed for 17w17b

Niknokinater

Confirmed for 1.12.1

Earthcomputer

Just happened to me on 1.12.2

Earthcomputer

Affects 17w43b

migrated

migrated

Confirmed

display-Name, item-renaming, writable_book

Minecraft 1.4.3, Minecraft 1.4.5, Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w02a, ..., Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b

Minecraft 17w48a

Retrieved