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:
Dylan K. Taylor
2020-12-11 22:44:04 +00:00
6 changed files with 74 additions and 100 deletions

View File

@@ -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;
}

View File

@@ -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{

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::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;
}
}