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

Unable to hide attributes without setting attributes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.20.6, 24w19b, 24w20a, 24w21b, 1.21 Release Candidate 1, 1.21
    • None
    • Community Consensus
    • Commands

      Problem

      Before the change over to data components, the HideFlags nbt could be set without having to set any data that would be hidden by the flag. However, now that the show_in_tooltip is part of the attributes data component (and a bunch of others), you have to actually set some attributes in order to change it to false.
       

      Steps to Reproduce

      • /give @s wooden_pickaxe[minecraft:attribute_modifiers={show_in_tooltip:0b,modifiers:[]}]
        

        This command gives you a wooden pickaxe that hides the modifiers, but in order to do so, you have to actually set the modifiers list to an empty list, which now removes the default modifiers.

      • Use the attached datapack with an item modifier and run that modifier on the item in your hand. The toggle_tooltips function does hide the tooltips while keeping the modifiers, but the implicit modifiers for that item type are copied over to the stack itself, so future changes to the default of the stack won't affect this stack.

      Incorrect Solutions

      • You cannot just set an empty list of attributes because that overrides the implicit attributes (for non-armor items – see MC-271826). Setting an empty list of attributes just removes the attributes
      • Copying over the default attributes makes the item not inherit changes to the default attributes made by the game in different versions. If all I want to do is hide the attributes and ensure the default attributes are still used, I can't copy them over

      This should, therefore, be considered a regression in behavior as you could do this pre-data components.

      Other data components suffer from the same issue, however none of the other data components that have included tooltip toggles have implicit values for an item type while the attributes one does.

      Possible Solution

      • Making the attribute modifier list an "optional" to signify that no modifiers have been set introduces a new state separate from an empty list. Setting an empty list still should mean you want no modifiers, but an empty optional means fallback to the possible implicit data components
      • Could split out the hide tooltip into a separate data component.

            Unassigned Unassigned
            Machine Maker Jake Potrebic
            Votes:
            8 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: