1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 00:32:18 +00:00

needs further testing, but presumably fixes #55

This commit is contained in:
Jacob Farley 2021-10-11 18:26:20 -05:00
parent 8985ea9560
commit ca40c9cf19

View File

@ -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 ) );