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?
|
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.
|
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 |
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.