Solved ItemStack help!

Discussion in 'Plugin Development' started by Darkpicasa, Sep 10, 2014.

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

    Darkpicasa

    Hey!
    I'm wondering, how do I set the name of an ItemStack object?
    Thanks for all help given!
     
  2. Offline

    FabeGabeMC

    Darkpicasa
    Get the Item Meta, set the meta's display name to whatever you want, then set the item meta to the itemstack.
    TL;DR: (I don't know why but visually.)
    Code:java
    1. //Example stack
    2. ItemStack is = new ItemStack(Material.STONE, 1);
    3. ItemMeta im = is.getItemMeta();
    4. im.setDisplayName("example name");
    5. is.setItemMeta(im);
     
Thread Status:
Not open for further replies.

Share This Page