I am using the Bukkit 1.8.3 API with Java 7.
I have code that explodes blocks upon when you break it. It launches an explosion that breaks blocks around the block you just broke. My problem is that the exploded blocks are not dropping, just the one that the player has broke already. I have tried to fix it by adding this event (also, my events are registered):
@EventHandler
public void onEntityDamage(EntityDamageByBlockEvent e)
{
if(e.getCause().equals(DamageCause.BLOCK_EXPLOSION))
{
if (explosive)
{
e.setCancelled(true);
}
}
}
This stops the player from being damaged, but not the blocks from being dropped. I thought that since the dropped block is an entity this would work. However it is not. So how would I get the exploded blocks to drop?
This is the code I use to explode the block in the first place:
loc.getWorld().createExplosion(loc, lvl1);
loc
is the block location. lvl1
is the float for the radius of the explosion.