DecentHolograms icon indicating copy to clipboard operation
DecentHolograms copied to clipboard

CustomModelData does not show in hologram items

Open UltraFaceguy opened this issue 2 years ago • 5 comments

Just making sure

  • [X] I have read the wiki and made sure, this feature is not yet in the plugin.
  • [X] I believe, that this feature is possible to implement.
  • [X] I made sure, that this feature has not been requested yet.

Feature

Currently, CustomModelData does not show up on itemstacks in hologram lines (1.14+). This could be trivially implemented as easily as item durability in holograms.

UltraFaceguy avatar Aug 28 '22 22:08 UltraFaceguy

Question: How do you actually apply the custom model data? (Also, why did you edit out parts of your issue?)

Andre601 avatar Aug 28 '22 22:08 Andre601

Question: How do you actually apply the custom model data? (Also, why did you edit out parts of your issue?)

I'm simply using DHAPI.addHologramLine(hologram.getPage(1), itemStack); and in this case the itemStack has model data. I took a look and model data doesn't seem to be implemented in ItemBuilder.class, referenced in HologramItem.fromItemStack, nor is it parsed in HologramItem#parseContent.

Also I edited it because it left in the template info for fields I didn't fill out and figured reading that would be a waste of time.

UltraFaceguy avatar Aug 28 '22 22:08 UltraFaceguy

Hello, you can only set custom model data in the string format of items. (As you would outside of API) The problem is, that it's quite difficult to get the custom model data from an existing ItemStack. We would have to access the NBT and I will eventually do that but for now, it's best to just use the string format and add custom model data though the NBT argument.

Example: #ICON: DIAMOND_SWORD {CustomModelData:1}

d0by1 avatar Sep 03 '22 13:09 d0by1

Hello, you can only set custom model data in the string format of items. (As you would outside of API) The problem is, that it's quite difficult to get the custom model data from an existing ItemStack. We would have to access the NBT and I will eventually do that but for now, it's best to just use the string format and add custom model data though the NBT argument.

Example: #ICON: DIAMOND_SWORD {CustomModelData:1}

At least for newer versions is there a getCustomModelData in the ItemMeta class afaik. So for those would this stuff exist... Not sure how it would be done on older versions tho

Andre601 avatar Sep 03 '22 13:09 Andre601

Yeah, there is the ItemMeta#getCustomModelData() method. It's pretty annoying that this data is not kept through the API :/

SkytAsul avatar Oct 24 '22 17:10 SkytAsul

Any news on this?

SkytAsul avatar Mar 22 '23 18:03 SkytAsul

Any news ?

EnderGriefeur99 avatar Oct 29 '23 11:10 EnderGriefeur99

Hello, this feature has been added in 2.8.5. CustomModelData now gets preserved when used on a custom ItemStack, in hologram line content.

d0by1 avatar Nov 12 '23 09:11 d0by1

Hey @d0by1, I found a small issue, API v2.8.5 gives me a error that de.tr7zw:item-nbt-api:jar:2.12.1 was not found in the maven repo, while v2.8.4 doesn't, is there any maven repo I need to install besides jitpack?

lokerhp avatar Nov 12 '23 16:11 lokerhp

That sounds like a bad transistive dependency here... You shouldn't have to include the Item-NBT-API as DH only uses it for getting specific item values...

Also, DH should include the dependency itself as it is defined as an implementation and also relocated. Tho, that's all I can say here...

Andre601 avatar Nov 12 '23 16:11 Andre601