NBT-API

NBT-API

98.9k Downloads

Custom heads in 1.20.6

xeRicker opened this issue ยท 7 comments

commented

I tried to make custom heads work with the 1.20.6 update but failed. I can confirm that the code in this page is not working.

https://pastebin.com/raw/Fqx0F5VW

Zrzut ekranu 2024-06-13 132926

commented

Correct, this way isnt possible anymore, as vanilla tags are not stored as nbt at runtime.

commented

I tried switching the tags around, but it didn't work either. Is there a workaround for that?

commented

vanilla tags are not stored as nbt at runtime

In 1.20.5+ NBT.modify on items is always just custom nbt, not vanilla nbt.

3 possible workarounds:

  • Convert the ItemStack to nbt, modify the component, turn the nbt back into an itemstack
  • Build the itemstack nbt from the ground up and then turn it into an itemstack
  • Build 1.20.4(or other earlier version) itemstack nbt, upgrade it, and then turn it into an itemstack.
commented

Thanks for the response and the suggested workarounds. I'm still having trouble making custom heads work. Could you provide an example of the code using one of the listed methods?

commented

Nice, gonna check it and update the wiki(as I now also nuked the text from the spigotmc page, also linking the wiki instead).

commented

I added a new method in 2.13.0 that simplifies the process. Take a look at NBT.modifyComponents.

commented

Thanks! It works like a charm :)

https://pastebin.com/raw/kTMpveNf