decreased block updates per chunk from 80 to 20, PMFLevel block methods should be a bit faster now, grass spread rework, leaf decay fix

This commit is contained in:
GameHerobrine 2023-06-23 20:52:50 +03:00
parent 3dd9e38a37
commit 4544b7bb63
9 changed files with 73 additions and 60 deletions

View file

@ -49,6 +49,18 @@ class GrassBlock extends SolidBlock{
public static function onRandomTick(Level $level, $x, $y, $z){
if(!$level->getBlockWithoutVector($x, $y + 1, $z, false)->isTransparent && mt_rand(0, 2) == 1){
$level->fastSetBlockUpdate($x, $y, $z, DIRT, 0);
}else{
for($cnt = 0; $cnt < 4; ++$cnt){
$x = $x + mt_rand(0, 2) - 1;
$y = $y + mt_rand(0, 4) - 3;
$z = $z + mt_rand(0, 2) - 1;
$blockUp = $level->getBlockWithoutVector($x, $y + 1, $z, false);
if($blockUp->isTransparent && !$blockUp->isLiquid && !($blockUp->getID() === 60) && $level->level->getBlockID($x, $y, $z) === DIRT){
$level->fastSetBlockUpdate($x, $y, $z, GRASS, 0);
}
}
}
}