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

Public Member Functions

 __construct (Entity $entity, protected float $radius, private float $fireChance=0.0,)
 
 call ()
 
 getEntity ()
 
 getEventName ()
 
 getFireChance ()
 
 getRadius ()
 
 isBlockBreaking ()
 
 isCancelled ()
 
 isIncendiary ()
 
 setBlockBreaking (bool $affectsBlocks)
 
 setFireChance (float $fireChance)
 
 setIncendiary (bool $incendiary)
 
 setRadius (float $radius)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

Entity $entity
 
string $eventName = null
 

Detailed Description

Called when an entity decides to explode, before the explosion's impact is calculated. This allows changing the force of the explosion and whether it will destroy blocks.

See also
EntityExplodeEvent

@phpstan-extends EntityEvent<Entity>

Definition at line 40 of file EntityPreExplodeEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\entity\EntityPreExplodeEvent::__construct ( Entity $entity,
protected float $radius,
private float $fireChance = 0.0 )

Definition at line 45 of file EntityPreExplodeEvent.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.

◆ getEntity()

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getFireChance()

pocketmine\event\entity\EntityPreExplodeEvent::getFireChance ( )

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

Definition at line 94 of file EntityPreExplodeEvent.php.

◆ getRadius()

pocketmine\event\entity\EntityPreExplodeEvent::getRadius ( )

Definition at line 60 of file EntityPreExplodeEvent.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\entity\EntityPreExplodeEvent::isBlockBreaking ( )

Definition at line 112 of file EntityPreExplodeEvent.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\entity\EntityPreExplodeEvent::isIncendiary ( )

Returns whether the explosion will create a fire.

Definition at line 74 of file EntityPreExplodeEvent.php.

◆ setBlockBreaking()

pocketmine\event\entity\EntityPreExplodeEvent::setBlockBreaking ( bool $affectsBlocks)

Definition at line 116 of file EntityPreExplodeEvent.php.

◆ setFireChance()

pocketmine\event\entity\EntityPreExplodeEvent::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 104 of file EntityPreExplodeEvent.php.

◆ setIncendiary()

pocketmine\event\entity\EntityPreExplodeEvent::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 83 of file EntityPreExplodeEvent.php.

◆ setRadius()

pocketmine\event\entity\EntityPreExplodeEvent::setRadius ( float $radius)

Definition at line 64 of file EntityPreExplodeEvent.php.

Member Data Documentation

◆ $entity

◆ $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: