Loading NBT causes ItemStack to become unstackable?

Discussion in 'Plugin Development' started by StaticJava, Jan 23, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    StaticJava

    Hey Bukkit,

    I'm using an NBT library (http://bukkit.org/threads/library-edit-or-create-nbt-tags-with-a-compact-class-no-obc-nms.178464/) to save/load NBT tag data from ItemStacks in my custom inventory. The problem is that whenever I load NBT data from a file into an ItemStack, other ItemStacks with the EXACT same NBT aren't able to be stacked.

    Example: I save the NBT data of 32 diamond, which is actually blank. Then, I leave the server, and come back on, causing the NBT to load back in that diamond, which is still blank. Now, if I mine, and get 3 diamond, I am unable to stack my new 3 diamond on the existing 32 diamond to create 35 diamond.

    If more info is needed, please ask me!

    Any help is appreciated,
    ~StaticJava
     
  2. Offline

    NathanWolf

    That's weird, CraftBukkit's item comparison methods don't even care about NBT data- well, non-standard data anyway.

    I would suggest debugging a bit by logging the items directly (their toString methods will serialize the item stack, showing you all known properties), and also logging getMaxStackSize - just in case the lib is setting that to 1 for some reason.

    Does this library have a way to list all the NBT data for an item? If so, you may want to try that, too- though assuming you are on CB 1.7.x or earlier I don't think the extra data is going to matter for stacking purposes.

    That's all I can think of .. I'm guessing this has got to be something with the way that library is dealing with data, especially if it's messing with items you haven't even set data on. I
     
Thread Status:
Not open for further replies.

Share This Page