Skip to content

Beacon ​

final class · pocketmine\block\Beacon · source

Extends Transparent

Beacon. Built on a pyramid of iron, gold, emerald, diamond or netherite blocks (1-4 levels) with nothing opaque above it, it gives the selected powers to the players around it.

Behaviour (Minecraft Wiki "Beacon", Bedrock values; dragonfly and PowerNukkitX for the details):

  • every 80 ticks the pyramid and the sky access are checked and the powers are applied (scheduled block update, nothing runs on the other ticks);
  • range 10 + 10 * level blocks horizontally, from range blocks below the beacon up to the top of the world;
  • duration 10/12/14/16 seconds for levels 1-4 (Bedrock table of the wiki); effects are ambient (faint particles);
  • only players are affected;
  • the beam goes through any block that is not fully opaque (glass, leaves...) and through bedrock.

The powers are chosen in the beacon window (one payment item); see \pocketmine\inventory\transaction\BeaconPaymentTransaction.

Constants ​

MAX_PYRAMID_LEVEL 5.46.0 ​

php
public const MAX_PYRAMID_LEVEL = 4

UPDATE_INTERVAL_TICKS 5.46.0 ​

php
public const UPDATE_INTERVAL_TICKS = 80

Methods ​

applyEffects() 5.46.0 ​

php
public static function applyEffects(\pocketmine\entity\Living $entity, array $effects) : void

calculatePyramidLevel() 5.46.0 ​

php
public static function calculatePyramidLevel(\pocketmine\world\World $world, int $x, int $y, int $z) : int

Returns the number of complete pyramid layers (0-4) below a beacon at the given position: layer N is the (2N+1)x(2N+1) square N blocks below the beacon, and every layer above it must be complete. Block types may be mixed.

createEffects() 5.46.0 ​

php
public static function createEffects(int $pyramidLevel, ?\pocketmine\entity\effect\Effect $primary, ?\pocketmine\entity\effect\Effect $secondary) : array

Returns the effects given by a beacon with this pyramid and these powers. Powers that the pyramid is too small for are left out.

getEffectDuration() 5.46.0 ​

php
public static function getEffectDuration(int $pyramidLevel) : int

Duration of the powers in ticks: 10, 12, 14 and 16 seconds for levels 1-4 (Bedrock).

getEffectRange() 5.46.0 ​

php
public static function getEffectRange(int $pyramidLevel) : int

Horizontal range of the powers, in blocks from the beacon.

getLightLevel() ​

php
public function getLightLevel() : int

getPrimaryEffect() 5.46.0 ​

php
public function getPrimaryEffect() : ?\pocketmine\entity\effect\Effect

getPrimaryEffectRequiredLevel() 5.46.0 ​

php
public static function getPrimaryEffectRequiredLevel(\pocketmine\entity\effect\Effect $effect) : ?int

Pyramid level needed to choose this effect as primary power, or null if it can't be chosen.

getSecondaryEffect() 5.46.0 ​

php
public function getSecondaryEffect() : ?\pocketmine\entity\effect\Effect

hasSkyAccess() 5.46.0 ​

php
public function hasSkyAccess() : bool

Returns whether the beam reaches the sky: every block above the beacon must let it through.

isInEffectArea() 5.46.0 ​

php
public static function isInEffectArea(\pocketmine\math\Vector3 $beacon, int $pyramidLevel, \pocketmine\math\Vector3 $position, int $worldMaxY) : bool

The area covers the range around the beacon horizontally, and from range blocks below it to the top of the world.

isPaymentItem() 5.46.0 ​

php
public static function isPaymentItem(\pocketmine\item\Item $item) : bool

Items accepted as payment in the beacon window.

isPrimaryEffectAllowed() 5.46.0 ​

php
public static function isPrimaryEffectAllowed(\pocketmine\entity\effect\Effect $effect, int $pyramidLevel) : bool

isPyramidBlock() 5.46.0 ​

php
public static function isPyramidBlock(\pocketmine\block\Block $block) : bool

Blocks a beacon pyramid can be built with.

isValidSelection() 5.46.0 ​

php
public static function isValidSelection(?\pocketmine\entity\effect\Effect $primary, ?\pocketmine\entity\effect\Effect $secondary, int $pyramidLevel) : bool

Returns whether the powers can be chosen with a pyramid of the given level. A primary power is required; the secondary power needs a full pyramid (level 4) and is either regeneration or the primary power again (level II).

letsBeamThrough() 5.46.0 ​

php
public static function letsBeamThrough(\pocketmine\block\Block $block) : bool

The beam stops at fully opaque blocks, except bedrock (wiki); glass, leaves, slabs, water... let it through.

onInteract() 5.46.0 ​

php
public function onInteract(\pocketmine\item\Item $item, int $face, \pocketmine\math\Vector3 $clickVector, ?\pocketmine\player\Player $player = null, array &$returnedItems = []) : bool

onScheduledUpdate() 5.46.0 ​

php
public function onScheduledUpdate() : void

readStateFromWorld() 5.46.0 ​

php
public function readStateFromWorld() : \pocketmine\block\Block

setPrimaryEffect() 5.46.0 ​

php
public function setPrimaryEffect(?\pocketmine\entity\effect\Effect $primaryEffect) : self

setSecondaryEffect() 5.46.0 ​

php
public function setSecondaryEffect(?\pocketmine\entity\effect\Effect $secondaryEffect) : self

updateBeacon() 5.46.0 ​

php
public function updateBeacon(\pocketmine\block\tile\Beacon $tile) : void

Recomputes the pyramid level and the sky access, plays the beam sounds and gives the powers to the players in range. Called every 80 ticks.

writeStateToWorld() 5.46.0 ​

php
public function writeStateToWorld() : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.