Skip to content

VibrationManager 5.46.0 ​

final class · pocketmine\world\vibration\VibrationManager · source

Delivers vibrations (game events) to the sculk sensors around them, and the other sculk game events: sensors setting off sculk shriekers, and mob deaths feeding sculk catalysts.

Sensors, shriekers and catalysts are found through a per-chunk index of their positions, so an event only looks at the blocks in the chunks within range: there is no scan of the world. A chunk is indexed the first time an event needs it (only subchunks whose palette contains one of these blocks are scanned) and then kept up to date by World::setBlockAt() until the chunk is unloaded or replaced.

Constants ​

CATALYST_RANGE ​

php
public const CATALYST_RANGE = 8

Range in which sculk catalysts react to mob deaths.

MAX_RANGE ​

php
public const MAX_RANGE = 16

Longest detection range of any sensor (calibrated sculk sensor).

SHRIEKER_RANGE ​

php
public const SHRIEKER_RANGE = 8

Range in which sculk shriekers hear sculk sensors (Java: tendrils clicking listener radius).

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\World $world)

absorbDeathExperience() ​

php
public function absorbDeathExperience(\pocketmine\entity\Living $entity, int $xp) : bool

Called when a mob dies: the closest sculk catalyst within 8 blocks absorbs the experience it would drop and spreads sculk with it. Returns whether the experience was absorbed (then none must be dropped).

addListener() ​

php
public function addListener(\pocketmine\world\vibration\VibrationListener $listener) : void

clearCatalystBloomEnd() ​

php
public function clearCatalystBloomEnd(int $x, int $y, int $z) : void

clearPendingVibration() ​

php
public function clearPendingVibration(int $x, int $y, int $z) : void

Forgets the vibration travelling to the sensor at the given position, if any.

clearSensorState() ​

php
public function clearSensorState(int $x, int $y, int $z) : void

clearShriekerState() ​

php
public function clearShriekerState(int $x, int $y, int $z) : void

emit() ​

php
public function emit(\pocketmine\math\Vector3 $pos, \pocketmine\world\vibration\GameEvent $event, ?\pocketmine\entity\Entity $source = null, ?\pocketmine\block\Block $affected = null) : void

Emits a vibration at the given position. Sensors in range which can hear it start listening to it; it arrives after one tick per block of distance.

getCatalystBloomEnd() ​

php
public function getCatalystBloomEnd(int $x, int $y, int $z, int $default) : int

Returns the tick at which the bloom of the catalyst ends; the default is recorded if none is known (catalyst reloaded while blooming).

getCatalystSpreader() ​

php
public function getCatalystSpreader(int $x, int $y, int $z) : \pocketmine\block\utils\SculkSpreader

Returns the sculk spread by the catalyst at the given position.

getListeners() ​

php
public function getListeners() : array

getPowerForDistance() ​

php
public static function getPowerForDistance(float $distance, int $range) : int

Redstone power output for a vibration detected at the given distance: 15 right next to the sensor, at least 1.

getResponsiblePlayer() ​

php
public static function getResponsiblePlayer(?\pocketmine\entity\Entity $entity) : ?\pocketmine\player\Player

Returns the player responsible for an entity's vibration (Java SculkShriekerBlockEntity.tryGetPlayer()): the player itself, the player riding the entity, the player who shot the projectile or dropped the item.

getSensorState() ​

php
public function getSensorState(int $x, int $y, int $z) : ?array

Returns the runtime state of an active or cooling down sensor: its redstone output, the frequency of the vibration it detected and the tick at which its current phase ends. Null if unknown (inactive sensor, or the chunk was reloaded).

getShriekerState() ​

php
public function getShriekerState(int $x, int $y, int $z) : ?array

Returns the state of a shrieking shrieker: the tick at which the shriek ends and the warning level it reached.

getStatistics() ​

php
public function getStatistics() : array

hasCatalystSpreader() ​

php
public function hasCatalystSpreader(int $x, int $y, int $z) : bool

isListening() ​

php
public function isListening(int $x, int $y, int $z) : bool

Returns whether a vibration is travelling to the sensor at the given position.

isOccluded() ​

php
public function isOccluded(int $fromX, int $fromY, int $fromZ, int $toX, int $toY, int $toZ) : bool

Returns whether wool lies on the straight line between the centres of the two blocks (the blocks themselves excluded).

notifyShriekers() ​

php
public function notifyShriekers(int $x, int $y, int $z, int $playerEntityId) : void

Sends the click of the sensor at the given position, caused by the given player, to the shriekers around.

onSensorActivated() ​

php
public function onSensorActivated(int $x, int $y, int $z, ?\pocketmine\entity\Entity $source) : void

Called when a sculk sensor becomes active (Java game event sculk_sensor_tendrils_clicking): the sculk shriekers within 8 blocks hear it, if a player caused the sensor's vibration. The click travels one block per tick and is blocked by wool.

removeCatalystSpreader() ​

php
public function removeCatalystSpreader(int $x, int $y, int $z) : void

removeListener() ​

php
public function removeListener(\pocketmine\world\vibration\VibrationListener $listener) : void

setCatalystBloomEnd() ​

php
public function setCatalystBloomEnd(int $x, int $y, int $z, int $tick) : void

setSensorState() ​

php
public function setSensorState(int $x, int $y, int $z, int $power, int $frequency, int $phaseEndTick) : void

setShriekerState() ​

php
public function setShriekerState(int $x, int $y, int $z, int $shriekEndTick, int $warningLevel) : void

takeArrivedShriek() ​

php
public function takeArrivedShriek(int $x, int $y, int $z) : ?\pocketmine\player\Player

Called by a shrieker from its scheduled update: returns the player whose sensor click reached it by now, if any.

takeArrivedVibration() ​

php
public function takeArrivedVibration(int $x, int $y, int $z) : ?array

Called by a sensor from its scheduled update: returns the vibration which reached it by now, if any.

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