diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java index 7bc6281ed..393d6d650 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java @@ -23,6 +23,7 @@ import dan200.computercraft.shared.util.WorldUtil; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -233,6 +234,10 @@ public class TurtleTool extends AbstractTurtleUpgrade return TurtleCommandResult.failure( digEvent.getFailureMessage() ); } + if (!PlayerBlockBreakEvents.BEFORE.invoker().beforeBlockBreak(world, turtlePlayer, blockPosition, state, null)) { + return TurtleCommandResult.failure( "Break cancelled" ); + } + // Consume the items the block drops DropConsumer.set( world, blockPosition, turtleDropConsumer( turtleBlock, turtle ) );