Posted April 27, 20187 yr I'm trying to take the NBT data from a shulkerbox ItemStack and turn it's contents into a list of ItemStacks. I couldn't find any examples of anyone doing this so I tried doing it myself. So far I have an NBTBase list with things such as: {Slot:0b,id:"minecraft:diamond_sword",Count:1b,tag:{ench:[{lvl:3s,id:16s}]},Damage:0s} I can think of a couple of ways to convert this. But nothing simple. Any ideas?
April 28, 20187 yr Author Hm, should I use ItemStackHelper.loadAllItems(NBTTagCompound, itemlist)? That looks right. I have no idea what tag I should put in there though.
April 28, 20187 yr Author Oh wow you can create an itemstack straight from that nbt tag. new ItemStack(NBTTagCompound); Thanks for pointing me in the right direction!
April 28, 20187 yr Author ¯\_(ツ)_/¯ Really? I think it's working. Edited April 28, 20187 yr by ZephaniahNoah
April 28, 20187 yr Author Here's exactly what I did to convert the nbt tag to an itemstack. ItemStack stack = new ItemStack(nbttaglist.get(i)); Anyways, I figured out how to do this in that class you told me to look in. Thanks again for the help. EDIT: Oh yea it's in a for loop because it's a list of NBTTagCompounds. That's why there's an i. Edited April 28, 20187 yr by ZephaniahNoah
April 28, 20187 yr Author Aah, I see what you mean. Less code now. ItemStackHelper.loadAllItems(compound, itemlist); Right?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.