Change block tool types to bitflags

This allows specification of multiple tool types for a block, such as cobwebs.
This commit is contained in:
Dylan K. Taylor
2017-12-11 12:16:37 +00:00
parent db31d13f96
commit 58327d0514
3 changed files with 9 additions and 19 deletions

View File

@ -224,12 +224,8 @@ class Block extends Position implements BlockIds, Metadatable{
if($this->canBeBrokenWith($item)){
if($this->getToolType() === BlockToolType::TYPE_SHEARS and $item->isShears()){
$base /= 15;
}elseif(
($this->getToolType() === BlockToolType::TYPE_PICKAXE and ($tier = $item->isPickaxe()) !== false) or
($this->getToolType() === BlockToolType::TYPE_AXE and ($tier = $item->isAxe()) !== false) or
($this->getToolType() === BlockToolType::TYPE_SHOVEL and ($tier = $item->isShovel()) !== false)
){
switch($tier){
}elseif($item instanceof TieredTool and ($this->getToolType() & $item->getBlockToolType()) !== 0){
switch($item->getTier()){
case TieredTool::TIER_WOODEN:
$base /= 2;
break;