mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
first shot making Block not extend Position
this makes some stuff a lot less pretty, but this seems to be the bare minimum necessary to do this task. It can be enhanced later.
This commit is contained in:
@ -88,9 +88,9 @@ class Fire extends Flowable{
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
if(!$this->getSide(Facing::DOWN)->isSolid() and !$this->hasAdjacentFlammableBlocks()){
|
||||
$this->getWorld()->setBlock($this, VanillaBlocks::AIR());
|
||||
$this->pos->getWorld()->setBlock($this->pos, VanillaBlocks::AIR());
|
||||
}else{
|
||||
$this->world->scheduleDelayedBlockUpdate($this, mt_rand(30, 40));
|
||||
$this->pos->getWorld()->scheduleDelayedBlockUpdate($this->pos, mt_rand(30, 40));
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,10 +124,10 @@ class Fire extends Flowable{
|
||||
}
|
||||
|
||||
if($result !== null){
|
||||
$this->world->setBlock($this, $result);
|
||||
$this->pos->getWorld()->setBlock($this->pos, $result);
|
||||
}
|
||||
|
||||
$this->world->scheduleDelayedBlockUpdate($this, mt_rand(30, 40));
|
||||
$this->pos->getWorld()->scheduleDelayedBlockUpdate($this->pos, mt_rand(30, 40));
|
||||
|
||||
if($canSpread){
|
||||
//TODO: raise upper bound for chance in humid biomes
|
||||
@ -168,9 +168,9 @@ class Fire extends Flowable{
|
||||
if(mt_rand(0, $this->age + 9) < 5){ //TODO: check rain
|
||||
$fire = clone $this;
|
||||
$fire->age = min(15, $fire->age + (mt_rand(0, 4) >> 2));
|
||||
$this->world->setBlock($block, $fire);
|
||||
$this->pos->getWorld()->setBlock($block->pos, $fire);
|
||||
}else{
|
||||
$this->world->setBlock($block, VanillaBlocks::AIR());
|
||||
$this->pos->getWorld()->setBlock($block->pos, VanillaBlocks::AIR());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user