Skip to content

Commit

Permalink
Merge pull request #4333 from ZacSharp/pr/1.19.4/misc/toolset/fixHard…
Browse files Browse the repository at this point in the history
…nessCrash

Fix NPE in break time calculation
  • Loading branch information
leijurv authored Apr 24, 2024
2 parents 62b2f81 + 4572b75 commit b31e0a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/baritone/utils/ToolSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ private double avoidanceMultiplier(Block b) {
* @return how long it would take in ticks
*/
public static double calculateSpeedVsBlock(ItemStack item, BlockState state) {
float hardness = state.getDestroySpeed(null, null);
float hardness;
try {
hardness = state.getDestroySpeed(null, null);
} catch (NullPointerException npe) {
// can't easily determine the hardness so treat it as unbreakable
return -1;
}
if (hardness < 0) {
return -1;
}
Expand Down

0 comments on commit b31e0a8

Please sign in to comment.