fixed cactuses not getting dropped when the grow

This commit is contained in:
GameHerobrine 2024-04-27 00:06:11 +03:00
parent c07c5e5abd
commit e30586fff2
2 changed files with 3 additions and 2 deletions

View file

@ -217,7 +217,7 @@ abstract class Block extends Position{
public static function onRandomTick(Level $level, $x, $y, $z){} public static function onRandomTick(Level $level, $x, $y, $z){}
public static function fallOn(Level $level, $x, $y, $z, Entity $entity, $fallDistance){} public static function fallOn(Level $level, $x, $y, $z, Entity $entity, $fallDistance){}
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){
return [new AxisAlignedBB($x, $y, $z, $x, $y, $z)]; return [static::getAABB($level, $x, $y, $z)];
} }
public static function onEntityCollidedWithBlock(Level $level, $x, $y, $z, Entity $entity){} public static function onEntityCollidedWithBlock(Level $level, $x, $y, $z, Entity $entity){}

View file

@ -22,7 +22,8 @@ class CactusBlock extends TransparentBlock{
for($yy = 1; $yy < 3; ++$yy){ for($yy = 1; $yy < 3; ++$yy){
$bID = $level->level->getBlockID($x, $y + $yy, $z); $bID = $level->level->getBlockID($x, $y + $yy, $z);
if($bID === AIR){ if($bID === AIR){
$level->setBlock(new Position($x, $y + $yy, $z, $level), new CactusBlock(), true, false, true); $level->fastSetBlockUpdate($x, $y + $yy, $z, CACTUS, 0);
$level->getBlockWithoutVector($x, $y + $yy, $z)->onUpdate(BLOCK_UPDATE_NORMAL); //TODO rewrite ticking
break; break;
} }
} }