Bug on dropItemNaturally and dropItem

Discussion in 'Bukkit Discussion' started by redpois0n, Sep 25, 2011.

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

    redpois0n

    Dont ask me why i dont use bug report, but i saw this bug today.
    if i wanna drop a bookshelf on a location, i cant pick it up. Thats all!
    code example:

    event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(drop.getDrop(event.getBlock())));

    Yeah that code drops an bookshelf but it cant be picked up. Please help!
     
  2. Offline

    yanamal

    In case anyone else(like me) has the same problem and stumbles on this post through google don't create a new ItemStack within the function call. For some reason, it only works if you create a new ItemStack object outside of the call and then use that variable. scope issues?..
    Also, specify the quantity of the item stack being created. example:


    ItemStack ladder = new ItemStack(Material.LADDER, 1);
    target.getWorld().dropItemNaturally(target.getLocation().add(1, 1, 1), ladder);
     
  3. Offline

    matter123

    it doesn't need to be created like that target.getWorld().dropItemNaturally(target.getLocation().add(1, 1, 1),new ItemStack(Material.LADDER, 1)); should work just fine and i have used it like that.

    add a quantity like so
    event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(drop.getDrop(event.getBlock())),1);

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
Thread Status:
Not open for further replies.

Share This Page