mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
using tab instead of 4 spaces(CONTRIBUTING.md)
This commit is contained in:
parent
f7b88ab7cc
commit
f1a91f28d0
2 changed files with 52 additions and 52 deletions
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
class TallGrassObject{
|
||||
|
||||
public static function growGrass(Level $level, Vector3 $pos, Random $random, $count = 15, $radius = 10){
|
||||
$arr = [
|
||||
BlockAPI::get(DANDELION, 0),
|
||||
BlockAPI::get(CYAN_FLOWER, 0),
|
||||
BlockAPI::get(TALL_GRASS, 1),
|
||||
BlockAPI::get(TALL_GRASS, 1),
|
||||
BlockAPI::get(TALL_GRASS, 2),
|
||||
BlockAPI::get(TALL_GRASS, 1)
|
||||
];
|
||||
$arrC = count($arr) - 1;
|
||||
for($c = 0; $c < $count; ++$c){
|
||||
$x = $random->nextRange($pos->x - $radius, $pos->x + $radius);
|
||||
$z = $random->nextRange($pos->z - $radius, $pos->z + $radius);
|
||||
for($y = $pos->y - 2; $y <= $pos->y + 2; ++$y){
|
||||
if($level->level->getBlockID($x, $y + 1, $z) === AIR and $level->level->getBlockID($x, $y, $z) === GRASS){
|
||||
$t = $arr[$random->nextRange(0, $arrC)];
|
||||
$level->setBlockRaw(new Vector3($x, $y + 1, $z), $t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static function growGrass(Level $level, Vector3 $pos, Random $random, $count = 15, $radius = 10){
|
||||
$arr = [
|
||||
BlockAPI::get(DANDELION, 0),
|
||||
BlockAPI::get(CYAN_FLOWER, 0),
|
||||
BlockAPI::get(TALL_GRASS, 1),
|
||||
BlockAPI::get(TALL_GRASS, 1),
|
||||
BlockAPI::get(TALL_GRASS, 2),
|
||||
BlockAPI::get(TALL_GRASS, 1)
|
||||
];
|
||||
$arrC = count($arr) - 1;
|
||||
for($c = 0; $c < $count; ++$c){
|
||||
$x = $random->nextRange($pos->x - $radius, $pos->x + $radius);
|
||||
$z = $random->nextRange($pos->z - $radius, $pos->z + $radius);
|
||||
for($y = $pos->y - 2; $y <= $pos->y + 2; ++$y){
|
||||
if($level->level->getBlockID($x, $y + 1, $z) === AIR and $level->level->getBlockID($x, $y, $z) === GRASS){
|
||||
$t = $arr[$random->nextRange(0, $arrC)];
|
||||
$level->setBlockRaw(new Vector3($x, $y + 1, $z), $t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue