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

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorBlockMetaHelper;
use pocketmine\item\Item;
class Wool extends Solid{
@ -45,4 +46,12 @@ class Wool extends Solid{
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Wool";
}
public function getBreakTime(Item $item) : float{
$time = parent::getBreakTime($item);
if($item->getBlockToolType() === BlockToolType::TYPE_SHEARS){
$time *= 3; //shears break compatible blocks 15x faster, but wool 5x
}
return $time;
}
}