Skip to content

BlockPreExplodeEvent ​

class · pocketmine\event\block\BlockPreExplodeEvent · source

Extends BlockEvent
Implements Cancellable

Called when a block wants to explode, before the explosion impact is calculated. This allows changing the explosion force, fire chance and whether it will destroy blocks.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\block\Block $block, float $radius, ?\pocketmine\player\Player $player = null, float $fireChance = 0.0)

getFireChance() ​

php
public function getFireChance() : float

Returns a chance between 0 and 1 of creating a fire.

getPlayer() ​

php
public function getPlayer() : ?\pocketmine\player\Player

Returns the player who triggered the block explosion. Returns null if the block was exploded by other means.

getRadius() ​

php
public function getRadius() : float

isBlockBreaking() ​

php
public function isBlockBreaking() : bool

isIncendiary() ​

php
public function isIncendiary() : bool

Returns whether the explosion will create a fire.

setBlockBreaking() ​

php
public function setBlockBreaking(bool $affectsBlocks) : void

setFireChance() ​

php
public function setFireChance(float $fireChance) : void

Sets a chance between 0 and 1 of creating a fire. For example, if the chance is 1/3, then that amount of affected blocks will be ignited.

setIncendiary() ​

php
public function setIncendiary(bool $incendiary) : void

Sets whether the explosion will create a fire by filling fireChance with default values.

If $incendiary is true, the fire chance will be filled only if explosion isn't currently creating a fire (if fire chance is 0).

setRadius() ​

php
public function setRadius(float $radius) : void

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