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

Written books selectors and scores don't finalize in offhand (just show literal text (@p, @a, etc.))

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.11, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 18w07c, Minecraft 18w11a, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w30b, Minecraft 1.13.1
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      How to reproduce

      1. Give yourself a written_book with the following command:
        /give @p written_book{pages:["{\"selector\":\"@p\"}"],title:"",author:""}
        
      2. Open it
        You will see your name written at the top
      3. Remove that book from your inventory and /give you this book again
      4. Place it in your offhand
      5. Open it
        You will see @p the first time. Close and reopen it again. This time you will see your name.

      This issue concern also @a, @e, @r... and scores display.

      Code analysis

      Based on 1.11 decompiled using MCP 9.35 rc1

      The problem is that the method net.minecraft.item.ItemWrittenBook.resolveContents(ItemStack, EntityPlayer) tests if the player is holding the item in the mainhand and only if this is the case sends a SPacketSetSlot packet.
      This condition does not really make sense because the item is modified anyways, the client inventory just won't be updated. This can be seen by dropping the book, picking it back up and opening it in the offhand again.
      The best way to fix this would probably be to remove this condition.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                BluHugo Bytenka
              • Votes:
                3 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: