Fix improper treatment of unbreakable blocks
This commit is contained in:
parent
dcad5fb79e
commit
99323463e3
@ -259,7 +259,11 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
return COST_INF;
|
||||
}
|
||||
double m = Blocks.CRAFTING_TABLE.equals(block) ? 10 : 1; // TODO see if this is still necessary. it's from MineBot when we wanted to penalize breaking its crafting table
|
||||
double result = m / context.getToolSet().getStrVsBlock(state);
|
||||
double strVsBlock = context.getToolSet().getStrVsBlock(state);
|
||||
if (strVsBlock < 0)
|
||||
return COST_INF;
|
||||
|
||||
double result = m / strVsBlock;
|
||||
if (includeFalling) {
|
||||
BlockPos up = position.up();
|
||||
IBlockState above = BlockStateInterface.get(up);
|
||||
|
@ -77,7 +77,7 @@ public class ToolSet implements Helper {
|
||||
|
||||
/**
|
||||
* Calculates how long would it take to mine the specified block given the best tool
|
||||
* in this toolset is used.
|
||||
* in this toolset is used. A negative value is returned if the specified block is unbreakable.
|
||||
*
|
||||
* @param state the blockstate to be mined
|
||||
* @return how long it would take in ticks
|
||||
@ -87,9 +87,8 @@ public class ToolSet implements Helper {
|
||||
ItemStack contents = player().inventory.getStackInSlot(slot);
|
||||
|
||||
float blockHard = state.getBlockHardness(null, null);
|
||||
if (blockHard < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (blockHard < 0)
|
||||
return -1;
|
||||
|
||||
float speed = contents.getDestroySpeed(state);
|
||||
if (speed > 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user