Solved Drop item on Explosion

Discussion in 'Plugin Development' started by bluegru, Mar 14, 2014.

Thread Status:
Not open for further replies.
  1. How do I cancel the drops from blocks getting destroyed by an explosion?
     
  2. Offline

    alex123099

    bluegru
    A natural explosion or an explosion that you create?
     
  3. Offline

    alex123099

    bluegru
    For a natural exposion you can listen to an entityExplodeEvent
    For your custom explosion, when you create that explosion you can set a destroy blocks boolean to false
     
  4. alex123099
    I know,
    I don't want to diable the blockdamage,
    I want to disable the drops from the destroyed blocks?
     
  5. Offline

    jusjus112

    bluegru
    Code:java
    1. e.getDrops().clear;
     
  6. like this?
    Code:java
    1. public void onBlockBreakByExplosion(EntityExplodeEvent event) {
    2. for (Block block : event.blockList()) {
    3. block.getDrops().clear();
    4. }
    5. }


    I cant do event.getDrops();
     
  7. Offline

    d3v1n302418

    bluegru Instead just use block.setType(Material.AIR); It will remove the drops for you.
     
Thread Status:
Not open for further replies.

Share This Page