mojira.dev
MC-111699

Can't rename stacked items

The bug

Trying to rename 2 items or more will not work in survival.

Steps to reproduce

  1. Make sure you're in survival mode

  2. Place an anvil

  3. Get two or more items

  4. Put the items in the anvil and rename them

  5. Try to take out the new items


Additional information by @unknown in this comment.

Linked issues

Comments 10

I can confirm that this is indeed a bug. This feature was working as intended in 1.11 release, but started doing this in 1.11.1 and still does so in 1.11.2. I was trying to name stacks for an item sorter, and much to my surprise... not currently possible due to this bug. Although, I am pretty sure it still works in creative mode. Just not in survival.

Ok, debugged this and it appears the MC|ItemName packet to reset the name back to default is being sent too early, before the server receives the click event.

This is causing the server to reset the UI and unset the result, causing it to fail.

The client does not send this code if only 1 in the stack due to the left hand stack becoming empty:

public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
    {
        if (slotInd == 0)
        {
            this.nameField.setText(stack.isEmpty() ? "" : stack.getDisplayName());
            this.nameField.setEnabled(!stack.isEmpty());

            if (!stack.isEmpty())
            {
                this.renameItem();
            }
        }
    }

I very hackily fixed this on the server by ignoring any incoming packet to set the name to empty if the anvil still has an itemstack in the result slot.

Thanks for that info. Could this possibly be related to MC-112017, which only started happening due to some anvil changes in 1.11.1?

It seems they changed anvils in general in 1.11.1, which MC-111744 seems to be an intended behavior change, but possibly introduced this bug.

MC-112017 likely was another behavior change that was incomplete.

I think this is the bug I'm observing, except that I also notice that when the rename fails, it consumes the XP even though the name did not get applied. Here are how I reproduce it:

  • Put a stack of dirt in an anvil

  • Type in a new name

If you just click the one piece of dirt in the output slot, instead of being picked up, it'll snap back into the anvil input slot, but without a name.

If you shift-click the output slot (because I wanted to give all of the items the same name), only a single one will appear in the user inventory (and one XP will be consumed), but the instant I click that one item, it snaps back into the input slot.

If instead of clicking that one item, if I leave it in my inventory, and press Esc, then the whole stack snaps into my inventory, but no names are applied.

Would the XP return after you re-logged? I remember when I reported this I mentioned that it would consume the XP, but it would return if I re-logged. I think it would only return XP for the last attempt at renaming, so if you tried to rename multiple times and then re-logged, you would only get 1 XP back. I could be wrong though.

Also, I recently renamed about a half stack of Name Tags in survival, forgetting about the bug. It seemed to work perfectly fine. It renamed them all and consumed 1 XP. I'm guessing Name Tags have slightly different mechanics though. Anyone care to look into that?

The XP is only used client-side. It will display the correct amount again once the server sends the amount of XP you have, for example when you use /xp 0L or collect XP orbs.

Edit: The fact that you can rename a stack of name tags is probably intended, see MC-111744.

Sometimes i cant stack named items. Its very buggy.
Its easy to reproduce:
split and stack some named items ... sometimes work sometimes dosent work

This issue is still present in Minecraft 17w17a, however when you try to rename a stack, it will just give you 1 renamed item that doesn't really exist; when you remove the remaining 63 items from the anvil, the custom named item disappears, and the item count is back to 64.

This happened to me again today. I trieid to rename stacks of blocks eg, dirt, stone, wool etc to 'filter' for example but it didn't work and simply returned all the items to my inventory. I've using the latest snapshot as of today.

Elliot Angel

migrated

Confirmed

anvil, item, item-renaming, item-stack

Minecraft 1.11.1, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13a, Minecraft 17w13b, ..., Minecraft 17w16b, Minecraft 17w17a, Minecraft 17w17b, Minecraft 17w18a, Minecraft 17w18b

Minecraft 1.12 Pre-Release 1

Retrieved