From 2486dabd8a3c64891a7494a57b3c429848bd7269 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 6 Dec 2021 01:04:59 +0000 Subject: [PATCH] Fire: extract more unrelated changes from #4617 --- src/block/Fire.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/block/Fire.php b/src/block/Fire.php index 36b3403382..0e24103418 100644 --- a/src/block/Fire.php +++ b/src/block/Fire.php @@ -138,16 +138,7 @@ class Fire extends Flowable{ $this->position->getWorld()->scheduleDelayedBlockUpdate($this->position, mt_rand(30, 40)); if($canSpread){ - //TODO: raise upper bound for chance in humid biomes - - foreach($this->getHorizontalSides() as $side){ - $this->burnBlock($side, 300); - } - - //vanilla uses a 250 upper bound here, but I don't think they intended to increase the chance of incineration - $this->burnBlock($this->getSide(Facing::UP), 350); - $this->burnBlock($this->getSide(Facing::DOWN), 350); - + $this->burnBlocksAround(); //TODO: fire spread } } @@ -166,6 +157,18 @@ class Fire extends Flowable{ return false; } + private function burnBlocksAround() : void{ + //TODO: raise upper bound for chance in humid biomes + + foreach($this->getHorizontalSides() as $side){ + $this->burnBlock($side, 300); + } + + //vanilla uses a 250 upper bound here, but I don't think they intended to increase the chance of incineration + $this->burnBlock($this->getSide(Facing::UP), 350); + $this->burnBlock($this->getSide(Facing::DOWN), 350); + } + private function burnBlock(Block $block, int $chanceBound) : void{ if(mt_rand(0, $chanceBound) < $block->getFlammability()){ $ev = new BlockBurnEvent($block, $this);