Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-1685

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

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.4.3, Minecraft 1.4.5, Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w02a, Snapshot 13w02b, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Snapshot 13w16a, Minecraft 1.5.2, Snapshot 13w18b, Snapshot 13w18c, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 13w47c, Minecraft 1.7.4, Minecraft 14w02c, Minecraft 14w03a, Minecraft 14w03b, Minecraft 14w04b, Minecraft 14w05b, Minecraft 14w06a, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 14w18b, Minecraft 14w20b, Minecraft 14w21b, Minecraft 1.7.10, Minecraft 14w30b, Minecraft 14w30c, Minecraft 14w31a, Minecraft 14w33c, Minecraft 14w34a, Minecraft 14w34b, Minecraft 14w34c, Minecraft 14w34d, Minecraft 1.8-pre1, Minecraft 1.8, Minecraft 1.8.1-pre3, Minecraft 1.8.1, Minecraft 1.8.8, Minecraft 15w36b, Minecraft 15w36c, Minecraft 15w36d, Minecraft 15w51b, Minecraft 16w03a, Minecraft 16w05b, Minecraft 16w06a, Minecraft 16w07a, Minecraft 16w07b, Minecraft 1.9 Pre-Release 2, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 16w14a, Minecraft 1.9.3 Pre-Release 3, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 16w21a, Minecraft 16w21b, Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 1.10.1, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w35a, Minecraft 16w40a, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w17b, Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b
    • Fix Version/s: Minecraft 17w48a
    • Confirmation Status:
      Confirmed

      Description

      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;
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Excited [Mojang] Maria Lemón
                Reporter:
                tomekch6 tomekch6
              • Votes:
                57 Vote for this issue
                Watchers:
                28 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: