mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Water bottles extinguish fires when hitting a block
This commit is contained in:
parent
2e9bf7e93b
commit
a9957c3db3
@ -23,9 +23,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\entity\projectile;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\entity\EffectInstance;
|
||||
use pocketmine\entity\Living;
|
||||
use pocketmine\event\entity\ProjectileHitEntityEvent;
|
||||
use pocketmine\event\entity\ProjectileHitBlockEvent;
|
||||
use pocketmine\event\entity\ProjectileHitEvent;
|
||||
use pocketmine\item\Potion;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
@ -109,6 +112,17 @@ class SplashPotion extends Throwable{
|
||||
}else{
|
||||
//TODO: lingering potions
|
||||
}
|
||||
}elseif($event instanceof ProjectileHitBlockEvent and $this->getPotionId() === Potion::WATER){
|
||||
$blockIn = $event->getBlockHit()->getSide($event->getRayTraceResult()->getHitFace());
|
||||
|
||||
if($blockIn->getId() === Block::FIRE){
|
||||
$this->level->setBlock($blockIn, BlockFactory::get(Block::AIR));
|
||||
}
|
||||
foreach($blockIn->getHorizontalSides() as $horizontalSide){
|
||||
if($horizontalSide->getId() === Block::FIRE){
|
||||
$this->level->setBlock($horizontalSide, BlockFactory::get(Block::AIR));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->flagForDespawn();
|
||||
|
Loading…
x
Reference in New Issue
Block a user