diff --git a/src/main/java/org/squiddev/cctweaks/turtle/ToolHostPlayer.java b/src/main/java/org/squiddev/cctweaks/turtle/ToolHostPlayer.java index f79314ee..1a21f727 100644 --- a/src/main/java/org/squiddev/cctweaks/turtle/ToolHostPlayer.java +++ b/src/main/java/org/squiddev/cctweaks/turtle/ToolHostPlayer.java @@ -1,5 +1,6 @@ package org.squiddev.cctweaks.turtle; +import dan200.computercraft.ComputerCraft; import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.TurtleCommandResult; import dan200.computercraft.shared.turtle.core.TurtlePlayer; @@ -20,6 +21,7 @@ import org.squiddev.cctweaks.api.IWorldPosition; import org.squiddev.cctweaks.core.Config; import org.squiddev.cctweaks.core.McEvents; +import org.squiddev.cctweaks.core.turtle.TurtleHooks; import org.squiddev.cctweaks.core.utils.FakeNetHandler; import org.squiddev.cctweaks.core.utils.WorldPosition; @@ -86,6 +88,10 @@ public TurtleCommandResult dig(ITurtleAccess turtle, EnumFacing direction, Block if (block != digBlock || !pos.equals(digPosition)) setState(block, pos); if (!world.isAirBlock(pos) && !block.getMaterial().isLiquid()) { + if (ComputerCraft.turtlesObeyBlockProtection && !TurtleHooks.isBlockBreakable(world, pos, this)) { + return TurtleCommandResult.failure("Cannot break protected block"); + } + if (block == Blocks.bedrock || block.getBlockHardness(world, pos) <= -1) { return TurtleCommandResult.failure("Unbreakable block detected"); }