grass will try spreading only once per tick

This commit is contained in:
GameHerobrine 2025-05-19 09:31:50 +03:00
parent 659aea440d
commit 992b6143cd

View file

@ -47,17 +47,17 @@ class GrassBlock extends SolidBlock{
if(!StaticBlock::getIsTransparent($level->level->getBlockID($x, $y + 1, $z)) && 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->level->getBlockID($x, $y + 1, $z);
if(StaticBlock::getIsTransparent($blockUp) && !StaticBlock::getIsLiquid($blockUp) && !($blockUp === 60) && $level->level->getBlockID($x, $y, $z) === DIRT){
$level->fastSetBlockUpdate($x, $y, $z, GRASS, 0);
}
//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->level->getBlockID($x, $y + 1, $z);
if(StaticBlock::getIsTransparent($blockUp) && !StaticBlock::getIsLiquid($blockUp) && !($blockUp == FARMLAND) && $level->level->getBlockID($x, $y, $z) === DIRT){
$level->fastSetBlockUpdate($x, $y, $z, GRASS, 0);
}
//}
}
}