1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-26 07:03:22 +00:00

Fix turtles harvesting blocks when they shouldn't (#276)

harvestBlock should only be called when removedByPlayer and canHarvestBlock
return true, otherwise we run the risk of causing dupe bugs.

See #273.
This commit is contained in:
powerboat9 2019-07-17 04:23:14 -04:00 committed by SquidDev
parent 6279816ecc
commit 303b57779a

View File

@ -246,7 +246,7 @@ private TurtleCommandResult dig( ITurtleAccess turtle, EnumFacing direction, Tur
boolean canHarvest = state.getBlock().canHarvestBlock( world, blockPosition, turtlePlayer );
boolean canBreak = state.getBlock().removedByPlayer( state, world, blockPosition, turtlePlayer, canHarvest );
if( canBreak ) state.getBlock().onPlayerDestroy( world, blockPosition, state );
if( canHarvest )
if( canHarvest && canBreak )
{
state.getBlock().harvestBlock( world, turtlePlayer, blockPosition, state, tile, turtlePlayer.getHeldItemMainhand() );
}