44    private const TAG_SHOWBASE = 
"ShowBottom"; 
 
   46    private const TAG_BLOCKTARGET_X = 
"BlockTargetX"; 
 
   47    private const TAG_BLOCKTARGET_Y = 
"BlockTargetY"; 
 
   48    private const TAG_BLOCKTARGET_Z = 
"BlockTargetZ"; 
 
   50    public function getNetworkTypeId() : 
string{ 
return EntityIds::ENDER_CRYSTAL; }
 
   52    protected bool $showBase = 
false;
 
   53    protected ?
Vector3 $beamTarget = 
null;
 
   55    private bool $primed = 
false;
 
   63    public function isFireProof() : bool{
 
   71    public function showBase() : bool{
 
   72        return $this->showBase;
 
   75    public function setShowBase(
bool $showBase) : void{
 
   76        $this->showBase = $showBase;
 
   77        $this->networkPropertiesDirty = 
true;
 
   80    public function getBeamTarget() : ?Vector3{
 
   81        return $this->beamTarget;
 
   84    public function setBeamTarget(?Vector3 $beamTarget) : void{
 
   85        $this->beamTarget = $beamTarget;
 
   86        $this->networkPropertiesDirty = 
true;
 
   89    public function attack(EntityDamageEvent $source) : void{
 
   90        parent::attack($source);
 
   92            $source->getCause() !== EntityDamageEvent::CAUSE_VOID &&
 
   93            !$source->isCancelled()
 
   99    protected function initEntity(CompoundTag $nbt) : void{
 
  100        parent::initEntity($nbt);
 
  102        $this->setMaxHealth(1);
 
  105        $this->setShowBase($nbt->getByte(self::TAG_SHOWBASE, 0) === 1);
 
  108            ($beamXTag = $nbt->getTag(self::TAG_BLOCKTARGET_X)) instanceof IntTag &&
 
  109            ($beamYTag = $nbt->getTag(self::TAG_BLOCKTARGET_Y)) instanceof IntTag &&
 
  110            ($beamZTag = $nbt->getTag(self::TAG_BLOCKTARGET_Z)) instanceof IntTag
 
  112            $this->setBeamTarget(
new Vector3($beamXTag->getValue(), $beamYTag->getValue(), $beamZTag->getValue()));
 
  116    public function saveNBT() : CompoundTag{
 
  117        $nbt = parent::saveNBT();
 
  119        $nbt->setByte(self::TAG_SHOWBASE, $this->showBase ? 1 : 0);
 
  120        if($this->beamTarget !== 
null){
 
  121            $nbt->setInt(self::TAG_BLOCKTARGET_X, $this->beamTarget->getFloorX());
 
  122            $nbt->setInt(self::TAG_BLOCKTARGET_Y, $this->beamTarget->getFloorY());
 
  123            $nbt->setInt(self::TAG_BLOCKTARGET_Z, $this->beamTarget->getFloorZ());
 
  135    public function explode() : void{
 
  136        $ev = new EntityPreExplodeEvent($this, 6);
 
  138        if(!$ev->isCancelled()){
 
  139            $explosion = new Explosion($this->getPosition(), $ev->getRadius(), $this, $ev->getFireChance());
 
  140            if($ev->isBlockBreaking()){
 
  141                $explosion->explodeA();
 
  143            $explosion->explodeB();
 
  147    protected function syncNetworkData(EntityMetadataCollection $properties) : void{
 
  148        parent::syncNetworkData($properties);
 
  150        $properties->setGenericFlag(EntityMetadataFlags::SHOWBASE, $this->showBase);
 
  151        $properties->setBlockPos(EntityMetadataProperties::BLOCK_TARGET, BlockPosition::fromVector3($this->beamTarget ?? Vector3::zero()));