Consistently declare BlockBreakInfo at the constructor call site

instead of inside the class
This commit is contained in:
Dylan K. Taylor
2021-05-20 22:49:51 +01:00
parent 8b4aa36e16
commit 376d2c4cd4
121 changed files with 267 additions and 657 deletions

View File

@ -29,7 +29,6 @@ use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\item\Item;
use pocketmine\item\ToolTier;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
@ -43,10 +42,6 @@ class Anvil extends Transparent implements Fallable{
/** @var int */
private $damage = 0;
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 6000.0));
}
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->damage << 2);
}