BlockPreExplodeEvent
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()
public function __construct(\pocketmine\block\Block $block, float $radius, ?\pocketmine\player\Player $player = null, float $fireChance = 0.0)getFireChance()
public function getFireChance() : floatReturns a chance between 0 and 1 of creating a fire.
getPlayer()
public function getPlayer() : ?\pocketmine\player\PlayerReturns the player who triggered the block explosion. Returns null if the block was exploded by other means.
getRadius()
public function getRadius() : floatisBlockBreaking()
public function isBlockBreaking() : boolisIncendiary()
public function isIncendiary() : boolReturns whether the explosion will create a fire.
setBlockBreaking()
public function setBlockBreaking(bool $affectsBlocks) : voidsetFireChance()
public function setFireChance(float $fireChance) : voidSets 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()
public function setIncendiary(bool $incendiary) : voidSets 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()
public function setRadius(float $radius) : void