Hello, here I'm back again.
So I have new issue.
So I convert into gson the itemstack using adapter that uses the method to serialize
new JsonParser().parse(NBTItem.convertItemtoNBT(itemStack).asNBTString())
And to deserialize
'ItemStack itemStack = NBTItem.convertNBTtoItem(new NBTContainer(utf8(jsonElement.toString())));'
The issue is that when deserialized it returns AIR.
I've checked for differences at gson toString() vs asNBTString() and they return same stuff, but there's few differences which I think is causing that to happen. The values are Count and Damage. They're values contain qoutes. Which is why I think this is messing up. Not sure tho.
Here's my test code
`
JsonElement serialized = gson.toJsonTree(event.getItem());
serialized.getAsJsonObject().remove("class");
NBTContainer nbtContainer = new NBTContainer(ItemStackAdapter.utf8(serialized.toString()));
System.out.println("1: " + nbtContainer.asNBTString());
System.out.println("2: " + NBTItem.convertItemtoNBT(event.getItem()).asNBTString());
System.out.println("1v: " + NBTItem.convertNBTtoItem(new NBTContainer(nbtContainer.asNBTString())));
System.out.println("2v: " + NBTItem.convertNBTtoItem(new NBTContainer(NBTItem.convertItemtoNBT(event.getItem()).asNBTString())));`
And here's the output
1: {id:"minecraft:hopper",Count:"4b",tag:{lvl:"1",display:{Lore:["This hopper teleports specified monster type","To it's location & freezes them","* Current mob: Pig"],Name:"[MobGrind] Hopper"},isGlobal:"true",isAuto:"false",ent:"PIG",type:"Grind",name0:"grindHopper"},Damage:"0s"} 2: {id:"minecraft:hopper",Count:4b,tag:{lvl:"1",display:{Lore:["This hopper teleports specified monster type","To it's location & freezes them","* Current mob: Pig"],Name:"[MobGrind] Hopper"},isGlobal:"true",isAuto:"false",ent:"PIG",type:"Grind",name0:"grindHopper"},Damage:0s}
`1v: ItemStack{AIR x 0}
2v: ItemStack{HOPPER x 4, TILE_ENTITY_META:{meta-type=TILE_ENTITY, display-name=[MobGrind] Hopper, lore=[This hopper teleports specified monster type, To it's location & freezes them, * Current mob: Pig], internal=H4sIAAAAAAAAABXKQQqAIBAF0B9mDHWZOkIra9cVjKYQJhW1oNtXywevBQhKbkE1EMhlI2G1grqkiwmNy+NVAvRuJX9W7AvUMhv6xhMZ2iTnN4L29uQe3fFzCjFywgvcWwRyXAAAAA==, blockMaterial=HOPPER}}
`
P.S: Sorry for formatting, github is messed up :D