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

The anvil rename field accepts 31 characters but the server rejects it if it is over 30

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13a, Minecraft 17w13b, Minecraft 17w14a, Minecraft 17w15a, Minecraft 17w16a, Minecraft 17w17b, Minecraft 17w18a, Minecraft 17w18b, Minecraft 1.12 Pre-Release 1, Minecraft 1.12 Pre-Release 2
    • Confirmed
    • Survival

      The bug

      When renaming an item in an anvil, you can type 31 characters (and it'll display the new name in the output slot). However, if the item is grabbed from the output slot (or forcibly updated by adding and removing an item into the second input slot), then only the first 30 characters of the name will be used.

      Reproduction

      A more common scenario:

      1. Open an anvil UI.
      2. Put an item into the first slot
      3. Type _ into the name field until it won't let you type it anymore.
      4. Press backspace once
      5. Type ! into the name field, so that the name ends with a single !.
      6. Grab the item out of the output slot (or insert and remove an incompatible item in the second input slot)
      7. Observe that the new item name no longer has the ! at the end!

      A less common scenario:

      1. Open an anvil UI
      2. Put an item into the first slot
      3. Select the entire name with Ctrl+A
      4. Paste the following text over the name (paste must be used, as the entire text must be set at once): 0123456789012345678901234567890
      5. Attempt to take the item out of the output slot. The game will reject it completely, as the item did not actually get renamed.

      Cause

      For some reason, the text field max length was increased to 31 characters in 16w50a. However, the corresponding handler for the MC|ItemName plugin channel did not have its max length adjusted, rejecting it if it is over 30 characters long. Since MC|ItemName is continuously sent when renaming the item, the last valid name (usually the 30-character version) is used instead of the 31 character version (if there is no last valid name, then the game will think the name did not change). This could be fixed either by increasing the maximum length for MC|ItemName or unincreasing the max length in the anvil UI.

            dinnerbone [Mojang] Nathan Adams
            pokechu22 [Mod] Pokechu22
            Votes:
            6 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: