1.12.2 ItemStack NBT Tags

Discussion in 'Spigot Plugin Development' started by jusjus112, Jan 15, 2021.

  1. Hi Guys,

    I have some trouble using NBT tags with item stacks.
    I am setting the NBT tags, like this:

    Code (Java):
        public ItemStack build(){
            if (getType() == Material.AIR){
                return this;
            if (this.itemMeta != null) {

            if (this.isNBTItem()){
                net.minecraft.server.v1_12_R1.ItemStack nmsStack = CraftItemStack
                debug(nmsStack.getName()+" = NAME");

                ItemStack item = CraftItemStack.asBukkitCopy(nmsStack);
                debug(item.getItemMeta()+" = ITEMMETA");

            return this;
    Code (Text):
    public ItemStack build()
    is a function within a class that extends ItemStack.
    Code (Text):
    is a class that extends NBTCompound.

    The "nmsStack.setTag(this.synergyNBTCompound);" is setting the tags, synergyNBTCompound is a copy of NBTTagCompound.
    Code (Java):
    public class SynergyNBTCompound extends NBTTagCompound {
    I am getting this debug output:
    Code (Text):
    The item doesn't have the created item meta from the item itself.
    And yes, the item meta works fine if I return the item without creating the craftItemStack.

    Hope someone knows what's going on.
    #1 jusjus112, Jan 15, 2021
    Last edited: Jan 17, 2021
  2. No one that has any clue?