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


    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:

    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


  3. Offline


    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


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

Share This Page