Skip to content

Commit

Permalink
Call getDigSpeed with the real state of the block, however base the f…
Browse files Browse the repository at this point in the history
…inal value off getStrVsBlock of the tool and acting state.
  • Loading branch information
AlgorithmX2 committed Jul 21, 2018
1 parent 1d6b8db commit b2f12ba
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -1146,13 +1146,18 @@ public float getPlayerRelativeBlockHardness(
return 0.0F;
}

// since we can't call getDigSpeed on the acting state, we can just
// do some math to try and roughly estimate it.
float denom = player.inventory.getStrVsBlock( passedState );
float numer = player.inventory.getStrVsBlock( state );

if ( !state.getBlock().canHarvestBlock( new HarvestWorld( state ), pos, player ) )
{
return player.getDigSpeed( state, pos ) / hardness / 100F;
return player.getDigSpeed( passedState, pos ) / hardness / 100F * ( numer / denom );
}
else
{
return player.getDigSpeed( state, pos ) / hardness / 30F;
return player.getDigSpeed( passedState, pos ) / hardness / 30F * ( numer / denom );
}
}

Expand Down

0 comments on commit b2f12ba

Please sign in to comment.