Drop Entity Item From a BlockBreakEvent

Discussion in 'Plugin Development' started by Errored, Feb 21, 2013.

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

    Errored

    I'm trying to drop an Emerald when a block is broke. I looked in online docs but I can't seem to narrow down what method I'm suppose to use. Below is cleaned up version of what I'm doing:

    Code:
    public void onBlockBreak(BlockBreakEvent event) {
      final Block origin = event.getBlock();
      final int type = origin.getTypeId();
      if (type == 31) {
        // what do I put here, lol
      }
    }
    
    I'm stuck and any help is appreciated.
     
  2. Offline

    iWareWolf

  3. Offline

    caseif

    First, you'll need to prefix your method with an EventHandler annotation or it won't fire. Second, to drop an item, use event.getWorld().dropItem(ItemStack).
     
  4. Offline

    Errored

    Thanks a lot, very helpful.
     
Thread Status:
Not open for further replies.

Share This Page