Fix that a hoe gets damage applied to it, when it's used to break a block (#3967)

closes #3965
This commit is contained in:
Mohamed
2020-12-11 22:14:52 +01:00
committed by GitHub
parent 68887105b2
commit 1c43538238
3 changed files with 18 additions and 0 deletions

View File

@ -23,11 +23,24 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\BlockToolType;
use pocketmine\entity\Entity;
class Hoe extends TieredTool{
public function getBlockToolType() : int{
return BlockToolType::TYPE_HOE;
}
public function onAttackEntity(Entity $victim) : bool{
return $this->applyDamage(1);
}
public function onDestroyBlock(Block $block) : bool{
if($block->getHardness() > 0){
return $this->applyDamage(1);
}
return false;
}
}