mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 04:15:04 +00:00
Merge branch 'stable'
# Conflicts: # .travis.yml # resources/vanilla # src/block/BlockToolType.php # src/network/mcpe/protocol/types/entity/MetadataProperty.php # tests/travis/setup-php.yml
This commit is contained in:
@@ -39,5 +39,6 @@ final class BlockToolType{
|
||||
public const PICKAXE = 1 << 2;
|
||||
public const AXE = 1 << 3;
|
||||
public const SHEARS = 1 << 4;
|
||||
public const HOE = 1 << 5;
|
||||
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ class Sponge extends Opaque{
|
||||
protected $wet = false;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6));
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::HOE));
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
|
@@ -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::HOE;
|
||||
}
|
||||
|
||||
public function onAttackEntity(Entity $victim) : bool{
|
||||
return $this->applyDamage(1);
|
||||
}
|
||||
|
||||
public function onDestroyBlock(Block $block) : bool{
|
||||
if(!$block->getBreakInfo()->breaksInstantly()){
|
||||
return $this->applyDamage(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user