ConcretePowder: call BlockFormEvent when coming in contact with water

This commit is contained in:
Dylan K. Taylor 2022-01-07 21:19:08 +00:00
parent c267e7b3c2
commit 4f4aa62479
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -27,6 +27,7 @@ use pocketmine\block\utils\ColorInMetadataTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\event\block\BlockFormEvent;
use pocketmine\math\Facing;
class ConcretePowder extends Opaque implements Fallable{
@ -42,7 +43,11 @@ class ConcretePowder extends Opaque implements Fallable{
public function onNearbyBlockChange() : void{
if(($block = $this->checkAdjacentWater()) !== null){
$this->position->getWorld()->setBlock($this->position, $block);
$ev = new BlockFormEvent($this, $block);
$ev->call();
if(!$ev->isCancelled()){
$this->position->getWorld()->setBlock($this->position, $ev->getNewState());
}
}else{
$this->startFalling();
}