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:
Dylan K. Taylor
2019-08-05 16:44:09 +01:00
parent cf271dab2b
commit 53ab860db5
75 changed files with 337 additions and 325 deletions

View File

@ -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());
}
}
}