/** * triggered when a block was destroyed and dropped in the world used to intercept gathering by * minions and sending the block to their inventory the droppedblock in the world then gets * destroyed, possible duplication exploit */ @ReceiveEvent(components = {MinionComponent.class}) public void onBlockDropped(BlockDroppedEvent event, EntityRef entity) { if (entity.hasComponent(MinionComponent.class)) { EntityRef item; if (event.getOldBlock().getEntityMode() == BlockEntityMode.PERSISTENT) { item = blockItemFactory.newInstance(event.getOldBlock().getBlockFamily(), entity); } else { item = blockItemFactory.newInstance(event.getOldBlock().getBlockFamily()); } entity.send(new ReceiveItemEvent(item)); event.getDroppedBlock().destroy(); } }