-
New Feature
-
Resolution: Fixed
-
Minor
-
None
-
None
-
1.13.1
-
Yes
Hello,
I need a way to get all drops caused by a block break, for example if a torch is placed on top of a stone block, I need both drops, the stone drop and the torch drop. This also needs to respect if the block was mined with silktouch, fortune, bare hand or something else. The BlockBreakEvent can't give away this information, because it is called before the breaking calculation. If my understanding of the Code is correct, the thing I need is already in the PlayerInteractManager, (Decompiled Lines 315 to 326 in Method public boolean breakBlock(BlockPosition))
this.world.captureDrops = new ArrayList(); boolean flag = this.c(blockposition); if (event.isDropItems()) { Iterator var21 = this.world.captureDrops.iterator(); while(var21.hasNext()) { EntityItem item = (EntityItem)var21.next(); this.world.addEntity(item); } } this.world.captureDrops = null;
this.world.captureDrops seems to store all drops caused by the block to break, so they can be prevented dropping, if isDropItems was set to false. It would be awesome if some sort of event could be added on this place, something like BlockBreakDropItemsEvent(Player, Block, List<Items>), to access the excact drops caused by the breaking of this block.
Best regards
- relates to
-
SPIGOT-891 get/setDrops method in BlockBreakEvent
- Resolved