GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
TallGrass Class Reference

Static Public Member Functions

static growGrass (ChunkManager $level, Vector3 $pos, Random $random, $count=15, $radius=10)
 

Member Function Documentation

◆ growGrass()

static growGrass ( ChunkManager  $level,
Vector3  $pos,
Random  $random,
  $count = 15,
  $radius = 10 
)
static
Parameters
ChunkManager$level
Vector3$pos
Random$random
int$count
int$radius
37  {
38  $arr = [
39  [Block::DANDELION, 0],
40  [Block::POPPY, 0],
41  [Block::TALL_GRASS, 1],
42  [Block::TALL_GRASS, 1],
43  [Block::TALL_GRASS, 1],
45  ];
46  $arrC = count($arr) - 1;
47  for($c = 0; $c < $count; ++$c){
48  $x = $random->nextRange($pos->x - $radius, $pos->x + $radius);
49  $z = $random->nextRange($pos->z - $radius, $pos->z + $radius);
50  if($level->getBlockIdAt($x, $pos->y + 1, $z) === Block::AIR and $level->getBlockIdAt($x, $pos->y, $z) === Block::GRASS){
51  $t = $arr[$random->nextRange(0, $arrC)];
52  $level->setBlockIdAt($x, $pos->y + 1, $z, $t[0]);
53  $level->setBlockDataAt($x, $pos->y + 1, $z, $t[1]);
54  }
55  }
56  }

The documentation for this class was generated from the following file: