VibrationManager 5.46.0
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
public const CATALYST_RANGE = 8Range in which sculk catalysts react to mob deaths.
MAX_RANGE
public const MAX_RANGE = 16Longest detection range of any sensor (calibrated sculk sensor).
SHRIEKER_RANGE
public const SHRIEKER_RANGE = 8Range in which sculk shriekers hear sculk sensors (Java: tendrils clicking listener radius).
Methods
__construct()
public function __construct(\pocketmine\world\World $world)absorbDeathExperience()
public function absorbDeathExperience(\pocketmine\entity\Living $entity, int $xp) : boolCalled 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()
public function addListener(\pocketmine\world\vibration\VibrationListener $listener) : voidclearCatalystBloomEnd()
public function clearCatalystBloomEnd(int $x, int $y, int $z) : voidclearPendingVibration()
public function clearPendingVibration(int $x, int $y, int $z) : voidForgets the vibration travelling to the sensor at the given position, if any.
clearSensorState()
public function clearSensorState(int $x, int $y, int $z) : voidclearShriekerState()
public function clearShriekerState(int $x, int $y, int $z) : voidemit()
public function emit(\pocketmine\math\Vector3 $pos, \pocketmine\world\vibration\GameEvent $event, ?\pocketmine\entity\Entity $source = null, ?\pocketmine\block\Block $affected = null) : voidEmits 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()
public function getCatalystBloomEnd(int $x, int $y, int $z, int $default) : intReturns the tick at which the bloom of the catalyst ends; the default is recorded if none is known (catalyst reloaded while blooming).
getCatalystSpreader()
public function getCatalystSpreader(int $x, int $y, int $z) : \pocketmine\block\utils\SculkSpreaderReturns the sculk spread by the catalyst at the given position.
getListeners()
public function getListeners() : arraygetPowerForDistance()
public static function getPowerForDistance(float $distance, int $range) : intRedstone power output for a vibration detected at the given distance: 15 right next to the sensor, at least 1.
getResponsiblePlayer()
public static function getResponsiblePlayer(?\pocketmine\entity\Entity $entity) : ?\pocketmine\player\PlayerReturns 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()
public function getSensorState(int $x, int $y, int $z) : ?arrayReturns 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()
public function getShriekerState(int $x, int $y, int $z) : ?arrayReturns the state of a shrieking shrieker: the tick at which the shriek ends and the warning level it reached.
getStatistics()
public function getStatistics() : arrayhasCatalystSpreader()
public function hasCatalystSpreader(int $x, int $y, int $z) : boolisListening()
public function isListening(int $x, int $y, int $z) : boolReturns whether a vibration is travelling to the sensor at the given position.
isOccluded()
public function isOccluded(int $fromX, int $fromY, int $fromZ, int $toX, int $toY, int $toZ) : boolReturns whether wool lies on the straight line between the centres of the two blocks (the blocks themselves excluded).
notifyShriekers()
public function notifyShriekers(int $x, int $y, int $z, int $playerEntityId) : voidSends the click of the sensor at the given position, caused by the given player, to the shriekers around.
onSensorActivated()
public function onSensorActivated(int $x, int $y, int $z, ?\pocketmine\entity\Entity $source) : voidCalled 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()
public function removeCatalystSpreader(int $x, int $y, int $z) : voidremoveListener()
public function removeListener(\pocketmine\world\vibration\VibrationListener $listener) : voidsetCatalystBloomEnd()
public function setCatalystBloomEnd(int $x, int $y, int $z, int $tick) : voidsetSensorState()
public function setSensorState(int $x, int $y, int $z, int $power, int $frequency, int $phaseEndTick) : voidsetShriekerState()
public function setShriekerState(int $x, int $y, int $z, int $shriekEndTick, int $warningLevel) : voidtakeArrivedShriek()
public function takeArrivedShriek(int $x, int $y, int $z) : ?\pocketmine\player\PlayerCalled by a shrieker from its scheduled update: returns the player whose sensor click reached it by now, if any.
takeArrivedVibration()
public function takeArrivedVibration(int $x, int $y, int $z) : ?arrayCalled by a sensor from its scheduled update: returns the vibration which reached it by now, if any.
