Set item not stackable

Discussion in 'Spigot Plugin Development' started by Minipong, Jun 12, 2017.

  1. Is there a way to set it in a server so that an item has meta that makes it unstackable, or just make it so you can't stack an entire item? (i.e. Dirt acts like a sword, can't be stacked)
     
  2. Add a unique lore or NBT tag to the item, it won't be stackable because it's not equal to another items.
     
    • Agree Agree x 1
  3. No that's the thing, they HAVE the same lore... that's why i don't want them to stack xD

    Any other ideas?

    But wait, what's an NBT tag?
     
  4. Okee dokee...
    I found out what an NBT Tag is (kinda) but could u explain a bit more?

    ItemStack stack = new ItemStack(Material.NETHER_STAR, 1);
    ItemMeta im = stack.getItemMeta();
    im.setDisplayName("§f§lPure Charge Orb");
    im.setLore(Arrays.asList("§f1000"));
    stack.setItemMeta(im);

    p.getInventory().addItem(new ItemStack(stack));

    What would I add to my code to get it to add to the nether star? Do i add it in itemmeta?

    I.e: im.setNBTTag or something like that
     
  5. I don't know much more about items... Just search out there about how to play with NBT Tags in development, you'll find the solution.
    Also you can make the NBT Tags invisible.
     
  6. Alright rip. Anyone else know how?
     
  7. Oh yeah, I already saw that one. I'm still a bit confused tho xD
    I'll look at it again
     
  8. I'm just confused what the NBT Tag "looks" like. Would you mean explaining it? Because it's saying it has a display "compound", but I don't want anything to display on the item. I just want it's meta to be different so it can't stack.
     
  9. Mas

    Mas

    Why do you hate APIs? I'm not sure you mean this.
    If you really do, then I guess you should stop using the Spigot API right now :p
     
    • Agree Agree x 1
  10. Lol- well... you pasted a bunch of code using the Spigot API (ItemMeta). I mean there are no methods for NBT in the Spigot API, so you have to use NMS or some other lib.

    You may want to look up what API means :)
     
    • Agree Agree x 1