ItemStack on Explosion

Discussion in 'Plugin Development' started by MeneXia, Nov 26, 2011.

Thread Status:
Not open for further replies.
  1. Hi, I'm fairly new to Java and Bukkit, and I need help on getting the itemstack from an explosion.

    Here is my code:
    Code:
    public class DFEntityListener extends EntityListener {
        public static DynaFish plugin;
        public DFEntityListener(DynaFish instance) {
            plugin = instance;
        }
    
        public void onEntityExplode(EntityExplodeEvent event) {
    Entity ent = event.getEntity();
    if (ent instanceof TNTPrimed && (ent.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid())) {
        World w = event.getLocation().getWorld();
        Random random = new Random();
        int amt = random.nextInt(32);
        ItemStack i = new ItemStack(349);
        i.setAmount(amt);
        w.dropItemNaturally(event.getEntity().getLocation(), i);
    }
        }
    }
    Yes, it's basic, but what appears from this is a pile of fish (349) after the explosion happens.
    Is there a way to drop multiple itemstacks after the explosion (so the pile is spread out)?

    Thanks, - MeneXia
     
  2. Offline

    ItsHarry

    Eh, I think you would have to call dropItemNaturally multiple times.
     
  3. Hm, I'll try that, thanks.
     
Thread Status:
Not open for further replies.

Share This Page