Solved Renaming an item?

Discussion in 'Plugin Development' started by pkt, Jan 2, 2013.

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

    pkt

    I've been looking around for about 2 hours now, and I found a couple of examples, but they do not work.

    Can anyone show me a working example of how to rename an item and how to have a mob drop it on death (without using any other LIBs)
     
  2. Offline

    ZeusAllMighty11

    Renaming is easy

    Code:
    ItemStack dsword = new ItemStack(Material.DIAMOND_SWORD, 1);
    ItemMeta meta = dsword.getItemMeta();
    meta.setDisplayName(ChatColor.AQUA + " Diamond Sword ");
    dsword.setItemMeta(meta);
    
    It's as simple as that.



    As for dropping it on death, you will have to drop that custom item stack above, altered how you wish.. never worked with mob drops so not positive
     
  3. Offline

    pkt

    omg, thank you. That was actually the first thing I tried, I was close...

    ZeusAllMighty11

    Is there a way to check if a crafting ingredient is the renamed item?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 8, 2016
  4. Offline

    fireblast709

    if("Your Name".equals(stack.getItemMeta().getDisplayName()))
     
  5. Offline

    pkt

    I mean if I wanted to add an ingredient to a shapeless recipe, it will say "The method addIngredient(MaterialData) in the type ShapelessRecipe is not applicable for the arguments (String)"
     
  6. Offline

    fireblast709

    then somehow you are passing a String when you should not
     
Thread Status:
Not open for further replies.

Share This Page