mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Added StructureGrowEvent (#4354)
This event is currently fired for tree and bamboo growth. Its intended use is for any plant growth that affects multiple blocks at once. TODO: We could explore using this for cacti and sugarcane?
This commit is contained in:
29
src/event/block/StructureGrowEvent.php
Normal file
29
src/event/block/StructureGrowEvent.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\block;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\world\BlockTransaction;
|
||||
|
||||
/**
|
||||
* Called when structures such as Saplings or Bamboo grow.
|
||||
* These types of plants tend to change multiple blocks at once upon growing.
|
||||
*/
|
||||
class StructureGrowEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
private BlockTransaction $transaction;
|
||||
|
||||
public function __construct(Block $block, BlockTransaction $transaction){
|
||||
parent::__construct($block);
|
||||
$this->transaction = $transaction;
|
||||
}
|
||||
|
||||
public function getTransaction() : BlockTransaction{
|
||||
return $this->transaction;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user