Issue at converting json itemStack to ItemStack.
OOP-778 opened this issue · 3 comments
Hello, I have an issue with converting json string to ItemStack.
Here's my prototype code:
NBTItem nbtItem = new NBTItem(event.getItem());
String nbtItemString = nbtItem.asNBTString();
System.out.println(nbtItemString);
ItemStack item = NBTItem.convertNBTtoItem(new NBTContainer(nbtItemString));
System.out.println(item);
And the output is:
{lvl:"1",display:{Lore:["This hopper teleports specified monster type","To it's location & freezes them","* Current mob: Pig"],Name:"[MobGrind] Hopper"},isGlobal:"false",isAuto:"false",ent:"PIG",type:"Grind",name0:"grindHopper"}
ItemStack{AIR x 0}
Am I doing smth wrong?
Yea, you have to use NBTItem.convertItemtoNBT(item).asNBTString().
If you just use an NBTItem and call asNBTString() you just get the data on the Item, but not the Item itself.
@misterzet Any other problems or can I close the issue?
You can close it
…On 2020-02-03, Mon at 12:12, tr7zw ***@***.***> wrote:
@misterzet <https://github.com/MisterZet> Any other problems or can I
close the issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#65?email_source=notifications&email_token=AH6QE2LNMLES7O5A5D32FMTRA7UZPA5CNFSM4KMM2672YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKTHZMI#issuecomment-581336241>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH6QE2IA2B5AMIJ2R36L4VDRA7UZPANCNFSM4KMM267Q>
.