[SPIGOT-6986] Applying CustomModelData is different based on the item being applied to Created: 31/Mar/22 Updated: 25/Dec/24 Resolved: 02/Apr/22 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Glare M. | Assignee: | Unassigned |
Resolution: | Incomplete | Votes: | 0 |
Labels: | Craftbukkit | ||
Environment: |
Java 17 Windows 11 |
Version: | [16:43:33] [Server thread/INFO]: This server is running CraftBukkit version 3470-Spigot-ffceeae-1092219 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) |
Guidelines Read: | Yes |
Description |
When using CraftItemStack.asBukkitCopy(), the output seems to differ based on the item and how it's utilized in-game.
For example: If I have some SHEARS and I want to apply CustomModelData to it using NMS, since the SHEARS already have attributes, it will already have an NBTTag, so applying the CustomModelData will work just fine. Shears: Line 1: The NBT tag for the item Line2: The result of it after running CraftItemStack.asBukkitCopy() on it. [16:28:51] [Craft Scheduler Thread - 3/INFO]: Tag: {Count:1b,CustomModelData:5,Damage:0,id:"minecraft:shears",tag:{Count:1b,CustomModelData:5,Damage:0,id:"minecraft:shears"}} [16:28:51] [Craft Scheduler Thread - 3/INFO]: ItemStack{SHEARS x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, custom-model-data=5, internal=H4sIAAAAAAAA/4XKQQqAIBAF0G9ihJs6T1vddoghJxNSQcf7B12gt34WWDClgC2nwmejS/Z+M7WuYFwdRZSFFop/S2N1o0vNRw38eBICYDRmT5ki4/MCOqqRKG4AAAA=}} Stick: Line 1: The NBT tag for the item Line2: The result of it after running CraftItemStack.asBukkitCopy() on it. [16:28:51] [Craft Scheduler Thread - 3/INFO]: Tag: {Count:1b,CustomModelData:5,id:"minecraft:stick"} [16:28:51] [Craft Scheduler Thread - 3/INFO]: ItemStack{STICK x 1} As you can see here, the shears worked fine applying the extra NBT information to it because it already existed. When it comes to the stick, because that stick did not already have an NBT tag on it, when you create a new tag and apply it to the ItemStack and then run CraftItemStack.asBukkitCopy() on the item, it doesn't apply the standalone tag that was applied to it to add the CustomModelData.
Stick with display name: Line 1: The NBT tag for the item Line2: The result of it after running CraftItemStack.asBukkitCopy() on it. [16:38:07] [Craft Scheduler Thread - 10/INFO]: Tag: {Count:1b,CustomModelData:5,display:{Name:'{"extra":[{"text":"test"}],"text":""}'},id:"minecraft:stick",tag:{Count:1b,CustomModelData:5,display:{Name:'{"extra":[{"text":"test"}],"text":""}'},id:"minecraft:stick"}} [16:38:07] [Craft Scheduler Thread - 10/INFO]: ItemStack{STICK x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":"test"}],"text":""}, custom-model-data=5, internal=H4sIAAAAAAAA/+NiYOBgYMpMYeDPzcxLTS5KTCuxKi7JTM5mZGB1zi/NK2HkYmAuSUwnoIiZgd+5tLgkP9c3PyU1xyWxJJGBgYGVi4E9JbO4ICexkoOBxS8xN5VBtVoptaKkKFHJKrpaqQTIVLICUsUlSrWxOjC+Ui1QLwDxx3sOmAAAAA==}} You can see here that the CustomModelData did properly apply because there was also a display-name component applied to it.
Summary:
|
Comments |
Comment by md_5 [ 02/Apr/22 ] |
It's not clear from this ticket what the issue actually is or how to reproduce it. |
Comment by Black Hole [ 02/Apr/22 ] |
If the implementation is inconsistent, it should be reproduceable using the mentioned methods. |
Comment by Parker Hawke [ 02/Apr/22 ] |
I do still think this is a bug that should be addressed. Seems to be an inconsistent implementation of ItemMeta for CustomModelData. Someone better at ItemMeta would be better suited to inform about the issue as I'm not familiar enough with its implementation. |
Comment by Black Hole [ 01/Apr/22 ] |
Spigot can't support any possible modification bypassing the API. So this ticket is invalid. |