[Bug] Dropping Items in the World

Discussion in 'Plugin Development' started by Freack100, Jul 26, 2014.

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

    Freack100

    Hello Bukkit forums,
    I'm working on a plugin right now and I got to a point where I have to spawn an Itemstack in my world. currently I'm doing it like this:
    Code:java
    1. ItemStack item = new ItemStack(Material.SOME_ITEM,1);
    2. World world = Bukkit.getWorlds().get(0);
    3. Location loc = new Location(world,1,1,1);
    4. world.dropItem(loc,item);

    (The values aren't the same BTW)

    I'm doing this in a repeating sheduler and it is spawning the items, but every time it spawns the item, the exisiting stack gets removed and a new one spawns. Is it a problem with Bukkit or my coding?

    thanks for any help I get,
    Freack100
     
  2. Offline

    Onlineids

    Freack100 Your spawning a item on another one, its probably grouping them
     
    Freack100 likes this.
  3. Offline

    valon750

    Freack100

    Exactly what Onlineids has stated, ItemStacks now group to increase performance along side other things.
     
    Freack100 and Onlineids like this.
  4. Offline

    Freack100

    Onlineids valon750
    okay, thanks, any idea how I can "fix" this for my Rush like game?
     
  5. Offline

    valon750

    Freack100

    Well outside of editing every single ItemStack so it's technically different?

    There may be a guru out there that may suggest reflection, involving changing some value that means they won't stack higher, however I'm not that kind of guy.
     
  6. Offline

    fireblast709

  7. Offline

    valon750

    That's what I'm assuming fireblast709, however what part of the ItemMeta would you suggest?

    Most I can think of is display name / lore, but there's probably something else?
     
  8. Offline

    fireblast709

    valon750 name and lore are the most suitable, due to the fact that they apply to all ItemStacks, and they use Strings, which allows a huge variety of unique values. If ItemMeta is already used, then I recommend adding a unique number to the end of the lore List, just a global incrementing int would do perfectly fine ('global incrementing int' is just an int field which increments each time you use it)
     
  9. Offline

    Freack100

    fireblast709 valon750
    Thx for your help!
    Somewhere else I found out that I can change a setting which is merging itemstacks.
     
Thread Status:
Not open for further replies.

Share This Page