68 if($item->getTypeId() ===
ItemTypeIds::fromBlockTypeId(
BlockTypeIds::GLOWSTONE) && $this->charges < self::MAX_CHARGES){
69 $this->position->getWorld()->setBlock($this->position, $this->setCharges($this->charges + 1));
74 if($this->charges > self::MIN_CHARGES){
79 $ev =
new PlayerRespawnAnchorUseEvent($player, $this, PlayerRespawnAnchorUseEvent::ACTION_EXPLODE);
81 if($ev->isCancelled()){
85 switch($ev->getAction()){
86 case PlayerRespawnAnchorUseEvent::ACTION_EXPLODE:
87 $this->explode($player);
90 case PlayerRespawnAnchorUseEvent::ACTION_SET_SPAWN:
91 if($player->getSpawn() !==
null && $player->getSpawn()->equals($this->position)){
95 $player->setSpawn($this->position);
96 $this->position->getWorld()->addSound($this->position,
new RespawnAnchorSetSpawnSound());
97 $player->sendMessage(KnownTranslationFactory::tile_respawn_anchor_respawnSet()->prefix(TextFormat::GRAY));
115 $explosion =
new Explosion(Position::fromObject($this->position->add(0.5, 0.5, 0.5), $this->position->getWorld()), $ev->getRadius(), $this);