Remove Tool <-> Block circular dependency in efficiency calculation

This commit is contained in:
Dylan K. Taylor
2019-03-01 18:18:56 +00:00
parent 72233a509d
commit d961b272c7
4 changed files with 6 additions and 7 deletions

View File

@ -325,7 +325,7 @@ class Block extends Position implements BlockIds, Metadatable{
$base *= 5;
}
$efficiency = $item->getMiningEfficiency($this);
$efficiency = $item->getMiningEfficiency(($this->getToolType() & $item->getBlockToolType()) !== 0);
if($efficiency <= 0){
throw new \InvalidArgumentException(get_class($item) . " has invalid mining efficiency: expected >= 0, got $efficiency");
}