Solved Items are invisible when dropping multiple tile drops.

Discussion in 'Spigot Plugin Development' started by Zer0thElement, Apr 1, 2020.

  1. I'm trying to recreate a plugin from a Youtube challenge video; In the video item drops grow geometrically. The issue I have is that past 127 items, the drops become invisible and I'm not sure why. The item drops are "there," but they're invisible until I pick them up. The code, as it is right now, multiplies the integer variable numItems by 2 every time the event is triggered. Any and all help would be appreciated.
    Code (Text):
    block.getWorld().dropItemNaturally(event.getBlock().getLocation(),  new ItemStack(event.getBlock().getType(), numItems)); //127 limit
            numItems = numItems * 2;
     
  2. Your issue it that the items are invisible or that the variable is multiplied by two?
     
  3. The issue is that the items are invisible.
     
  4. If the issue only occurs when it's more than 127, try splitting it, so that the method fires multiple times with less than 127.
     
    • Agree Agree x 1
  5. Thank you for your help. I used a for loop to invoke the method multiple times. Here's the altered code.
    Code (Java):
    for(int a = 0; a <= numItems; a++)
            {
                block.getWorld().dropItemNaturally(event.getBlock().getLocation(),  new ItemStack(event.getBlock().getType(), 1));
            }
            numItems = numItems * 2;