mirror of https://github.com/cabaletta/baritone
Fix NPE in break time calculation
This commit is contained in:
parent
62b2f81ba1
commit
4572b75db7
|
@ -177,7 +177,13 @@ public class ToolSet {
|
|||
* @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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue