How to convert Itemstack into JSON?

Started by MrFesli on

Topic category: Help with Minecraft modding (Java Edition)

Active 4 months ago
Joined Feb 2021
Points:
614

User statistics:

  • Modifications: 0
  • Forum topics: 5
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 17
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