Fix HIDE_ATTRIBUTES flag not working for items without attributes set#11088
Fix HIDE_ATTRIBUTES flag not working for items without attributes set#11088NewwindServer wants to merge 1 commit into
Conversation
|
This was an intentional change. Have you tested this with non-armor items? (Those have special handling on the client to fallback to their default when empty attribute modifiers are defined) |
|
This just relies on highly inconsistent behavior which seems to confuse everybody who ends up touching it. Adding a component will override the default component, mojang has some logic that they scatter around which is smart enough in some cases to get the default values, but, there are many cases where they just don't, and so you end up with an item which will behave unpredictably in many cases. I think that the best solution here would be to allow people to explicitly opt into having an empty component, however, ItemMeta doesn't exactly handle that well and just further perpetuates the potential headaches of promising sane behavior around such a clugy API. |
|
Armor was tested and worked fine, however, upon further investigation, behaviour for weapons is indeed inconsistent. A workaround would be to send the empty attributes NBT only to the client, as client-side it doesn't cause any issues, since attributes appear to be server-sided, however, this will likely change due to https://bugs.mojang.com/browse/MC-272517 |
Fixes #10744
Currently, on paper, when you add HIDE_ATTRIBUTES flag to an item, e.g. a diamond sword, it incorrectly still shows the "When in main hand 7 attack damage..." default attributes, which are supposed to be hidden.
On spigot, however, these default attributes are correctly hidden, upon investigation, the general-itemmeta-fixes patch breaks this functionality, This PR fixes the functionality and brings it back in line with spigot/pre 1.20.5 behaviour.
Note, on #10744 there is a comment stating that having empty attributes defined on the item overrides the default attributes, but from my testing this does not appear to be the case.