mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 17:06:16 +00:00
Call BlockMeltEvent when frosted ice melts
This commit is contained in:
@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\block;
|
namespace pocketmine\block;
|
||||||
|
|
||||||
use pocketmine\block\utils\BlockDataSerializer;
|
use pocketmine\block\utils\BlockDataSerializer;
|
||||||
|
use pocketmine\event\block\BlockMeltEvent;
|
||||||
use function mt_rand;
|
use function mt_rand;
|
||||||
|
|
||||||
class FrostedIce extends Ice{
|
class FrostedIce extends Ice{
|
||||||
@ -105,7 +106,11 @@ class FrostedIce extends Ice{
|
|||||||
*/
|
*/
|
||||||
private function tryMelt() : bool{
|
private function tryMelt() : bool{
|
||||||
if($this->age >= 3){
|
if($this->age >= 3){
|
||||||
$this->position->getWorld()->useBreakOn($this->position);
|
$ev = new BlockMeltEvent($this, VanillaBlocks::WATER());
|
||||||
|
$ev->call();
|
||||||
|
if(!$ev->isCancelled()){
|
||||||
|
$this->position->getWorld()->setBlock($this->position, $ev->getNewState());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user