How to convert Itemstack into JSON?

Started by MrFesli on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to convert Itemstack into JSON?

I've tried making a mod, and i need to write to a file an item, but the difficult part is that i need to retain ALL Item nbt, i've tried using Gson However it gave me the following error: Failed making field 'java.util.Optional#value' accessible; either increase its visibility or write a custom TypeAdapter for its declaring type. and I cant exactly understand what does it mean (as im unfamilliar with Gson) I tried searching on the web, however i did not find anything useful. So Is there a way to either A: Convert Itemstack into JSON object, or B: Get All NBT Tags from Itemstack if any of you know how to do that please write down below, Thanks