Rename and repurpose Block->diffusesSkyLight to blocksDirectSkyLight

this new form allows skipping some useless checks during sky light calculation and also allows getting rid of the last hard dependency on core Block classes.
We're getting real close to native light now.
This commit is contained in:
Dylan K. Taylor
2020-09-08 22:37:58 +01:00
parent 773069d1cc
commit c7070788f9
9 changed files with 51 additions and 25 deletions

View File

@ -292,14 +292,14 @@ class Block{
}
/**
* Returns whether this block will diffuse sky light passing through it vertically.
* Diffusion means that full-strength sky light passing through this block will not be reduced, but will start being filtered below the block.
* Examples of this behaviour include leaves and cobwebs.
* Returns whether this block blocks direct sky light from passing through it. This is independent from the light
* filter value, which is used during propagation.
*
* Light-diffusing blocks are included by the heightmap.
* In most cases, this is the same as isTransparent(); however, some special cases exist such as leaves and cobwebs,
* which don't have any additional effect on light propagation, but don't allow direct sky light to pass through.
*/
public function diffusesSkyLight() : bool{
return false;
public function blocksDirectSkyLight() : bool{
return $this->getLightFilter() > 0;
}
public function isTransparent() : bool{