Documented EVERY SINGLE FUNCTIONS...

This commit is contained in:
Adsooi 2017-05-14 21:03:47 +02:00
parent 920fd82b6e
commit 1f6416d02e
34 changed files with 688 additions and 467 deletions

View file

@ -46,18 +46,22 @@ class Main extends PluginBase implements Listener {
const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f ";
const SAKURA_FOREST = 100; // Letting some place for future biomes.
/*
* Called when the plugin enables
/**
* Regisetrs a biome to betternormal
*
* @param int $id
* @param Biome $biome
* @return void
*/
public static function registerBiome(int $id, Biome $biome) {
BetterNormal::registerBiome($biome);
}
/*
* Called when the plugin disables
/**
* Called when the plugin enales
*
* @return void
*/
public function onEnable() {
$this->getServer()->getPluginManager()->registerEvents($this, $this);
Generator::addGenerator(BetterNormal::class, "betternormal");
@ -67,15 +71,12 @@ class Main extends PluginBase implements Listener {
file_put_contents(LootTable::getPluginFolder() . "processingLoots.json", "{}");
}
/*
* Called when one of the defined commands of the plugin has been called
* @param $sender \pocketmine\command\CommandSender
* @param $cmd \pocketmine\command\Command
* @param $label mixed
* @param $args array
* return bool
/**
* Checks for tesseract like namespaces. Returns true if thats the case
*
* @return boolean
*/
public static function isOtherNS() {
try {
return @class_exists("pocketmine\\level\\generator\\normal\\object\\OakTree");
@ -84,24 +85,15 @@ class Main extends PluginBase implements Listener {
}
}
/*
* Registers a forest type.
* @param $name string
* @param $treeClass string
* @params $infos Array(temperature, rainfall)
/**
* Called when a command executes
*
* @param CommandSender $sender
* @param Command $cmd
* @param int $label
* @param array $args
* @return bool
*/
public function onDisable() {
}
/*
* Registers a biome for the normal generator. Normal means(Biome::register) doesn't allow biome to be generated
* @param $id int
* @param $biome Biome
* @return void
*/
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args): bool {
switch ($cmd->getName()) {
case "createworld": // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
@ -208,23 +200,22 @@ class Main extends PluginBase implements Listener {
return false;
}
/*
* Generates a(semi) random seed.
/**
* Generates a (semi) random seed.
* @return int
*/
public function generateRandomSeed(): int {
return (int)round(rand(0, round(time()) / memory_get_usage(true)) * (int)str_shuffle("127469453645108") / (int)str_shuffle("12746945364"));
}
// Listener
/*
* Checks after a chunk populates so we an add tiles and loot tables
* @param $event pocketmine\event\level\ChunkPopulateEvent
* @return int
/**
* Registers a forest from a tree class
*
* @param string $name
* @param string $treeClass
* @param array $infos
* @return bool
*/
public function registerForest(string $name, string $treeClass, array $infos): bool {
if (!@class_exists($treeClass))
return false;
@ -236,10 +227,12 @@ class Main extends PluginBase implements Listener {
}
/*
* Checks when a player interacts with a loot chest to create it.
/**
* Checks when a chunk populates to populate chests back
*
* @param ChunkPopulateEvent $event
* @return void
*/
public function onChunkPopulate(ChunkPopulateEvent $event) {
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
foreach ($cfg->getAll() as $key => $value) {
@ -254,10 +247,12 @@ class Main extends PluginBase implements Listener {
}
/*
* Checks when a player breaks a loot chest which is not created to create it
/**
* Checks when a player touches an ungenerated chest to generate it.
*
* @param PlayerInteractEvent $event
* @return void
*/
public function onInteract(PlayerInteractEvent $event) {
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
if ($event->getBlock()->getId() !== Block::CHEST) return;
@ -275,11 +270,12 @@ class Main extends PluginBase implements Listener {
LootTable::fillChest($chest->getInventory(), $event->getBlock());
}
/*
* Check if it's a Tesseract like namespace
* @return bool
*/
/**
* Checks when a players breaks an ungenerated chest to generate it.
*
* @param BlockBreakEvent $event
* @return void
*/
public function onBlockBreak(BlockBreakEvent $event) {
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
if ($event->getBlock()->getId() !== Block::CHEST) return;
@ -295,6 +291,5 @@ class Main extends PluginBase implements Listener {
$chest = Tile::createTile(Tile::CHEST, $event->getBlock()->getLevel(), $nbt);
$chest->setName("§k(Fake)§r Minecart chest");
LootTable::fillChest($chest->getInventory(), $event->getBlock());
// $event->setCancelled(); //i think nope. You want to break it with items
}
}

View file

@ -27,6 +27,10 @@ use pocketmine\level\generator\biome\Biome;
use pocketmine\level\generator\normal\biome\SandyBiome;
class BetterDesert extends SandyBiome implements Mountainable {
/**
* Constructs the class
*/
public function __construct() {
parent::__construct();
$deadBush = new DeadbushPopulator ();
@ -76,14 +80,22 @@ class BetterDesert extends SandyBiome implements Mountainable {
Block::get(Block::SANDSTONE, 0)
]);
}
/**
* Constructs the class
*
* @return string
*/
public function getName(): string {
return "BetterDesert";
}
/*
/**
* Returns biome id
*
* @return int
*/
public function getId() {
public function getId(): int {
return Biome::DESERT;
}
}

View file

@ -28,16 +28,25 @@ use pocketmine\level\generator\normal\biome\ForestBiome;
class BetterForest extends ForestBiome implements Mountainable {
/** @var string[] **/
static $types = [
"Oak Forest",
"Birch Forest",
"Sakura Forest"
];
/** @var int[] **/
static $ids = [
Biome::FOREST,
Biome::BIRCH_FOREST,
Main::SAKURA_FOREST
];
/**
* Constructs the class
*
* @param int $type = 0
* @param array $infos
*/
public function __construct($type = 0, array $infos = [0.6, 0.5]) {
parent::__construct($type);
$this->clearPopulators ();
@ -73,12 +82,15 @@ class BetterForest extends ForestBiome implements Mountainable {
/**
* Returns the ID relatively.
*
* @return int
*/
public function getId() {
return self::$ids[$this->type];
}
/**
* Registers a forest
*
* @param string $name
* @param string $treeClass
* @param array $infos

View file

@ -25,6 +25,10 @@ use pocketmine\level\generator\biome\Biome;
use pocketmine\level\generator\normal\biome\SnowyBiome;
class BetterIcePlains extends SnowyBiome implements Mountainable {
/**
* Constructs the class
*/
public function __construct() {
parent::__construct ();
$this->setGroundCover([
@ -46,15 +50,22 @@ class BetterIcePlains extends SnowyBiome implements Mountainable {
$this->temperature = 0.05;
$this->rainfall = 0.8;
}
public function getName() {
/**
* Returns the biome name
*
* @return string
*/
public function getName(): string {
return "BetterIcePlains";
}
/**
* Returns the biomes' id.
*
* @return int biome id
*/
public function getId() {
public function getId(): int {
return Biome::ICE_PLAINS;
}
}

View file

@ -28,6 +28,10 @@ use pocketmine\block\GoldOre;
use pocketmine\level\generator\normal\biome\SandyBiome;
class BetterMesa extends SandyBiome {
/**
* Constructs the class
*/
public function __construct() {
parent::__construct();
$deadBush = new DeadbushPopulator ();
@ -108,12 +112,20 @@ class BetterMesa extends SandyBiome {
Block::get(Block::RED_SANDSTONE, 0)
]);
}
/**
* Returns the biome name
*
* @return string
*/
public function getName(): string {
return "BetterMesa";
}
/*
/**
* Returns biome id
*
* @return int
*/
public function getId() {
return 39;

View file

@ -27,6 +27,9 @@ use pocketmine\block\GoldOre;
use pocketmine\level\generator\normal\biome\SandyBiome;
class BetterMesaPlains extends SandyBiome {
/**
* Constructs the class
*/
public function __construct() {
parent::__construct();
$deadBush = new DeadbushPopulator ();
@ -104,12 +107,20 @@ class BetterMesaPlains extends SandyBiome {
Block::get(Block::RED_SANDSTONE, 0)
]);
}
/**
* Returns the name of th biome
*
* @return string
*/
public function getName(): string {
return "BetterMesaPlains";
}
/*
/**
* Returns biome id
*
* @return int
*/
public function getId() {
return 40;

View file

@ -21,6 +21,9 @@ use pocketmine\block\Block;
use pocketmine\level\generator\biome\Biome;
class BetterRiver extends Biome {
/**
* Constructs the class
*/
public function __construct() {
$this->clearPopulators ();
@ -43,14 +46,22 @@ class BetterRiver extends Biome {
$this->temperature = 0.5;
$this->rainfall = 0.7;
}
public function getName() {
/**
* Returns the biome name
*
* @return string
*/
public function getName(): string {
return "BetterRiver";
}
/*
* Returns the ID relatively.
/**
* Returns the biome id
*
* @return int
*/
public function getId() {
public function getId(): int {
return Biome::RIVER;
}
}

View file

@ -33,7 +33,17 @@ class BetterBiomeSelector extends BiomeSelector {
/** @var Biome[] */
protected $biomes = [ ];
/** @var callable */
protected $lookup;
/**
* Constructs the class
*
* @param Random $random
* @param callable $lookup
* @param Biome $fallback
*/
public function __construct(Random $random, callable $lookup, Biome $fallback) {
parent::__construct($random, $lookup, $fallback);
$this->fallback = $fallback;
@ -41,24 +51,53 @@ class BetterBiomeSelector extends BiomeSelector {
$this->temperature = new Simplex($random, 2, 1 / 16, 1 / 512);
$this->rainfall = new Simplex($random, 2, 1 / 16, 1 / 512);
}
/**
* Inherited function
*
* @return void
*/
public function recalculate() {
} // Using our own system, No need for that
/**
* Adds a biome to the selector. Don't do this directly. Use BetterNormal::registerBiome
*
* @internal This method is called by BetterNormal::registerBiome
* @param Biome $biome
* @return void
*/
public function addBiome(Biome $biome) {
$this->biomes[$biome->getId ()] = $biome;
}
/**
* Returns the temperature from a location
*
* @param int $x
* @param int $z
* @return void
*/
public function getTemperature($x, $z) {
return ($this->temperature->noise2D($x, $z, true) + 1) / 2;
}
/**
* Returns the rainfall from a location
*
* @param int $x
* @param int $z
* @return void
*/
public function getRainfall($x, $z) {
return ($this->rainfall->noise2D($x, $z, true) + 1) / 2;
}
/**
* Picks a biome relative to $x and $z
*
* @param
* $x
* @param
* $z
* @param int $x
* @param int $z
*
* @return Biome
*/

View file

@ -68,14 +68,21 @@ class BetterNormal extends Generator {
protected $level;
/** @var Random */
protected $random;
/** @var Populator[] */
protected $populators = [ ];
/** @var Populator[] */
protected $generationPopulators = [ ];
/** @var Biome[][] */
public static $biomes = [ ];
/** @var Biome[] */
public static $biomeById = [ ];
/** @var Level[] */
public static $levels = [ ];
/** @var int[][] */
protected static $GAUSSIAN_KERNEL = null; // From main class
/** @var int */
protected static $SMOOTH_SIZE = 2;
/** @var mixed[][] */
public static $options = [
"delBio" => [
],
@ -83,11 +90,13 @@ class BetterNormal extends Generator {
"Lakes"
]
];
/** @var int */
protected $waterHeight = 63;
protected $noiseBase;
/*
/**
* Picks a biome by X and Z
*
* @param $x int
* @param $z int
* @return Biome
@ -245,8 +254,9 @@ class BetterNormal extends Generator {
return true;
}
/*
/**
* Returns a biome by temperature
*
* @param $temperature float
* @param $rainfall float
*/
@ -277,20 +287,22 @@ class BetterNormal extends Generator {
return $ret;
}
/*
/**
* Returns a biome by its id
* @param $id int
*
* @param int $id
* @return Biome
*/
public function getBiomeById(int $id): Biome {
return self::$biomeById[$id] ?? self::$biomeById[Biome::OCEAN];
}
/*
/**
* Generates a chunk.
*
* Cloning method to make it work with new methods.
* @param $chunkX int
* @param $chunkZ int
* @param int $chunkX
* @param int $chunkZ
*/
public function generateChunk($chunkX, $chunkZ) {
@ -359,10 +371,12 @@ class BetterNormal extends Generator {
}
}
/*
* Populates a chunk.
* @param $chunkX int
* @param $chunk2 int
/**
* Populates a chunk
*
* @param int $chunkX
* @param int $chunkZ
* @return void
*/
public function populateChunk($chunkX, $chunkZ) {
$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed ());
@ -383,9 +397,10 @@ class BetterNormal extends Generator {
$biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random);
}
/*
/**
* Constructs the class
* @param $options array
*
* @param array $options
*/
public function __construct(array $options = []) {
self::$options["preset"] = $options["preset"];
@ -407,7 +422,7 @@ class BetterNormal extends Generator {
}
}
/*
/**
* Generates the generation kernel based on smooth size (here 2)
*/
protected static function generateKernel() {
@ -427,24 +442,37 @@ class BetterNormal extends Generator {
}
}
//  Returns the name of the generator
public function getName() {
/**
* Return the name of the generator
*
* @return string
*/
public function getName(): string {
return "betternormal";
}
/*
/**
* Gives the generators settings.
*
* @return array
*/
public function getSettings(): array {
return self::$options;
}
public function getSpawn() {
/**
* Returns spawn location
*
* @return Vector3
*/
public function getSpawn(): Vector3 {
return new Vector3(127.5, 128, 127.5);
}
/*
/**
* Returns a safe spawn location
*
* @return Vector3
*/
public function getSafeSpawn() {
return new Vector3(127.5, $this->getHighestWorkableBlock(127, 127), 127.5);

View file

@ -57,11 +57,12 @@ class LootTable {
const LOOT_IGLOO = 1;
const LOOT_MINESHAFT = 2;
/*
* Asynchronous loot table choosing
* @param $place pocketmine\math\Vector3
* @param $type int
* @param $random pocketmine\utils\Random
/**
* Asynchronous method to build a loot table
*
* @param Vector3 $place
* @param int $type
* @param Random $random
* @return void
*/
public static function buildLootTable(Vector3 $place, int $type, Random $random) {
@ -82,10 +83,11 @@ class LootTable {
$cfg->save();
}
/*
* Synchronous inventory filling with loot table.
* @param $inv pocketmine\inventory\BaseInventory
* @param $pos pocketmine\math\Vector3
/**
* Synchronous inventory filling method
*
* @param BaseInventory $inv
* @param Vector3 $pos
* @return void
*/
public static function fillChest(BaseInventory $inv, Vector3 $pos) {
@ -108,7 +110,7 @@ class LootTable {
}
}
/*
/**
* Returns the plugins folder.
* @return string
*/
@ -119,7 +121,7 @@ class LootTable {
return str_ireplace("phar://", "", implode(DIRECTORY_SEPARATOR, $dir)) . DIRECTORY_SEPARATOR . "BetterGen" . DIRECTORY_SEPARATOR;
}
/*
/**
* Returns the resources folder.
* @return string
*/

View file

@ -22,11 +22,11 @@ abstract class AmountPopulator extends Populator {
protected $baseAmount = 0;
protected $randomAmount = 0;
/*
/**
* Crosssoftware class for random amount
*/
/*
/**
* Sets the random addition amount
* @param $amount int
*/
@ -34,7 +34,7 @@ abstract class AmountPopulator extends Populator {
$this->randomAmount = $amount;
}
/*
/**
* Sets the base addition amount
* @param $amount int
*/
@ -42,24 +42,28 @@ abstract class AmountPopulator extends Populator {
$this->baseAmount = $amount;
}
/*
/**
* Returns the amount based on random
* @param $random Random
*
* @param Random $random
* @return int
*/
public function getAmount(Random $random) {
return $this->baseAmount + $random->nextRange(0, $this->randomAmount + 1);
}
/*
* Returns the base amount
/**
* Returns base amount
*
* @return int
*/
public function getBaseAmount(): int {
return $this->baseAmount;
}
/*
/**
* Returns the random additional amount
*
* @return int
*/
public function getRandomAmount(): int {

View file

@ -26,22 +26,26 @@ use pocketmine\utils\Random;
class BushPopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
/** @var int */
protected $type;
/*
/**
* Constructs the class
* @param $type int
*
* @param int $type
*/
public function __construct($type = 0) {
$this->type = $type;
}
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -59,10 +63,12 @@ class BushPopulator extends AmountPopulator {
}
}
/*
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
/**
* Gets the highest workable block
*
* @param int $x
* @param int $z
* @return void
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {

View file

@ -27,7 +27,7 @@ use pocketmine\utils\Random;
class CactusPopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
/*
/**
* Constructs the class
*/
public function __construct() {
@ -35,12 +35,14 @@ class CactusPopulator extends AmountPopulator {
$this->setRandomAmount(2);
}
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -56,10 +58,13 @@ class CactusPopulator extends AmountPopulator {
}
}
/*
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
/**
* Gets the highest workable block
*
* @param int $x
* @param int $z
* @return void
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y >= 0; -- $y) {

View file

@ -30,12 +30,14 @@ class CavePopulator extends AmountPopulator {
const STOP = false;
const CONTINUE = true;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -63,10 +65,10 @@ class CavePopulator extends AmountPopulator {
}
}
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param int $x
* @param int $z
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
@ -81,12 +83,13 @@ class CavePopulator extends AmountPopulator {
return ++$y;
}
/*
/**
* Generates a cave
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
*
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function generateCave($x, $y, $z, Random $random) {
@ -100,16 +103,18 @@ class CavePopulator extends AmountPopulator {
}
}
}
/*
* Generates a cave branch.
* @param $x int
* @param $y int
* @param $z int
* @param $length int
* @param $height int
* @param $depth int
* @param $random pocketmine\utils\Random
* @yield int
/**
* Generates a cave branch
*
* @param int $x
* @param int $y
* @param int $z
* @param int $length
* @param int $height
* @param int $depth
* @param Random $random
* @yield Vector3
* @return void
*/
public function generateBranch($x, $y, $z, $length, $height, $depth, Random $random) {

View file

@ -28,12 +28,14 @@ class DeadbushPopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;

View file

@ -28,22 +28,24 @@ class FallenTreePopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
protected $type;
/*
/**
* Constructs the class
* @param $type int
* @param int $type
*/
public function __construct(int $type = 0) {
$this->type = $type;
$this->setBaseAmount(1);
$this->setRandomAmount(2);
}
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;

View file

@ -35,17 +35,18 @@ use pocketmine\utils\Random;
class FloatingIslandPopulator extends AmountPopulator {
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
*/
/** @var ChunkManager */
protected $level;
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
if($this->getAmount($random) > 130) {
@ -66,10 +67,10 @@ class FloatingIslandPopulator extends AmountPopulator {
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param int $x
* @param int $z
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
@ -86,13 +87,14 @@ class FloatingIslandPopulator extends AmountPopulator {
/*
* Builds a an island shape
* @param $level pocketmine\level\ChunkManager
* @param $pos pocketmine\math\Vector3
* @param $radius int
* @param $random pocketmine\utils\Random
* @return int lowest ore point
/**
* Builds an island bottom shape
*
* @param ChunkManager $level
* @param Vector3 $pos
* @param int $radius
* @param Random $random
* @return int Bottom place of the island
*/
public function buildIslandBottomShape(ChunkManager $level, Vector3 $pos, int $radius, Random $random) {
$pos = $pos->round();
@ -137,14 +139,15 @@ class FloatingIslandPopulator extends AmountPopulator {
/*
* BPopulate the island with ores
* @param $level pocketmine\level\ChunkManager
* @param $pos pocketmine\math\Vector3
* @param $width int
* @param $height int
* @param $random pocketmine\utils\Random
* @return void
/**
* Populates the island with ores
*
* @param ChunkManager $level
* @param Vector3 $pos
* @param int $width
* @param int $height
* @param Random $random
* @return void
*/
public function populateOres(ChunkManager $level, Vector3 $pos, int $width, int $height, Random $random) {
$ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore();

View file

@ -25,12 +25,15 @@ class IglooPopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -44,10 +47,10 @@ class IglooPopulator extends AmountPopulator {
$igloo->placeObject($level, $x, $y, $z, $random);
}
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param int $x
* @param int $z
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {

View file

@ -28,12 +28,15 @@ class LakePopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -55,10 +58,10 @@ class LakePopulator extends AmountPopulator {
$level->setBlockIdAt($xx, $yy, $zz, Block::AIR);
}
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param int $x
* @param int $z
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {

View file

@ -25,6 +25,7 @@ use pocketmine\math\Vector3;
use pocketmine\utils\Random;
class MineshaftPopulator extends AmountPopulator {
/** var int */
protected $maxPath;
/** @var ChunkManager */
protected $level;
@ -36,12 +37,14 @@ class MineshaftPopulator extends AmountPopulator {
const TYPE_CROSSPATH = 1;
const TYPE_STAIRS = 2;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
if ($this->getAmount($random) < 100)

View file

@ -28,12 +28,14 @@ class RavinePopulator extends AmountPopulator {
protected $level;
const NOISE = 250;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -90,14 +92,16 @@ class RavinePopulator extends AmountPopulator {
return ++$y;
}
/*
* Builds a ravine part
* @param $x int
* @param $y int
* @param $z int
* @param $height int
* @param $length int
* @param $random pocketmine\utils\Random
/**
* Buidls a ravine part
*
* @param int $x
* @param int $y
* @param int $z
* @param int $height
* @param int $length
* @param Random $random
* @return void
*/
protected function buildRavinePart($x, $y, $z, $height, $length, Random $random) {
$xBounded = 0;

View file

@ -26,6 +26,7 @@ use pocketmine\utils\Random;
class SugarCanePopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
/**
* Constructs the class
*/
@ -35,11 +36,13 @@ class SugarCanePopulator extends AmountPopulator {
}
/**
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;

View file

@ -27,12 +27,14 @@ class TemplePopulator extends AmountPopulator {
/** @var Level */
protected $level;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -46,10 +48,10 @@ class TemplePopulator extends AmountPopulator {
$temple->placeObject($level, $x, $y - 1, $z, $random);
}
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param int $x
* @param int $z
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {

View file

@ -34,9 +34,10 @@ class TreePopulator extends AmountPopulator {
];
/** @var ChunkManager */
protected $level;
/** @var int */
protected $type;
/*
/**
* Constructs the class
*/
public function __construct($type = 0) {
@ -50,12 +51,15 @@ class TreePopulator extends AmountPopulator {
}
}
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -74,10 +78,10 @@ class TreePopulator extends AmountPopulator {
}
}
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param int $x
* @param int $z
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {

View file

@ -27,12 +27,15 @@ class WellPopulator extends AmountPopulator {
/** @var ChunkManager */
protected $level;
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
* @param $chunkX int
* @param $chunkZ int
* @param $random pocketmine\utils\Random
/**
* Populates the chunk
*
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @return void
*/
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
$this->level = $level;
@ -46,10 +49,10 @@ class WellPopulator extends AmountPopulator {
$well->placeObject($level, $x, $y, $z, $random);
}
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param int $x
* @param int $z
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {

View file

@ -30,13 +30,16 @@ class Bush extends Object {
Block::SNOW_LAYER => true,
Block::LOG2 => true
];
/** @var int[] */
protected $leaf;
/** @var int */
protected $height;
/*
/**
* Constructs the class
* @param $leafId int
* @param $leafData int
*
* @param int $leafId
* @param int $leafData
*/
public function __construct($leafId = Block::LEAVES, $leafData = 0) {
$this->leaf = [
@ -45,13 +48,15 @@ class Bush extends Object {
];
}
/*
/**
* Places a bush
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
$number = $random->nextBoundedInt(6);
@ -67,12 +72,14 @@ class Bush extends Object {
}
}
/*
/**
* Places a leaf
* @param $x int
* @param $y int
* @param $z int
* @param $level pocketmine\level\ChunkManager
*
* @param int $x
* @param int $y
* @param int $z
* @param ChunkManager $level
* @return void
*/
public function placeLeaf($x, $y, $z, ChunkManager $level) {
if (isset($this->overridable[$level->getBlockIdAt($x, $y, $z)]) && ! isset($this->overridable[$level->getBlockIdAt($x, $y - 1, $z)])) {

View file

@ -24,16 +24,18 @@ use pocketmine\utils\Random;
class Cactus extends Object {
/*
* Checks if a cactus is placeable
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
*/
protected $totalHeight;
/**
* Checks if a cactus is placeable
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return bool
*/
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random): bool {
$this->totalHeight = 1 + $random->nextBoundedInt(3);
$below = $level->getBlockIdAt($x, $y - 1, $z);
@ -45,12 +47,14 @@ class Cactus extends Object {
return true;
}
/*
/**
* Places a cactus
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @return void
*/
public function placeObject(ChunkManager $level, int $x, int $y, int $z) {
for($yy = 0; $yy < $this->totalHeight; $yy ++) {

View file

@ -39,27 +39,33 @@ class FallenTree extends Object {
Block::LEAVES2 => true,
Block::CACTUS => true
];
/** @var Tree */
protected $tree;
/** @var int */
protected $direction;
/** @var Random */
protected $random;
/** @var int */
protected $length = 0;
/*
/**
* Constructs the class
* @param $tree ObjectTree
* @throws Exeption
*
* @param ObjectTree $tree
*/
public function __construct(ObjectTree $tree) {
$this->tree = $tree;
}
/*
* Places a fallen tree
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
/**
* Checks the placement a fallen tree
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
echo "Checking at $x $y $z FallenTree\n";
@ -106,12 +112,14 @@ class FallenTree extends Object {
return true;
}
/*
/**
* Places a fallen tree
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @return void
*/
public function placeObject(ChunkManager $level, $x, $y, $z) {
echo "Placing at $x $y $z FallenTree D: $this->direction, L: $this->length\n";
@ -150,12 +158,14 @@ class FallenTree extends Object {
}
}
/*
* Places a Block
* @param $x int
* @param $y int
* @param $z int
* @param $level pocketmine\level\ChunkManager
/**
* Places a block
*
* @param int $x
* @param int $y
* @param int $z
* @param ChunkManager $level
* @return void
*/
public function placeBlock($x, $y, $z, ChunkManager $level) {
if (isset(self::$overridable[$level->getBlockIdAt($x, $y, $z)]) && ! isset(self::$overridable[$level->getBlockIdAt($x, $y - 1, $z)])) {

View file

@ -34,16 +34,18 @@ class Igloo extends Object {
Block::LOG2 => true,
Block::LEAVES2 => true
];
/** @var int */
protected $direction;
/*
* Checks if an igloo is placeable
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
* @return bool
/**
* Checks if an igloo is placable
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
$this->direction = $random->nextBoundedInt(4);
@ -80,14 +82,15 @@ class Igloo extends Object {
return true;
}
/*
/**
* Places an igloo
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
* @return bool placed
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
if (! isset($this->direction) && ! $this->canPlaceObject($level, $x, $y, $z, $random))

View file

@ -443,12 +443,14 @@ class SakuraTree extends Tree {
];
const maxPerChunk = 2;
/** @var int */
public $trunkHeight = 11;
/** @var int */
public $leafType;
/** @var int */
public $leaf2Type;
/*
/**
* Constructs the class
*/
public function __construct() {
@ -460,13 +462,15 @@ class SakuraTree extends Tree {
$this->type = Wood::OAK;
}
/*
* Builds the tree.
* @param $level \pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random $random
/**
* Builds a tree
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
$percentage = $random->nextBoundedInt(100);
@ -572,9 +576,7 @@ class SakuraTree extends Tree {
$totalLength = $stickLen + $stickLen2; // Length of the stick
$sideLen = $totalLength ** 2; // Side length
//TODO CHECK WHAT THIS IS SUPPOSED TO BE
$numForward = ($totalLength % 2 == 0) ? $totalLength - 1 : $totalLength;
//TODO END
$lX1 = $lZ1 = $lX = $lZ = 0;
// First branch part + first leave part
@ -624,8 +626,6 @@ class SakuraTree extends Tree {
}
}
// continue;
switch ($dir + 1) {
case 4 :
$xd2 = 0;
@ -659,25 +659,29 @@ class SakuraTree extends Tree {
}
}
/*
* Fills a log at.
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
/**
* Fills a log
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @return void
*/
public function setLog(ChunkManager $level, $x, $y, $z) {
$level->setBlockIdAt($x, $y, $z, $this->trunkBlock);
$level->setBlockDataAt($x, $y, $z, $this->type);
}
/*
* Fills a leave at.
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
/**
* Fills leaves
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function setLeave(ChunkManager $level, $x, $y, $z, Random $random) {
$data = [

View file

@ -25,16 +25,18 @@ use pocketmine\utils\Random;
class SugarCane extends Object {
/*
* Checks if a cactus is placeable
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
*/
protected $totalHeight;
/**
* Checks if a sugarcane is placable
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return bool
*/
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random): bool {
$this->totalHeight = 1 + $random->nextBoundedInt(3);
$below = $level->getBlockIdAt($x, $y - 1, $z);
@ -44,12 +46,14 @@ class SugarCane extends Object {
return false;
}
/*
* Places a cactus
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
/**
* Places a sugar cane
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @return void
*/
public function placeObject(ChunkManager $level, int $x, int $y, int $z) {
for($yy = 0; $yy < $this->totalHeight; $yy ++) {

View file

@ -114,16 +114,17 @@ class Temple extends Object {
protected $level;
protected $direction = 0;
/*
* Checks if a temple is placeable
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
* @return bool
/**
* Checks if a temple is placable
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
$this->level = $level;
$this->direction = $random->nextBoundedInt(4);
@ -135,13 +136,15 @@ class Temple extends Object {
return true;
}
/*
* Places a temple
* @param $level pocketmine\level\ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random pocketmine\utils\Random
/**
* Builds a temple
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
// Clearing space...
@ -157,26 +160,13 @@ class Temple extends Object {
// Floor top
BuildingUtils::fill($level, new Vector3($x - 5, $y + 4, $z - 5), new Vector3($x + 5, $y + 4, $z + 5), Block::get(Block::SANDSTONE));
#for ($xx = $x + 5; $xx >= $x - 5; $xx--)
# for ($zz = $z + 5; $zz >= $z - 5; $zz--)
# $this->placeBlock($xx, $y + 4, $zz);
// Creating hole
BuildingUtils::fill($level, new Vector3($x - 1, $y - 11, $z - 1), new Vector3($x + 1, $y + 4, $z + 1), Block::get(Block::AIR));
#for ($xx = $x - 1; $xx <= $x + 1; $xx++)
# for ($yy = $y - 11; $yy <= $y + 4; $yy++)
# for ($zz = $z - 1; $zz <= $z + 1; $zz++)
# $this->placeBlock($xx, $yy, $zz, Block::AIR);
// Hole walls
BuildingUtils::walls($level, new Vector3($x - 2, $y - 1, $z - 2), new Vector3($x + 2, $y - 8, $z + 2), Block::get(Block::SANDSTONE));
//Floor bottom
BuildingUtils::fill($level, new Vector3($x - 9, $y, $z - 9), new Vector3($x + 9, $y, $z + 9), Block::get(Block::SANDSTONE));
#for ($xx = $x + 9; $xx >= $x - 9; $xx--)
# for ($zz = $z + 9; $zz >= $z - 9; $zz--)
# $this->placeBlock($xx, $y, $zz);
// Floor pattern
for ($i = -2; $i <= 1; $i++) {//straight
$xextra = ($i + 1) % 2;

View file

@ -58,14 +58,15 @@ class Well extends Object {
]
];
/*
* Checks if a well is placeable
* @param $level ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random Random
* @return bool
/**
* Checks if a Well is placable
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
$this->level = $level;
@ -77,13 +78,15 @@ class Well extends Object {
return true;
}
/*
/**
* Places a well
* @param $level ChunkManager
* @param $x int
* @param $y int
* @param $z int
* @param $random Random
*
* @param ChunkManager $level
* @param int $x
* @param int $y
* @param int $z
* @param Random $random
* @return void
*/
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
$this->level = $level;
@ -114,12 +117,14 @@ class Well extends Object {
$this->placeBlock($x, $y, $z, Block::WATER);
}
/*
* Places a slab
* @param $x int
* @param $y int
* @param $z int
* @param $id int
/**
* Places a block
*
* @param int $x
* @param int $y
* @param int $z
* @param int $id
* @param int $meta
* @return void
*/
public function placeBlock($x, $y, $z, $id = 0, $meta = 0) {

View file

@ -33,12 +33,13 @@ class BuildingUtils {
Block::PLANK
];
/*
/**
* Fills an area
* @param $level pocketmine\level\ChunkManager
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
* @param $block pocketmine\block\Block
*
* @param ChunkManager $level
* @param Vector3 $pos1
* @param Vector3 $pos2
* @param Block $block
* @return void
*/
public static function fill(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block = null) {
@ -51,14 +52,15 @@ class BuildingUtils {
}
/*
/**
* Fills an area randomly
* @param $level pocketmine\level\ChunkManager
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
* @param $block pocketmine\block\Block
* @param $random pocketmine\utils
* @param $randMax pocketmine\utils
*
* @param ChunkManager $level
* @param Vector3 $pos1
* @param Vector3 $pos2
* @param Block $block
* @param Random $random
* @param int $randMax
* @return void
*/
public static function fillRandom(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block = null, Random $random = null, $randMax = 3) {
@ -70,12 +72,13 @@ class BuildingUtils {
}
}
/*
* Fills an area by custom filling
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
* @param $call callback
* @param $params array
/**
* Custom area filling
*
* @param Vector3 $pos1
* @param Vector3 $pos2
* @param callable $call
* @param array $params
* @return array
*/
public static function fillCallback(Vector3 $pos1, Vector3 $pos2, callable $call, ...$params) : array {
@ -87,12 +90,13 @@ class BuildingUtils {
return $return;
}
/*
/**
* Creates walls
* @param $level pocketmine\level\ChunkManager
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
* @param $block pocketmine\block\Block
*
* @param ChunkManager $level
* @param Vector3 $pos1
* @param Vector3 $pos2
* @param Block $block
* @return void
*/
public static function walls(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
@ -113,12 +117,13 @@ class BuildingUtils {
}
}
/*
/**
* Creates the top of a structure
* @param $level pocketmine\level\ChunkManager
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
* @param $block pocketmine\block\Block
*
* @param ChunkManager $level
* @param Vector3 $pos1
* @param Vector3 $pos2
* @param Block $block
* @return void
*/
public static function top(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
@ -130,12 +135,13 @@ class BuildingUtils {
}
}
/*
* Creates all corners from positions. Used for Mineshaft.
* @param $level pocketmine\level\ChunkManager
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
* @param $block pocketmine\block\Block
/**
* Creates the corners of the structures. Used for mineshaft "towers"
*
* @param ChunkManager $level
* @param Vector3 $pos1
* @param Vector3 $pos2
* @param Block $block
* @return void
*/
public static function corners(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
@ -152,12 +158,13 @@ class BuildingUtils {
}
}
/*
* Creates the bottom of a structure
* @param $level pocketmine\level\ChunkManager
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
* @param $block pocketmine\block\Block
/**
* Fills the bottom of a structure
*
* @param ChunkManager $level
* @param Vector3 $pos1
* @param Vector3 $pos2
* @param Block $block
* @return void
*/
public static function bottom(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
@ -169,13 +176,14 @@ class BuildingUtils {
}
}
/*
* Builds a random structure depending of length, height, depth and random
* @param $level pocketmine\level\ChunkManager
* @param $pos pocketmine\math\Vector3
* @param $infos pocketmine\math\Vector3
* @param $random pocketmine\utils\Random
* @param $block pocketmine\block\Block
/**
* Builds a structure randomly based on a circle algorithm. Used in caves and lakes.
*
* @param ChunkManager $level
* @param Vector3 $pos
* @param Vector3 $infos
* @param Random $random
* @param Block $block
* @return void
*/
public static function buildRandom(ChunkManager $level, Vector3 $pos, Vector3 $infos, Random $random, Block $block) {
@ -196,10 +204,11 @@ class BuildingUtils {
}
}
/*
* Returns 2 vector3, one with minimal values, one with max values of the provided ones.
* @param $pos1 pocketmine\math\Vector3
* @param $pos2 pocketmine\math\Vector3
/**
* Returns two Vector three, the biggest and lowest ones based on two provided vectors
*
* @param Vector3 $pos1
* @param Vector3 $pos2
* @return array
*/
protected static function minmax(Vector3 $pos1, Vector3 $pos2): array {