Jump to content

NBT Not on item stack


Dijkstra

Recommended Posts

So this is all guess work bu i have up with this for NBT

NBTTagCompound nbt = new NBTTagCompound();
                        nbt.setString("modle", "blockDiamond");
                        nbt.setString("owner",player.getDisplayNameString());
                        nbt.setString("date", String.format("%1$td/%1$tm/%1$tY", System.currentTimeMillis()));
                        ItemStack item= moddedAchievement.item();
                        item= new ItemStack(item.getItem(), item.stackSize, iem.getMetadata(), nbt);

This is obviously wrong but this is my first attempt of giving a item stack NBT

 

I have also tire the write to nbt method with no luck

 

away the item stack is added to player like this

player.inventory.addItemStackToInventory(item)

if it is important all this is only happening server side

 

Link to comment
Share on other sites

Do not use the

ItemStack(Item, int, int, NBTTagCompound)

constructor, the fourth argument is for the capability data rather than the stack's compound tag. Use

ItemStack#setTagCompound

to set the stack's compound tag.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.