I have some blocks in my mod which detect when a player breaks them using the BreakEvent. In survival mode, the block drops an item and is immediately replaced by the same block, making an infinite farm basically. In creative mode, you can permanently destroy/place the block as normal. That seems to work well for players, but say if a modded block (like the Create mod drill) breaks them, then it seems to simply just destroy the block, without triggering the event. How could I make is such that a non-player like the drill can replicate that same behavior as a player in survival? Based upon my own research into Create's source code (plus my own testing), the drill does not seem to trigger a BreakEvent. Though I'm surprised the event just doesn't trigger on its own anyways (though I am still learning about events generally so I am probably missing something). public static class ForgeEvents {
@SubscribeEvent
public static void onBreak(BlockEvent.BreakEvent event) {
BlockEntity blockEntity = event.getLevel().getBlockEntity(event.getPos());
boolean found = false;
if (blockEntity instanceof OreVeinEntity) {
//creative mode only can destroy the blocks
if (!event.getPlayer().isCreative()) {
//do stuff