mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Reduce code duplication between BaseCoral and CoralBlock
This commit is contained in:
@ -24,34 +24,17 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\CoralType;
|
||||
use pocketmine\block\utils\CoralTypeTrait;
|
||||
use pocketmine\item\Item;
|
||||
|
||||
abstract class BaseCoral extends Transparent{
|
||||
|
||||
protected CoralType $coralType;
|
||||
protected bool $dead = false;
|
||||
use CoralTypeTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
|
||||
parent::__construct($idInfo, $name, $breakInfo);
|
||||
$this->coralType = CoralType::TUBE();
|
||||
}
|
||||
|
||||
public function getCoralType() : CoralType{ return $this->coralType; }
|
||||
|
||||
/** @return $this */
|
||||
public function setCoralType(CoralType $coralType) : self{
|
||||
$this->coralType = $coralType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isDead() : bool{ return $this->dead; }
|
||||
|
||||
/** @return $this */
|
||||
public function setDead(bool $dead) : self{
|
||||
$this->dead = $dead;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
if(!$this->dead){
|
||||
$world = $this->position->getWorld();
|
||||
|
Reference in New Issue
Block a user