PocketMine-MP 5.28.3 git-d5a1007c80fcee27feb2251cf5dcf1ad5a59a85c
Loading...
Searching...
No Matches
pocketmine\event\block\BlockPreExplodeEvent Class Reference
+ Inheritance diagram for pocketmine\event\block\BlockPreExplodeEvent:
+ Collaboration diagram for pocketmine\event\block\BlockPreExplodeEvent:

Public Member Functions

 __construct (Block $block, private float $radius, private readonly ?Player $player=null, private float $fireChance=0.0)
 
 call ()
 
 getBlock ()
 
 getEventName ()
 
 getFireChance ()
 
 getPlayer ()
 
 getRadius ()
 
 isBlockBreaking ()
 
 isCancelled ()
 
 isIncendiary ()
 
 setBlockBreaking (bool $affectsBlocks)
 
 setFireChance (float $fireChance)
 
 setIncendiary (bool $incendiary)
 
 setRadius (float $radius)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

string $eventName = null
 

Detailed Description

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.

See also
BlockExplodeEvent

Definition at line 39 of file BlockPreExplodeEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\block\BlockPreExplodeEvent::__construct ( Block $block,
private float $radius,
private readonly ?Player $player = null,
private float $fireChance = 0.0 )

Definition at line 44 of file BlockPreExplodeEvent.php.

Member Function Documentation

◆ call()

pocketmine\event\Event::call ( )
inherited

Calls event handlers registered for this event.

Exceptions

RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getBlock()

pocketmine\event\block\BlockEvent::getBlock ( )
inherited

Definition at line 37 of file BlockEvent.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getFireChance()

pocketmine\event\block\BlockPreExplodeEvent::getFireChance ( )

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

Definition at line 104 of file BlockPreExplodeEvent.php.

◆ getPlayer()

pocketmine\event\block\BlockPreExplodeEvent::getPlayer ( )

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

Definition at line 126 of file BlockPreExplodeEvent.php.

◆ getRadius()

pocketmine\event\block\BlockPreExplodeEvent::getRadius ( )

Definition at line 61 of file BlockPreExplodeEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )
staticinherited

Returns whether the current class context has any registered global handlers. This can be used in hot code paths to avoid unnecessary event object creation.

Usage: SomeEventClass::hasHandlers()

Definition at line 77 of file Event.php.

◆ isBlockBreaking()

pocketmine\event\block\BlockPreExplodeEvent::isBlockBreaking ( )

Definition at line 73 of file BlockPreExplodeEvent.php.

◆ isCancelled()

pocketmine\event\Cancellable::isCancelled ( )
inherited

Returns whether this instance of the event is currently cancelled.

If it is cancelled, only downstream handlers that declare @handleCancelled will be called with this event.

◆ isIncendiary()

pocketmine\event\block\BlockPreExplodeEvent::isIncendiary ( )

Returns whether the explosion will create a fire.

Definition at line 84 of file BlockPreExplodeEvent.php.

◆ setBlockBreaking()

pocketmine\event\block\BlockPreExplodeEvent::setBlockBreaking ( bool $affectsBlocks)

Definition at line 77 of file BlockPreExplodeEvent.php.

◆ setFireChance()

pocketmine\event\block\BlockPreExplodeEvent::setFireChance ( float $fireChance)

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.

Parameters
float$fireChance0 ... 1

Definition at line 114 of file BlockPreExplodeEvent.php.

◆ setIncendiary()

pocketmine\event\block\BlockPreExplodeEvent::setIncendiary ( bool $incendiary)

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).

Definition at line 93 of file BlockPreExplodeEvent.php.

◆ setRadius()

pocketmine\event\block\BlockPreExplodeEvent::setRadius ( float $radius)

Definition at line 65 of file BlockPreExplodeEvent.php.

Member Data Documentation

◆ $eventName

string pocketmine\event\Event::$eventName = null
protectedinherited

Definition at line 38 of file Event.php.


The documentation for this class was generated from the following file: