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

Public Member Functions

 setRandomAmount ($amount)
 
 setBaseAmount ($amount)
 
 populate (ChunkManager $level, $chunkX, $chunkZ, Random $random)
 
- Public Member Functions inherited from Populator
 populate (ChunkManager $level, $chunkX, $chunkZ, Random $random)
 

Member Function Documentation

◆ populate()

populate ( ChunkManager  $level,
  $chunkX,
  $chunkZ,
Random  $random 
)
Parameters
ChunkManager$level
$chunkX
$chunkZ
Random$random
Returns
mixed|void
56  {
57  $this->level = $level;
58  $amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
59  for($i = 0; $i < $amount; ++$i){
60  $x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
61  $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);
62 
63  $y = $this->getHighestWorkableBlock($x, $z);
64  $tallRand = $random->nextRange(0, 17);
65  $yMax = $y + 2 + (int) ($tallRand > 10) + (int) ($tallRand > 15);
66  if($y !== -1){
67  for(; $y < 127 and $y < $yMax; $y++){
68  if($this->canSugarcaneStay($x, $y, $z)){
69  $this->level->setBlockIdAt($x, $y, $z, Block::SUGARCANE_BLOCK);
70  $this->level->setBlockDataAt($x, $y, $z, 1);
71  }
72  }
73  }
74  }
75  }

◆ setBaseAmount()

setBaseAmount (   $amount)
Parameters
$amount
44  {
45  $this->baseAmount = $amount;
46  }

◆ setRandomAmount()

setRandomAmount (   $amount)
Parameters
$amount
37  {
38  $this->randomAmount = $amount;
39  }

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