Jump to content

Convert NBTBase item to ItemStack


ZephaniahNoah

Recommended Posts

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?

Link to comment
Share on other sites

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 by ZephaniahNoah
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.