diff --git a/src/pocketmine/block/Fire.php b/src/pocketmine/block/Fire.php index 285631edf..933c2806a 100644 --- a/src/pocketmine/block/Fire.php +++ b/src/pocketmine/block/Fire.php @@ -21,6 +21,7 @@ namespace pocketmine\block; +use pocketmine\entity\Arrow; use pocketmine\entity\Effect; use pocketmine\entity\Entity; use pocketmine\event\entity\EntityCombustByBlockEvent; @@ -65,6 +66,9 @@ class Fire extends Flowable{ } $ev = new EntityCombustByBlockEvent($this, $entity, 8); + if($entity instanceof Arrow){ + $ev->setCancelled(); + } Server::getInstance()->getPluginManager()->callEvent($ev); if(!$ev->isCancelled()){ $entity->setOnFire($ev->getDuration()); @@ -88,9 +92,16 @@ class Fire extends Flowable{ return Level::BLOCK_UPDATE_NORMAL; }elseif($type === Level::BLOCK_UPDATE_RANDOM){ if($this->getSide(0)->getId() !== self::NETHERRACK){ - $this->getLevel()->setBlock($this, new Air(), true); + if(mt_rand(0, 2) === 0){ + if($this->meta === 0x0F){ + $this->level->setBlock($this, new Air()); + }else{ + $this->meta++; + $this->level->setBlock($this, $this); + } - return Level::BLOCK_UPDATE_NORMAL; + return Level::BLOCK_UPDATE_NORMAL; + } } } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index ebc5bfa36..bbc698f5d 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -33,6 +33,7 @@ use pocketmine\block\BrownMushroom; use pocketmine\block\Cactus; use pocketmine\block\Carrot; use pocketmine\block\Farmland; +use pocketmine\block\Fire; use pocketmine\block\Grass; use pocketmine\block\Ice; use pocketmine\block\Leaves; @@ -248,7 +249,7 @@ class Level implements ChunkManager, Metadatable{ Block::CARROT_BLOCK => Carrot::class, Block::POTATO_BLOCK => Potato::class, Block::LEAVES2 => Leaves2::class, - + Block::FIRE => Fire::class, Block::BEETROOT_BLOCK => Beetroot::class, ]; @@ -1467,7 +1468,7 @@ class Level implements ChunkManager, Metadatable{ * @param Player $player * @param bool $createParticles * - * @return boole + * @return bool */ public function useBreakOn(Vector3 $vector, Item &$item = null, Player $player = null, bool $createParticles = false) : bool{ $target = $this->getBlock($vector);