Refactored tool efficiency handling

This fixes lots of bugs with things like wool, cobwebs, swords.
This commit is contained in:
Dylan K. Taylor
2017-12-12 12:42:33 +00:00
parent 99fe63b2a3
commit b903161a5d
7 changed files with 61 additions and 25 deletions

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\BlockToolType;
class Sword extends TieredTool{
@ -42,4 +43,12 @@ class Sword extends TieredTool{
public function getBlockToolHarvestLevel() : int{
return 1;
}
public function getMiningEfficiency(Block $block) : float{
return parent::getMiningEfficiency($block) * 1.5; //swords break any block 1.5x faster than hand
}
protected function getBaseMiningEfficiency() : float{
return 10;
}
}