mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 22:45:28 +00:00
Fire: extract more unrelated changes from #4617
This commit is contained in:
parent
4f3a60ac90
commit
2486dabd8a
@ -138,16 +138,7 @@ class Fire extends Flowable{
|
|||||||
$this->position->getWorld()->scheduleDelayedBlockUpdate($this->position, mt_rand(30, 40));
|
$this->position->getWorld()->scheduleDelayedBlockUpdate($this->position, mt_rand(30, 40));
|
||||||
|
|
||||||
if($canSpread){
|
if($canSpread){
|
||||||
//TODO: raise upper bound for chance in humid biomes
|
$this->burnBlocksAround();
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
//TODO: fire spread
|
//TODO: fire spread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,6 +157,18 @@ class Fire extends Flowable{
|
|||||||
return false;
|
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{
|
private function burnBlock(Block $block, int $chanceBound) : void{
|
||||||
if(mt_rand(0, $chanceBound) < $block->getFlammability()){
|
if(mt_rand(0, $chanceBound) < $block->getFlammability()){
|
||||||
$ev = new BlockBurnEvent($block, $this);
|
$ev = new BlockBurnEvent($block, $this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user