mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
Improve documentation of ExplosionPrimeEvent and EntityExplodeEvent
This commit is contained in:
parent
afc6e8878d
commit
3dd7c09351
@ -31,7 +31,11 @@ use pocketmine\utils\Utils;
|
|||||||
use pocketmine\world\Position;
|
use pocketmine\world\Position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a entity explodes
|
* Called when an entity explodes, after the explosion's impact has been calculated.
|
||||||
|
* No changes have been made to the world at this stage.
|
||||||
|
*
|
||||||
|
* @see ExplosionPrimeEvent
|
||||||
|
*
|
||||||
* @phpstan-extends EntityEvent<Entity>
|
* @phpstan-extends EntityEvent<Entity>
|
||||||
*/
|
*/
|
||||||
class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
||||||
@ -47,7 +51,8 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
|||||||
protected $yield;
|
protected $yield;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Block[] $blocks
|
* @param Block[] $blocks
|
||||||
|
* @param float $yield 0-100
|
||||||
*/
|
*/
|
||||||
public function __construct(Entity $entity, Position $position, array $blocks, float $yield){
|
public function __construct(Entity $entity, Position $position, array $blocks, float $yield){
|
||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
@ -64,6 +69,8 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns a list of blocks destroyed by the explosion.
|
||||||
|
*
|
||||||
* @return Block[]
|
* @return Block[]
|
||||||
*/
|
*/
|
||||||
public function getBlockList() : array{
|
public function getBlockList() : array{
|
||||||
@ -71,6 +78,8 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the blocks destroyed by the explosion.
|
||||||
|
*
|
||||||
* @param Block[] $blocks
|
* @param Block[] $blocks
|
||||||
*/
|
*/
|
||||||
public function setBlockList(array $blocks) : void{
|
public function setBlockList(array $blocks) : void{
|
||||||
@ -78,10 +87,18 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
|||||||
$this->blocks = $blocks;
|
$this->blocks = $blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the percentage chance of drops from each block destroyed by the explosion.
|
||||||
|
* @return float 0-100
|
||||||
|
*/
|
||||||
public function getYield() : float{
|
public function getYield() : float{
|
||||||
return $this->yield;
|
return $this->yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the percentage chance of drops from each block destroyed by the explosion.
|
||||||
|
* @param float $yield 0-100
|
||||||
|
*/
|
||||||
public function setYield(float $yield) : void{
|
public function setYield(float $yield) : void{
|
||||||
if($yield < 0.0 || $yield > 100.0){
|
if($yield < 0.0 || $yield > 100.0){
|
||||||
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
|
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
|
||||||
|
@ -28,7 +28,11 @@ use pocketmine\event\Cancellable;
|
|||||||
use pocketmine\event\CancellableTrait;
|
use pocketmine\event\CancellableTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a entity decides to explode
|
* 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 EntityExplodeEvent
|
||||||
|
*
|
||||||
* @phpstan-extends EntityEvent<Entity>
|
* @phpstan-extends EntityEvent<Entity>
|
||||||
*/
|
*/
|
||||||
class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
|
class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user