Drop Item

Discussion in 'Spigot Plugin Development' started by Reneue, Apr 24, 2017.

  1. Currently Im making a AutoSmelt plugin so when you mine a ore it gives you the item in your inventory. All of it is basically done but I am not sure how to make it not drop the item when I break the block on just the IRON ORE. How would I do this?
  2. WAS


    You'll probably want to cancel the event and set the block AIR so it appears the block broke, I'd imagine. Additionally if you are always cancelling the event or there is a instance you need a item (or custom item) to drop, there is the Block#breakNaturally() method.
  3. On block break event, get the drop, check its type, if it's something you want to smelt cancel the event then drop the item type of the smelted material you want

    Sent from my iPhone using Tapatalk
  4. Cancel break event, set block to air, compare what the smelted item should be. Then use
  5. BlockBreakEvent >
    If block's type == Material.IRON_ORE >
    Set block's type to Material.AIR >
    World#dropItem(at block's location an iron ingot)
  6. Why do you need to repeat exactly what I said.....
  7. Pot... kettle... black?

    Sent from my iPhone using Tapatalk
    • Like Like x 1
  8. Like you repeated what @dNiym said? Explaining it in different ways (I gave pseudo-code, you didn't) is better.

    You should get off your high horse, but maybe you're just desperate to have the credit for "fixing the issue".
  9. Just going to mention this, NEVER EVER use BlockBreakEvent for that.
    All you need here is the BlockDispenseEvent.
    • Informative Informative x 2