ItemStack Datavalue

Discussion in 'Plugin Development' started by bazsi700, Jul 21, 2015.

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

    bazsi700

    I have got this code:
    Code:java
    1.  
    2. if (Material.getMaterial(itemid) != null && 0 <= damage && damage <= 999) {
    3. ItemStack is = new ItemStack(Material.getMaterial(itemid), 1, (short) damage);
    4. ArrayList<String> lore = new ArrayList<String>();
    5. lore.add("Floating");
    6. ItemMeta im = is.getItemMeta();
    7. im.setLore(lore);
    8. is.setItemMeta(im);
    9. final Item i = ((Player) sender).getLocation().getWorld().dropItemNaturally(((Player) sender).getLocation(), is);
    10.  


    It should drop an item with the given id and data value, but its not really working. For 24:<any number> it gives a simple sandstone. For 5:<any number> it gives the same type of wood (not the normal maybe black oak, not sure). Why isn't it working?
     
  2. Offline

    bazsi700

    @Assist
    Before I used setDurability(). Made the same a bug. And wood plank doesn't work aswell.

    Bump. Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 11, 2016
  3. Offline

    bazsi700

    Bump. Please someone.
     
Thread Status:
Not open for further replies.

Share This Page