Uh oh!
There was an error while loading. Please reload this page.
add item_name property - #2838
Conversation
tal5
left a comment
There was a problem hiding this comment.
I also feel like the meta could explain how this works in relation to ItemTag.display better? But I don't really have any rewrite suggestions so it could be fine as-is for now
| @Override | ||
| public ElementTag toDenizen(Component value) { | ||
| return new ElementTag(LegacyComponentSerializer.legacyAmpersand().serialize(value)); |
There was a problem hiding this comment.
These would lose all advanced text formatting, you want the methods from PaperModule here (and in the other method)
There was a problem hiding this comment.
Changed that. Is there a way I should have known that those methods existed other than just browsing a bunch of code in the module?
Hydroxycobalamin
commented
Jul 24, 2026
I was looking into PRing this too. To make meta clearer I would suggest something like:
Mentioning it on the ItemTag.display mechanism is a good idea from my perspective, as it might be confusing for people. I would add:
|
pending change to itemtag.display meta
| DataComponentAdapter.register(new MaxDurabilityAdapter()); | ||
| DataComponentAdapter.register(new MaxStackSizeAdapter()); | ||
| DataComponentAdapter.register(new RarityAdapter()); | ||
| DataComponentAdapter.register(new ItemNameAdapter()); |
| // @name item_name | ||
| // @input ElementTag | ||
| // @description | ||
| // Controls the item's item_name component. In effect, this changes its display name. Unlike <@link mechanism ItemTag.display>, this name cannot be changed by an anvil, but will be hidden when the display is set, such as with an anvil. That is, it will remain under the display name and be shown again if the display is removed. |
There was a problem hiding this comment.
This line is really long, you can have multiple lines divided by sentence when necessary.
creaturesofhabit
commented
Jul 24, 2026
Should item script containers use this instead of or in addition to display? I think it's generally a better option for 98% of use cases. Having a display name and item name key would be extremely confusing, but of course just changing it out would be breaking even if it weren't paper-only |
| @Override | ||
| public ElementTag toDenizen(Component value) { | ||
| return new ElementTag(PaperModule.stringifyComponent(value)); |
There was a problem hiding this comment.
| returnnewElementTag(PaperModule.stringifyComponent(value)); | |
| returnnewElementTag(PaperModule.stringifyComponent(value), true); |
Since this is purely a display name, should explicitly tell Denizen this is always plain text.
| // @group properties | ||
| // @description | ||
| // Returns the display name of the item, as set by plugin or an anvil. | ||
| // Use <@link property ItemTag.item_name> to get the item's item name component, which cannot be changed by an anvil. |
There was a problem hiding this comment.
These read to me like item_name is the proper way to do this instead of being just an alternative, I would just put a See also <@link property ItemTag.item_name> and let people go read that meta for more information
For https://discord.com/channels/315163488085475337/1362329776475603057. Works as expected on 26.2 and 26.1.
Considered mentioning this property in the item.display documentation since this is probably to be preferred for most use-cases, but didn't want to mess with other files.