Cactus: do not update if only age changed

I'd prefer a smarter solution for this that automatically disables updates depending on which type of property was changed, but for now, this will significantly improve the performance of cactus farms.
The newly placed cactus block at the top cannot have updates disabled, though, since it needs to check its surroundings in case it grew into a space with a solid block next to it.

Thanks @KingOfTurkey38 for bringing this to light.
This commit is contained in:
Dylan K. Taylor 2023-10-13 12:45:11 +01:00
parent 2d697c5f04
commit 7d200247f8
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -117,10 +117,10 @@ class Cactus extends Transparent{
}
}
$this->age = 0;
$world->setBlock($this->position, $this);
$world->setBlock($this->position, $this, update: false);
}else{
++$this->age;
$world->setBlock($this->position, $this);
$world->setBlock($this->position, $this, update: false);
}
}
}