Item Name Changing Class

Discussion in 'Resources' started by stirante, Oct 6, 2012.

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

    juampi_92

    I'm sorry i'm new in this, but i got this error, and i googled it and nothing.

    I was hoping you could help me understand why this happens:

    The import org.bukkit.craftbukkit cannot be resolved
    Line: import org.bukkit.craftbukkit.inventory.CraftItemStack;

    and:
    The import net cannot be resolved
    Line: import net.minecraft.server.NBTTagCompound;

    BTW, import org.bukkit.inventory.ItemStack; works fine.

    Using: bukkit-1.4.7-R1.0.jar

    Thanks. I'm going to keep googling just in case.
     
  2. Offline

    DSH105

    Setting item names doesn't require NBTTags anymore. It uses ItemMeta.
    Code:java
    1.  
    2. public static ItemStack setItemMeta(ItemStack item, String name, String lore) {
    3. ItemMeta im = item.getItemMeta();
    4. im.setDisplayName(name);
    5. im.setLore(Arrays.asList(lore));
    6. item.setItemMeta(im);
    7. return item;
    8. }
    9.  
     
    stirante likes this.
  3. Offline

    juampi_92

    Thanks.

    Anyway, i tried using the external library craftbukkit (the server) for my proyect, and all of this worked.
     
  4. Offline

    Snipey

    @stirante Could you possibly fix this library for bukkit 1.5?
     
  5. Offline

    DarkBladee12

    Snipey You won't need this library, because Bukkit added the ItemMeta, with which you can rename and set the lore of items!
     
  6. Offline

    Snipey

    yeah i figured out how to do it :/
     
  7. Offline

    stirante

    Maybe someone could close this thread or even delete?
     
  8. Offline

    kreashenz

    stirante Maybe update the code to show ItemMeta and setting new names etc, that'd be much better than deleting it.
     
Thread Status:
Not open for further replies.

Share This Page