mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-31 01:27:55 +00:00
needs further testing, but presumably fixes #55
This commit is contained in:
@@ -23,6 +23,7 @@ import dan200.computercraft.shared.util.WorldUtil;
|
|||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
|
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.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
@@ -233,6 +234,10 @@ public class TurtleTool extends AbstractTurtleUpgrade
|
|||||||
return TurtleCommandResult.failure( digEvent.getFailureMessage() );
|
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
|
// Consume the items the block drops
|
||||||
DropConsumer.set( world, blockPosition, turtleDropConsumer( turtleBlock, turtle ) );
|
DropConsumer.set( world, blockPosition, turtleDropConsumer( turtleBlock, turtle ) );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user