Documented EVERY SINGLE FUNCTIONS...
This commit is contained in:
parent
920fd82b6e
commit
1f6416d02e
34 changed files with 688 additions and 467 deletions
|
@ -46,18 +46,22 @@ class Main extends PluginBase implements Listener {
|
||||||
const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f ";
|
const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f ";
|
||||||
const SAKURA_FOREST = 100; // Letting some place for future biomes.
|
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) {
|
public static function registerBiome(int $id, Biome $biome) {
|
||||||
BetterNormal::registerBiome($biome);
|
BetterNormal::registerBiome($biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Called when the plugin disables
|
* Called when the plugin enales
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function onEnable() {
|
public function onEnable() {
|
||||||
$this->getServer()->getPluginManager()->registerEvents($this, $this);
|
$this->getServer()->getPluginManager()->registerEvents($this, $this);
|
||||||
Generator::addGenerator(BetterNormal::class, "betternormal");
|
Generator::addGenerator(BetterNormal::class, "betternormal");
|
||||||
|
@ -67,15 +71,12 @@ class Main extends PluginBase implements Listener {
|
||||||
file_put_contents(LootTable::getPluginFolder() . "processingLoots.json", "{}");
|
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() {
|
public static function isOtherNS() {
|
||||||
try {
|
try {
|
||||||
return @class_exists("pocketmine\\level\\generator\\normal\\object\\OakTree");
|
return @class_exists("pocketmine\\level\\generator\\normal\\object\\OakTree");
|
||||||
|
@ -84,24 +85,15 @@ class Main extends PluginBase implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Registers a forest type.
|
* Called when a command executes
|
||||||
* @param $name string
|
*
|
||||||
* @param $treeClass string
|
* @param CommandSender $sender
|
||||||
* @params $infos Array(temperature, rainfall)
|
* @param Command $cmd
|
||||||
|
* @param int $label
|
||||||
|
* @param array $args
|
||||||
* @return bool
|
* @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 {
|
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args): bool {
|
||||||
switch ($cmd->getName()) {
|
switch ($cmd->getName()) {
|
||||||
case "createworld": // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
|
case "createworld": // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
|
||||||
|
@ -208,23 +200,22 @@ class Main extends PluginBase implements Listener {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Generates a(semi) random seed.
|
* Generates a (semi) random seed.
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function generateRandomSeed(): int {
|
public function generateRandomSeed(): int {
|
||||||
return (int)round(rand(0, round(time()) / memory_get_usage(true)) * (int)str_shuffle("127469453645108") / (int)str_shuffle("12746945364"));
|
return (int)round(rand(0, round(time()) / memory_get_usage(true)) * (int)str_shuffle("127469453645108") / (int)str_shuffle("12746945364"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listener
|
/**
|
||||||
|
* Registers a forest from a tree class
|
||||||
/*
|
*
|
||||||
* Checks after a chunk populates so we an add tiles and loot tables
|
* @param string $name
|
||||||
* @param $event pocketmine\event\level\ChunkPopulateEvent
|
* @param string $treeClass
|
||||||
* @return int
|
* @param array $infos
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function registerForest(string $name, string $treeClass, array $infos): bool {
|
public function registerForest(string $name, string $treeClass, array $infos): bool {
|
||||||
if (!@class_exists($treeClass))
|
if (!@class_exists($treeClass))
|
||||||
return false;
|
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) {
|
public function onChunkPopulate(ChunkPopulateEvent $event) {
|
||||||
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
||||||
foreach ($cfg->getAll() as $key => $value) {
|
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) {
|
public function onInteract(PlayerInteractEvent $event) {
|
||||||
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
||||||
if ($event->getBlock()->getId() !== Block::CHEST) return;
|
if ($event->getBlock()->getId() !== Block::CHEST) return;
|
||||||
|
@ -275,11 +270,12 @@ class Main extends PluginBase implements Listener {
|
||||||
LootTable::fillChest($chest->getInventory(), $event->getBlock());
|
LootTable::fillChest($chest->getInventory(), $event->getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Check if it's a Tesseract like namespace
|
* Checks when a players breaks an ungenerated chest to generate it.
|
||||||
* @return bool
|
*
|
||||||
*/
|
* @param BlockBreakEvent $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function onBlockBreak(BlockBreakEvent $event) {
|
public function onBlockBreak(BlockBreakEvent $event) {
|
||||||
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
||||||
if ($event->getBlock()->getId() !== Block::CHEST) return;
|
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 = Tile::createTile(Tile::CHEST, $event->getBlock()->getLevel(), $nbt);
|
||||||
$chest->setName("§k(Fake)§r Minecart chest");
|
$chest->setName("§k(Fake)§r Minecart chest");
|
||||||
LootTable::fillChest($chest->getInventory(), $event->getBlock());
|
LootTable::fillChest($chest->getInventory(), $event->getBlock());
|
||||||
// $event->setCancelled(); //i think nope. You want to break it with items
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,10 @@ use pocketmine\level\generator\biome\Biome;
|
||||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||||
|
|
||||||
class BetterDesert extends SandyBiome implements Mountainable {
|
class BetterDesert extends SandyBiome implements Mountainable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the class
|
||||||
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$deadBush = new DeadbushPopulator ();
|
$deadBush = new DeadbushPopulator ();
|
||||||
|
@ -76,14 +80,22 @@ class BetterDesert extends SandyBiome implements Mountainable {
|
||||||
Block::get(Block::SANDSTONE, 0)
|
Block::get(Block::SANDSTONE, 0)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the class
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getName(): string {
|
public function getName(): string {
|
||||||
return "BetterDesert";
|
return "BetterDesert";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns biome id
|
* Returns biome id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId(): int {
|
||||||
return Biome::DESERT;
|
return Biome::DESERT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,16 +28,25 @@ use pocketmine\level\generator\normal\biome\ForestBiome;
|
||||||
|
|
||||||
|
|
||||||
class BetterForest extends ForestBiome implements Mountainable {
|
class BetterForest extends ForestBiome implements Mountainable {
|
||||||
|
/** @var string[] **/
|
||||||
static $types = [
|
static $types = [
|
||||||
"Oak Forest",
|
"Oak Forest",
|
||||||
"Birch Forest",
|
"Birch Forest",
|
||||||
"Sakura Forest"
|
"Sakura Forest"
|
||||||
];
|
];
|
||||||
|
/** @var int[] **/
|
||||||
static $ids = [
|
static $ids = [
|
||||||
Biome::FOREST,
|
Biome::FOREST,
|
||||||
Biome::BIRCH_FOREST,
|
Biome::BIRCH_FOREST,
|
||||||
Main::SAKURA_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]) {
|
public function __construct($type = 0, array $infos = [0.6, 0.5]) {
|
||||||
parent::__construct($type);
|
parent::__construct($type);
|
||||||
$this->clearPopulators ();
|
$this->clearPopulators ();
|
||||||
|
@ -73,12 +82,15 @@ class BetterForest extends ForestBiome implements Mountainable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID relatively.
|
* Returns the ID relatively.
|
||||||
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return self::$ids[$this->type];
|
return self::$ids[$this->type];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Registers a forest
|
||||||
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $treeClass
|
* @param string $treeClass
|
||||||
* @param array $infos
|
* @param array $infos
|
||||||
|
|
|
@ -25,6 +25,10 @@ use pocketmine\level\generator\biome\Biome;
|
||||||
use pocketmine\level\generator\normal\biome\SnowyBiome;
|
use pocketmine\level\generator\normal\biome\SnowyBiome;
|
||||||
|
|
||||||
class BetterIcePlains extends SnowyBiome implements Mountainable {
|
class BetterIcePlains extends SnowyBiome implements Mountainable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the class
|
||||||
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct ();
|
parent::__construct ();
|
||||||
$this->setGroundCover([
|
$this->setGroundCover([
|
||||||
|
@ -46,15 +50,22 @@ class BetterIcePlains extends SnowyBiome implements Mountainable {
|
||||||
$this->temperature = 0.05;
|
$this->temperature = 0.05;
|
||||||
$this->rainfall = 0.8;
|
$this->rainfall = 0.8;
|
||||||
}
|
}
|
||||||
public function getName() {
|
|
||||||
|
/**
|
||||||
|
* Returns the biome name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName(): string {
|
||||||
return "BetterIcePlains";
|
return "BetterIcePlains";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the biomes' id.
|
* Returns the biomes' id.
|
||||||
|
*
|
||||||
* @return int biome id
|
* @return int biome id
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId(): int {
|
||||||
return Biome::ICE_PLAINS;
|
return Biome::ICE_PLAINS;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,6 +28,10 @@ use pocketmine\block\GoldOre;
|
||||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||||
|
|
||||||
class BetterMesa extends SandyBiome {
|
class BetterMesa extends SandyBiome {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the class
|
||||||
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$deadBush = new DeadbushPopulator ();
|
$deadBush = new DeadbushPopulator ();
|
||||||
|
@ -108,12 +112,20 @@ class BetterMesa extends SandyBiome {
|
||||||
Block::get(Block::RED_SANDSTONE, 0)
|
Block::get(Block::RED_SANDSTONE, 0)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the biome name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getName(): string {
|
public function getName(): string {
|
||||||
return "BetterMesa";
|
return "BetterMesa";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns biome id
|
* Returns biome id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return 39;
|
return 39;
|
||||||
|
|
|
@ -27,6 +27,9 @@ use pocketmine\block\GoldOre;
|
||||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||||
|
|
||||||
class BetterMesaPlains extends SandyBiome {
|
class BetterMesaPlains extends SandyBiome {
|
||||||
|
/**
|
||||||
|
* Constructs the class
|
||||||
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$deadBush = new DeadbushPopulator ();
|
$deadBush = new DeadbushPopulator ();
|
||||||
|
@ -104,12 +107,20 @@ class BetterMesaPlains extends SandyBiome {
|
||||||
Block::get(Block::RED_SANDSTONE, 0)
|
Block::get(Block::RED_SANDSTONE, 0)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of th biome
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getName(): string {
|
public function getName(): string {
|
||||||
return "BetterMesaPlains";
|
return "BetterMesaPlains";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns biome id
|
* Returns biome id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return 40;
|
return 40;
|
||||||
|
|
|
@ -21,6 +21,9 @@ use pocketmine\block\Block;
|
||||||
use pocketmine\level\generator\biome\Biome;
|
use pocketmine\level\generator\biome\Biome;
|
||||||
|
|
||||||
class BetterRiver extends Biome {
|
class BetterRiver extends Biome {
|
||||||
|
/**
|
||||||
|
* Constructs the class
|
||||||
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->clearPopulators ();
|
$this->clearPopulators ();
|
||||||
|
|
||||||
|
@ -43,14 +46,22 @@ class BetterRiver extends Biome {
|
||||||
$this->temperature = 0.5;
|
$this->temperature = 0.5;
|
||||||
$this->rainfall = 0.7;
|
$this->rainfall = 0.7;
|
||||||
}
|
}
|
||||||
public function getName() {
|
|
||||||
|
/**
|
||||||
|
* Returns the biome name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName(): string {
|
||||||
return "BetterRiver";
|
return "BetterRiver";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the ID relatively.
|
* Returns the biome id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId(): int {
|
||||||
return Biome::RIVER;
|
return Biome::RIVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,7 +33,17 @@ class BetterBiomeSelector extends BiomeSelector {
|
||||||
|
|
||||||
/** @var Biome[] */
|
/** @var Biome[] */
|
||||||
protected $biomes = [ ];
|
protected $biomes = [ ];
|
||||||
|
|
||||||
|
/** @var callable */
|
||||||
protected $lookup;
|
protected $lookup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the class
|
||||||
|
*
|
||||||
|
* @param Random $random
|
||||||
|
* @param callable $lookup
|
||||||
|
* @param Biome $fallback
|
||||||
|
*/
|
||||||
public function __construct(Random $random, callable $lookup, Biome $fallback) {
|
public function __construct(Random $random, callable $lookup, Biome $fallback) {
|
||||||
parent::__construct($random, $lookup, $fallback);
|
parent::__construct($random, $lookup, $fallback);
|
||||||
$this->fallback = $fallback;
|
$this->fallback = $fallback;
|
||||||
|
@ -41,24 +51,53 @@ class BetterBiomeSelector extends BiomeSelector {
|
||||||
$this->temperature = new Simplex($random, 2, 1 / 16, 1 / 512);
|
$this->temperature = new Simplex($random, 2, 1 / 16, 1 / 512);
|
||||||
$this->rainfall = 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() {
|
public function recalculate() {
|
||||||
} // Using our own system, No need for that
|
} // 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) {
|
public function addBiome(Biome $biome) {
|
||||||
$this->biomes[$biome->getId ()] = $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) {
|
public function getTemperature($x, $z) {
|
||||||
return ($this->temperature->noise2D($x, $z, true) + 1) / 2;
|
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) {
|
public function getRainfall($x, $z) {
|
||||||
return ($this->rainfall->noise2D($x, $z, true) + 1) / 2;
|
return ($this->rainfall->noise2D($x, $z, true) + 1) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Picks a biome relative to $x and $z
|
||||||
*
|
*
|
||||||
* @param
|
* @param int $x
|
||||||
* $x
|
* @param int $z
|
||||||
* @param
|
|
||||||
* $z
|
|
||||||
*
|
*
|
||||||
* @return Biome
|
* @return Biome
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -68,14 +68,21 @@ class BetterNormal extends Generator {
|
||||||
protected $level;
|
protected $level;
|
||||||
/** @var Random */
|
/** @var Random */
|
||||||
protected $random;
|
protected $random;
|
||||||
|
/** @var Populator[] */
|
||||||
protected $populators = [ ];
|
protected $populators = [ ];
|
||||||
|
/** @var Populator[] */
|
||||||
protected $generationPopulators = [ ];
|
protected $generationPopulators = [ ];
|
||||||
|
/** @var Biome[][] */
|
||||||
public static $biomes = [ ];
|
public static $biomes = [ ];
|
||||||
/** @var Biome[] */
|
/** @var Biome[] */
|
||||||
public static $biomeById = [ ];
|
public static $biomeById = [ ];
|
||||||
|
/** @var Level[] */
|
||||||
public static $levels = [ ];
|
public static $levels = [ ];
|
||||||
|
/** @var int[][] */
|
||||||
protected static $GAUSSIAN_KERNEL = null; // From main class
|
protected static $GAUSSIAN_KERNEL = null; // From main class
|
||||||
|
/** @var int */
|
||||||
protected static $SMOOTH_SIZE = 2;
|
protected static $SMOOTH_SIZE = 2;
|
||||||
|
/** @var mixed[][] */
|
||||||
public static $options = [
|
public static $options = [
|
||||||
"delBio" => [
|
"delBio" => [
|
||||||
],
|
],
|
||||||
|
@ -83,11 +90,13 @@ class BetterNormal extends Generator {
|
||||||
"Lakes"
|
"Lakes"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
/** @var int */
|
||||||
protected $waterHeight = 63;
|
protected $waterHeight = 63;
|
||||||
protected $noiseBase;
|
protected $noiseBase;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Picks a biome by X and Z
|
* Picks a biome by X and Z
|
||||||
|
*
|
||||||
* @param $x int
|
* @param $x int
|
||||||
* @param $z int
|
* @param $z int
|
||||||
* @return Biome
|
* @return Biome
|
||||||
|
@ -245,8 +254,9 @@ class BetterNormal extends Generator {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns a biome by temperature
|
* Returns a biome by temperature
|
||||||
|
*
|
||||||
* @param $temperature float
|
* @param $temperature float
|
||||||
* @param $rainfall float
|
* @param $rainfall float
|
||||||
*/
|
*/
|
||||||
|
@ -277,20 +287,22 @@ class BetterNormal extends Generator {
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns a biome by its id
|
* Returns a biome by its id
|
||||||
* @param $id int
|
*
|
||||||
|
* @param int $id
|
||||||
* @return Biome
|
* @return Biome
|
||||||
*/
|
*/
|
||||||
public function getBiomeById(int $id): Biome {
|
public function getBiomeById(int $id): Biome {
|
||||||
return self::$biomeById[$id] ?? self::$biomeById[Biome::OCEAN];
|
return self::$biomeById[$id] ?? self::$biomeById[Biome::OCEAN];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Generates a chunk.
|
* Generates a chunk.
|
||||||
|
*
|
||||||
* Cloning method to make it work with new methods.
|
* Cloning method to make it work with new methods.
|
||||||
* @param $chunkX int
|
* @param int $chunkX
|
||||||
* @param $chunkZ int
|
* @param int $chunkZ
|
||||||
*/
|
*/
|
||||||
public function generateChunk($chunkX, $chunkZ) {
|
public function generateChunk($chunkX, $chunkZ) {
|
||||||
|
|
||||||
|
@ -359,10 +371,12 @@ class BetterNormal extends Generator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populates a chunk.
|
* Populates a chunk
|
||||||
* @param $chunkX int
|
*
|
||||||
* @param $chunk2 int
|
* @param int $chunkX
|
||||||
|
* @param int $chunkZ
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populateChunk($chunkX, $chunkZ) {
|
public function populateChunk($chunkX, $chunkZ) {
|
||||||
$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed ());
|
$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);
|
$biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
* @param $options array
|
*
|
||||||
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
public function __construct(array $options = []) {
|
public function __construct(array $options = []) {
|
||||||
self::$options["preset"] = $options["preset"];
|
self::$options["preset"] = $options["preset"];
|
||||||
|
@ -407,7 +422,7 @@ class BetterNormal extends Generator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Generates the generation kernel based on smooth size (here 2)
|
* Generates the generation kernel based on smooth size (here 2)
|
||||||
*/
|
*/
|
||||||
protected static function generateKernel() {
|
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";
|
return "betternormal";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gives the generators settings.
|
* Gives the generators settings.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getSettings(): array {
|
public function getSettings(): array {
|
||||||
return self::$options;
|
return self::$options;
|
||||||
}
|
}
|
||||||
public function getSpawn() {
|
|
||||||
|
/**
|
||||||
|
* Returns spawn location
|
||||||
|
*
|
||||||
|
* @return Vector3
|
||||||
|
*/
|
||||||
|
public function getSpawn(): Vector3 {
|
||||||
return new Vector3(127.5, 128, 127.5);
|
return new Vector3(127.5, 128, 127.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns a safe spawn location
|
* Returns a safe spawn location
|
||||||
|
*
|
||||||
|
* @return Vector3
|
||||||
*/
|
*/
|
||||||
public function getSafeSpawn() {
|
public function getSafeSpawn() {
|
||||||
return new Vector3(127.5, $this->getHighestWorkableBlock(127, 127), 127.5);
|
return new Vector3(127.5, $this->getHighestWorkableBlock(127, 127), 127.5);
|
||||||
|
|
|
@ -57,11 +57,12 @@ class LootTable {
|
||||||
const LOOT_IGLOO = 1;
|
const LOOT_IGLOO = 1;
|
||||||
const LOOT_MINESHAFT = 2;
|
const LOOT_MINESHAFT = 2;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Asynchronous loot table choosing
|
* Asynchronous method to build a loot table
|
||||||
* @param $place pocketmine\math\Vector3
|
*
|
||||||
* @param $type int
|
* @param Vector3 $place
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $type
|
||||||
|
* @param Random $random
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function buildLootTable(Vector3 $place, int $type, Random $random) {
|
public static function buildLootTable(Vector3 $place, int $type, Random $random) {
|
||||||
|
@ -82,10 +83,11 @@ class LootTable {
|
||||||
$cfg->save();
|
$cfg->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Synchronous inventory filling with loot table.
|
* Synchronous inventory filling method
|
||||||
* @param $inv pocketmine\inventory\BaseInventory
|
*
|
||||||
* @param $pos pocketmine\math\Vector3
|
* @param BaseInventory $inv
|
||||||
|
* @param Vector3 $pos
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function fillChest(BaseInventory $inv, Vector3 $pos) {
|
public static function fillChest(BaseInventory $inv, Vector3 $pos) {
|
||||||
|
@ -108,7 +110,7 @@ class LootTable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the plugins folder.
|
* Returns the plugins folder.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -119,7 +121,7 @@ class LootTable {
|
||||||
return str_ireplace("phar://", "", implode(DIRECTORY_SEPARATOR, $dir)) . DIRECTORY_SEPARATOR . "BetterGen" . DIRECTORY_SEPARATOR;
|
return str_ireplace("phar://", "", implode(DIRECTORY_SEPARATOR, $dir)) . DIRECTORY_SEPARATOR . "BetterGen" . DIRECTORY_SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the resources folder.
|
* Returns the resources folder.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,11 +22,11 @@ abstract class AmountPopulator extends Populator {
|
||||||
protected $baseAmount = 0;
|
protected $baseAmount = 0;
|
||||||
protected $randomAmount = 0;
|
protected $randomAmount = 0;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Crosssoftware class for random amount
|
* Crosssoftware class for random amount
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Sets the random addition amount
|
* Sets the random addition amount
|
||||||
* @param $amount int
|
* @param $amount int
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +34,7 @@ abstract class AmountPopulator extends Populator {
|
||||||
$this->randomAmount = $amount;
|
$this->randomAmount = $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Sets the base addition amount
|
* Sets the base addition amount
|
||||||
* @param $amount int
|
* @param $amount int
|
||||||
*/
|
*/
|
||||||
|
@ -42,24 +42,28 @@ abstract class AmountPopulator extends Populator {
|
||||||
$this->baseAmount = $amount;
|
$this->baseAmount = $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the amount based on random
|
* Returns the amount based on random
|
||||||
* @param $random Random
|
*
|
||||||
|
* @param Random $random
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getAmount(Random $random) {
|
public function getAmount(Random $random) {
|
||||||
return $this->baseAmount + $random->nextRange(0, $this->randomAmount + 1);
|
return $this->baseAmount + $random->nextRange(0, $this->randomAmount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the base amount
|
* Returns base amount
|
||||||
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getBaseAmount(): int {
|
public function getBaseAmount(): int {
|
||||||
return $this->baseAmount;
|
return $this->baseAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the random additional amount
|
* Returns the random additional amount
|
||||||
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getRandomAmount(): int {
|
public function getRandomAmount(): int {
|
||||||
|
|
|
@ -26,22 +26,26 @@ use pocketmine\utils\Random;
|
||||||
class BushPopulator extends AmountPopulator {
|
class BushPopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
/** @var int */
|
||||||
protected $type;
|
protected $type;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
* @param $type int
|
*
|
||||||
|
* @param int $type
|
||||||
*/
|
*/
|
||||||
public function __construct($type = 0) {
|
public function __construct($type = 0) {
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -59,10 +63,12 @@ class BushPopulator extends AmountPopulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the highest workable block
|
||||||
* @param $x int
|
*
|
||||||
* @param $z int
|
* @param int $x
|
||||||
|
* @param int $z
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ use pocketmine\utils\Random;
|
||||||
class CactusPopulator extends AmountPopulator {
|
class CactusPopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
@ -35,12 +35,14 @@ class CactusPopulator extends AmountPopulator {
|
||||||
$this->setRandomAmount(2);
|
$this->setRandomAmount(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$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
|
* Gets the highest workable block
|
||||||
* @param $z int
|
*
|
||||||
|
* @param int $x
|
||||||
|
* @param int $z
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y >= 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y >= 0; -- $y) {
|
||||||
|
|
|
@ -30,12 +30,14 @@ class CavePopulator extends AmountPopulator {
|
||||||
const STOP = false;
|
const STOP = false;
|
||||||
const CONTINUE = true;
|
const CONTINUE = true;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -63,10 +65,10 @@ class CavePopulator extends AmountPopulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the top block (y) on an x and z axes
|
||||||
* @param $x int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $z
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
@ -81,12 +83,13 @@ class CavePopulator extends AmountPopulator {
|
||||||
return ++$y;
|
return ++$y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Generates a cave
|
* Generates a cave
|
||||||
* @param $x int
|
*
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $z
|
||||||
|
* @param Random $random
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function generateCave($x, $y, $z, Random $random) {
|
public function generateCave($x, $y, $z, Random $random) {
|
||||||
|
@ -100,16 +103,18 @@ class CavePopulator extends AmountPopulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Generates a cave branch.
|
/**
|
||||||
* @param $x int
|
* Generates a cave branch
|
||||||
* @param $y int
|
*
|
||||||
* @param $z int
|
* @param int $x
|
||||||
* @param $length int
|
* @param int $y
|
||||||
* @param $height int
|
* @param int $z
|
||||||
* @param $depth int
|
* @param int $length
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $height
|
||||||
* @yield int
|
* @param int $depth
|
||||||
|
* @param Random $random
|
||||||
|
* @yield Vector3
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function generateBranch($x, $y, $z, $length, $height, $depth, Random $random) {
|
public function generateBranch($x, $y, $z, $length, $height, $depth, Random $random) {
|
||||||
|
|
|
@ -28,12 +28,14 @@ class DeadbushPopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
|
|
@ -28,9 +28,9 @@ class FallenTreePopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
protected $type;
|
protected $type;
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
* @param $type int
|
* @param int $type
|
||||||
*/
|
*/
|
||||||
public function __construct(int $type = 0) {
|
public function __construct(int $type = 0) {
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
@ -38,12 +38,14 @@ class FallenTreePopulator extends AmountPopulator {
|
||||||
$this->setRandomAmount(2);
|
$this->setRandomAmount(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
|
|
@ -35,17 +35,18 @@ use pocketmine\utils\Random;
|
||||||
|
|
||||||
|
|
||||||
class FloatingIslandPopulator extends AmountPopulator {
|
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 */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
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) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
if($this->getAmount($random) > 130) {
|
if($this->getAmount($random) > 130) {
|
||||||
|
@ -66,10 +67,10 @@ class FloatingIslandPopulator extends AmountPopulator {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the top block (y) on an x and z axes
|
||||||
* @param $x int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $z
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
@ -86,13 +87,14 @@ class FloatingIslandPopulator extends AmountPopulator {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Builds a an island shape
|
* Builds an island bottom shape
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $radius int
|
* @param Vector3 $pos
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $radius
|
||||||
* @return int lowest ore point
|
* @param Random $random
|
||||||
|
* @return int Bottom place of the island
|
||||||
*/
|
*/
|
||||||
public function buildIslandBottomShape(ChunkManager $level, Vector3 $pos, int $radius, Random $random) {
|
public function buildIslandBottomShape(ChunkManager $level, Vector3 $pos, int $radius, Random $random) {
|
||||||
$pos = $pos->round();
|
$pos = $pos->round();
|
||||||
|
@ -137,14 +139,15 @@ class FloatingIslandPopulator extends AmountPopulator {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* BPopulate the island with ores
|
* Populates the island with ores
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $width int
|
* @param Vector3 $pos
|
||||||
* @param $height int
|
* @param int $width
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $height
|
||||||
* @return void
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populateOres(ChunkManager $level, Vector3 $pos, int $width, int $height, Random $random) {
|
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();
|
$ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore();
|
||||||
|
|
|
@ -25,12 +25,15 @@ class IglooPopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
|
||||||
/*
|
|
||||||
* Populate the chunk
|
/**
|
||||||
* @param $level pocketmine\level\ChunkManager
|
* Populates the chunk
|
||||||
* @param $chunkX int
|
*
|
||||||
* @param $chunkZ int
|
* @param ChunkManager $level
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkX
|
||||||
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -44,10 +47,10 @@ class IglooPopulator extends AmountPopulator {
|
||||||
$igloo->placeObject($level, $x, $y, $z, $random);
|
$igloo->placeObject($level, $x, $y, $z, $random);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the top block (y) on an x and z axes
|
||||||
* @param $x int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $z
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
|
|
@ -28,12 +28,15 @@ class LakePopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
|
||||||
/*
|
|
||||||
* Populate the chunk
|
/**
|
||||||
* @param $level pocketmine\level\ChunkManager
|
* Populates the chunk
|
||||||
* @param $chunkX int
|
*
|
||||||
* @param $chunkZ int
|
* @param ChunkManager $level
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkX
|
||||||
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -55,10 +58,10 @@ class LakePopulator extends AmountPopulator {
|
||||||
$level->setBlockIdAt($xx, $yy, $zz, Block::AIR);
|
$level->setBlockIdAt($xx, $yy, $zz, Block::AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the top block (y) on an x and z axes
|
||||||
* @param $x int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $z
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ use pocketmine\math\Vector3;
|
||||||
use pocketmine\utils\Random;
|
use pocketmine\utils\Random;
|
||||||
|
|
||||||
class MineshaftPopulator extends AmountPopulator {
|
class MineshaftPopulator extends AmountPopulator {
|
||||||
|
/** var int */
|
||||||
protected $maxPath;
|
protected $maxPath;
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
@ -36,12 +37,14 @@ class MineshaftPopulator extends AmountPopulator {
|
||||||
const TYPE_CROSSPATH = 1;
|
const TYPE_CROSSPATH = 1;
|
||||||
const TYPE_STAIRS = 2;
|
const TYPE_STAIRS = 2;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
if ($this->getAmount($random) < 100)
|
if ($this->getAmount($random) < 100)
|
||||||
|
|
|
@ -28,12 +28,14 @@ class RavinePopulator extends AmountPopulator {
|
||||||
protected $level;
|
protected $level;
|
||||||
const NOISE = 250;
|
const NOISE = 250;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -90,14 +92,16 @@ class RavinePopulator extends AmountPopulator {
|
||||||
return ++$y;
|
return ++$y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Builds a ravine part
|
* Buidls a ravine part
|
||||||
* @param $x int
|
*
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $height int
|
* @param int $z
|
||||||
* @param $length int
|
* @param int $height
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $length
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function buildRavinePart($x, $y, $z, $height, $length, Random $random) {
|
protected function buildRavinePart($x, $y, $z, $height, $length, Random $random) {
|
||||||
$xBounded = 0;
|
$xBounded = 0;
|
||||||
|
|
|
@ -26,6 +26,7 @@ use pocketmine\utils\Random;
|
||||||
class SugarCanePopulator extends AmountPopulator {
|
class SugarCanePopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
*/
|
*/
|
||||||
|
@ -35,11 +36,13 @@ class SugarCanePopulator extends AmountPopulator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
|
|
@ -27,12 +27,14 @@ class TemplePopulator extends AmountPopulator {
|
||||||
/** @var Level */
|
/** @var Level */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Populate the chunk
|
* Populates the chunk
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $chunkX int
|
* @param ChunkManager $level
|
||||||
* @param $chunkZ int
|
* @param int $chunkX
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -46,10 +48,10 @@ class TemplePopulator extends AmountPopulator {
|
||||||
$temple->placeObject($level, $x, $y - 1, $z, $random);
|
$temple->placeObject($level, $x, $y - 1, $z, $random);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the top block (y) on an x and z axes
|
||||||
* @param $x int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $z
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
|
|
@ -34,9 +34,10 @@ class TreePopulator extends AmountPopulator {
|
||||||
];
|
];
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
/** @var int */
|
||||||
protected $type;
|
protected $type;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
*/
|
*/
|
||||||
public function __construct($type = 0) {
|
public function __construct($type = 0) {
|
||||||
|
@ -50,12 +51,15 @@ class TreePopulator extends AmountPopulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Populate the chunk
|
/**
|
||||||
* @param $level pocketmine\level\ChunkManager
|
* Populates the chunk
|
||||||
* @param $chunkX int
|
*
|
||||||
* @param $chunkZ int
|
* @param ChunkManager $level
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkX
|
||||||
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -74,10 +78,10 @@ class TreePopulator extends AmountPopulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the top block (y) on an x and z axes
|
||||||
* @param $x int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $z
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
|
|
@ -27,12 +27,15 @@ class WellPopulator extends AmountPopulator {
|
||||||
/** @var ChunkManager */
|
/** @var ChunkManager */
|
||||||
protected $level;
|
protected $level;
|
||||||
|
|
||||||
/*
|
|
||||||
* Populate the chunk
|
/**
|
||||||
* @param $level pocketmine\level\ChunkManager
|
* Populates the chunk
|
||||||
* @param $chunkX int
|
*
|
||||||
* @param $chunkZ int
|
* @param ChunkManager $level
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $chunkX
|
||||||
|
* @param int $chunkZ
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -46,10 +49,10 @@ class WellPopulator extends AmountPopulator {
|
||||||
$well->placeObject($level, $x, $y, $z, $random);
|
$well->placeObject($level, $x, $y, $z, $random);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Gets the top block (y) on an x and z axes
|
* Gets the top block (y) on an x and z axes
|
||||||
* @param $x int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $z
|
||||||
*/
|
*/
|
||||||
protected function getHighestWorkableBlock($x, $z) {
|
protected function getHighestWorkableBlock($x, $z) {
|
||||||
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
|
||||||
|
|
|
@ -30,13 +30,16 @@ class Bush extends Object {
|
||||||
Block::SNOW_LAYER => true,
|
Block::SNOW_LAYER => true,
|
||||||
Block::LOG2 => true
|
Block::LOG2 => true
|
||||||
];
|
];
|
||||||
|
/** @var int[] */
|
||||||
protected $leaf;
|
protected $leaf;
|
||||||
|
/** @var int */
|
||||||
protected $height;
|
protected $height;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
* @param $leafId int
|
*
|
||||||
* @param $leafData int
|
* @param int $leafId
|
||||||
|
* @param int $leafData
|
||||||
*/
|
*/
|
||||||
public function __construct($leafId = Block::LEAVES, $leafData = 0) {
|
public function __construct($leafId = Block::LEAVES, $leafData = 0) {
|
||||||
$this->leaf = [
|
$this->leaf = [
|
||||||
|
@ -45,13 +48,15 @@ class Bush extends Object {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a bush
|
* Places a bush
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $z
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
$number = $random->nextBoundedInt(6);
|
$number = $random->nextBoundedInt(6);
|
||||||
|
@ -67,12 +72,14 @@ class Bush extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a leaf
|
* Places a leaf
|
||||||
* @param $x int
|
*
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $level pocketmine\level\ChunkManager
|
* @param int $z
|
||||||
|
* @param ChunkManager $level
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeLeaf($x, $y, $z, ChunkManager $level) {
|
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)])) {
|
if (isset($this->overridable[$level->getBlockIdAt($x, $y, $z)]) && ! isset($this->overridable[$level->getBlockIdAt($x, $y - 1, $z)])) {
|
||||||
|
|
|
@ -24,16 +24,18 @@ use pocketmine\utils\Random;
|
||||||
|
|
||||||
class Cactus extends Object {
|
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;
|
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 {
|
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random): bool {
|
||||||
$this->totalHeight = 1 + $random->nextBoundedInt(3);
|
$this->totalHeight = 1 + $random->nextBoundedInt(3);
|
||||||
$below = $level->getBlockIdAt($x, $y - 1, $z);
|
$below = $level->getBlockIdAt($x, $y - 1, $z);
|
||||||
|
@ -45,12 +47,14 @@ class Cactus extends Object {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a cactus
|
* Places a cactus
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
|
* @param int $z
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, int $x, int $y, int $z) {
|
public function placeObject(ChunkManager $level, int $x, int $y, int $z) {
|
||||||
for($yy = 0; $yy < $this->totalHeight; $yy ++) {
|
for($yy = 0; $yy < $this->totalHeight; $yy ++) {
|
||||||
|
|
|
@ -39,27 +39,33 @@ class FallenTree extends Object {
|
||||||
Block::LEAVES2 => true,
|
Block::LEAVES2 => true,
|
||||||
Block::CACTUS => true
|
Block::CACTUS => true
|
||||||
];
|
];
|
||||||
|
/** @var Tree */
|
||||||
protected $tree;
|
protected $tree;
|
||||||
|
/** @var int */
|
||||||
protected $direction;
|
protected $direction;
|
||||||
|
/** @var Random */
|
||||||
protected $random;
|
protected $random;
|
||||||
|
/** @var int */
|
||||||
protected $length = 0;
|
protected $length = 0;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
* @param $tree ObjectTree
|
*
|
||||||
* @throws Exeption
|
* @param ObjectTree $tree
|
||||||
*/
|
*/
|
||||||
public function __construct(ObjectTree $tree) {
|
public function __construct(ObjectTree $tree) {
|
||||||
$this->tree = $tree;
|
$this->tree = $tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a fallen tree
|
* Checks the placement a fallen tree
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $z
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
echo "Checking at $x $y $z FallenTree\n";
|
echo "Checking at $x $y $z FallenTree\n";
|
||||||
|
@ -106,12 +112,14 @@ class FallenTree extends Object {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a fallen tree
|
* Places a fallen tree
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
|
* @param int $z
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, $x, $y, $z) {
|
public function placeObject(ChunkManager $level, $x, $y, $z) {
|
||||||
echo "Placing at $x $y $z FallenTree D: $this->direction, L: $this->length\n";
|
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
|
* Places a block
|
||||||
* @param $x int
|
*
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $level pocketmine\level\ChunkManager
|
* @param int $z
|
||||||
|
* @param ChunkManager $level
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeBlock($x, $y, $z, ChunkManager $level) {
|
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)])) {
|
if (isset(self::$overridable[$level->getBlockIdAt($x, $y, $z)]) && ! isset(self::$overridable[$level->getBlockIdAt($x, $y - 1, $z)])) {
|
||||||
|
|
|
@ -34,16 +34,18 @@ class Igloo extends Object {
|
||||||
Block::LOG2 => true,
|
Block::LOG2 => true,
|
||||||
Block::LEAVES2 => true
|
Block::LEAVES2 => true
|
||||||
];
|
];
|
||||||
|
/** @var int */
|
||||||
protected $direction;
|
protected $direction;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Checks if an igloo is placeable
|
* Checks if an igloo is placable
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $z
|
||||||
* @return bool
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
$this->direction = $random->nextBoundedInt(4);
|
$this->direction = $random->nextBoundedInt(4);
|
||||||
|
@ -80,14 +82,15 @@ class Igloo extends Object {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places an igloo
|
* Places an igloo
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $z
|
||||||
* @return bool placed
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
if (! isset($this->direction) && ! $this->canPlaceObject($level, $x, $y, $z, $random))
|
if (! isset($this->direction) && ! $this->canPlaceObject($level, $x, $y, $z, $random))
|
||||||
|
|
|
@ -443,12 +443,14 @@ class SakuraTree extends Tree {
|
||||||
];
|
];
|
||||||
const maxPerChunk = 2;
|
const maxPerChunk = 2;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
public $trunkHeight = 11;
|
public $trunkHeight = 11;
|
||||||
|
/** @var int */
|
||||||
public $leafType;
|
public $leafType;
|
||||||
|
/** @var int */
|
||||||
public $leaf2Type;
|
public $leaf2Type;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructs the class
|
* Constructs the class
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
@ -460,13 +462,15 @@ class SakuraTree extends Tree {
|
||||||
$this->type = Wood::OAK;
|
$this->type = Wood::OAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Builds the tree.
|
* Builds a tree
|
||||||
* @param $level \pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random $random
|
* @param int $z
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
$percentage = $random->nextBoundedInt(100);
|
$percentage = $random->nextBoundedInt(100);
|
||||||
|
@ -572,9 +576,7 @@ class SakuraTree extends Tree {
|
||||||
$totalLength = $stickLen + $stickLen2; // Length of the stick
|
$totalLength = $stickLen + $stickLen2; // Length of the stick
|
||||||
$sideLen = $totalLength ** 2; // Side length
|
$sideLen = $totalLength ** 2; // Side length
|
||||||
|
|
||||||
//TODO CHECK WHAT THIS IS SUPPOSED TO BE
|
|
||||||
$numForward = ($totalLength % 2 == 0) ? $totalLength - 1 : $totalLength;
|
$numForward = ($totalLength % 2 == 0) ? $totalLength - 1 : $totalLength;
|
||||||
//TODO END
|
|
||||||
$lX1 = $lZ1 = $lX = $lZ = 0;
|
$lX1 = $lZ1 = $lX = $lZ = 0;
|
||||||
|
|
||||||
// First branch part + first leave part
|
// First branch part + first leave part
|
||||||
|
@ -624,8 +626,6 @@ class SakuraTree extends Tree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// continue;
|
|
||||||
|
|
||||||
switch ($dir + 1) {
|
switch ($dir + 1) {
|
||||||
case 4 :
|
case 4 :
|
||||||
$xd2 = 0;
|
$xd2 = 0;
|
||||||
|
@ -659,25 +659,29 @@ class SakuraTree extends Tree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Fills a log at.
|
* Fills a log
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
|
* @param int $z
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setLog(ChunkManager $level, $x, $y, $z) {
|
public function setLog(ChunkManager $level, $x, $y, $z) {
|
||||||
$level->setBlockIdAt($x, $y, $z, $this->trunkBlock);
|
$level->setBlockIdAt($x, $y, $z, $this->trunkBlock);
|
||||||
$level->setBlockDataAt($x, $y, $z, $this->type);
|
$level->setBlockDataAt($x, $y, $z, $this->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Fills a leave at.
|
* Fills leaves
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $z
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setLeave(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function setLeave(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
$data = [
|
$data = [
|
||||||
|
|
|
@ -25,16 +25,18 @@ use pocketmine\utils\Random;
|
||||||
|
|
||||||
class SugarCane extends Object {
|
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;
|
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 {
|
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random): bool {
|
||||||
$this->totalHeight = 1 + $random->nextBoundedInt(3);
|
$this->totalHeight = 1 + $random->nextBoundedInt(3);
|
||||||
$below = $level->getBlockIdAt($x, $y - 1, $z);
|
$below = $level->getBlockIdAt($x, $y - 1, $z);
|
||||||
|
@ -44,12 +46,14 @@ class SugarCane extends Object {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a cactus
|
* Places a sugar cane
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
|
* @param int $z
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, int $x, int $y, int $z) {
|
public function placeObject(ChunkManager $level, int $x, int $y, int $z) {
|
||||||
for($yy = 0; $yy < $this->totalHeight; $yy ++) {
|
for($yy = 0; $yy < $this->totalHeight; $yy ++) {
|
||||||
|
|
|
@ -114,16 +114,17 @@ class Temple extends Object {
|
||||||
protected $level;
|
protected $level;
|
||||||
protected $direction = 0;
|
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) {
|
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
$this->direction = $random->nextBoundedInt(4);
|
$this->direction = $random->nextBoundedInt(4);
|
||||||
|
@ -135,13 +136,15 @@ class Temple extends Object {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a temple
|
* Builds a temple
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random pocketmine\utils\Random
|
* @param int $z
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
// Clearing space...
|
// Clearing space...
|
||||||
|
@ -157,26 +160,13 @@ class Temple extends Object {
|
||||||
|
|
||||||
// Floor top
|
// 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));
|
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
|
// 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));
|
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
|
// 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));
|
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
|
//Floor bottom
|
||||||
BuildingUtils::fill($level, new Vector3($x - 9, $y, $z - 9), new Vector3($x + 9, $y, $z + 9), Block::get(Block::SANDSTONE));
|
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
|
// Floor pattern
|
||||||
for ($i = -2; $i <= 1; $i++) {//straight
|
for ($i = -2; $i <= 1; $i++) {//straight
|
||||||
$xextra = ($i + 1) % 2;
|
$xextra = ($i + 1) % 2;
|
||||||
|
|
|
@ -58,14 +58,15 @@ class Well extends Object {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Checks if a well is placeable
|
* Checks if a Well is placable
|
||||||
* @param $level ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random Random
|
* @param int $z
|
||||||
* @return bool
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -77,13 +78,15 @@ class Well extends Object {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a well
|
* Places a well
|
||||||
* @param $level ChunkManager
|
*
|
||||||
* @param $x int
|
* @param ChunkManager $level
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $random Random
|
* @param int $z
|
||||||
|
* @param Random $random
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
@ -114,12 +117,14 @@ class Well extends Object {
|
||||||
$this->placeBlock($x, $y, $z, Block::WATER);
|
$this->placeBlock($x, $y, $z, Block::WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Places a slab
|
* Places a block
|
||||||
* @param $x int
|
*
|
||||||
* @param $y int
|
* @param int $x
|
||||||
* @param $z int
|
* @param int $y
|
||||||
* @param $id int
|
* @param int $z
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function placeBlock($x, $y, $z, $id = 0, $meta = 0) {
|
public function placeBlock($x, $y, $z, $id = 0, $meta = 0) {
|
||||||
|
|
|
@ -33,12 +33,13 @@ class BuildingUtils {
|
||||||
Block::PLANK
|
Block::PLANK
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Fills an area
|
* Fills an area
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
* @param $block pocketmine\block\Block
|
* @param Vector3 $pos2
|
||||||
|
* @param Block $block
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function fill(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block = null) {
|
public static function fill(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block = null) {
|
||||||
|
@ -51,14 +52,15 @@ class BuildingUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Fills an area randomly
|
* Fills an area randomly
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
* @param $block pocketmine\block\Block
|
* @param Vector3 $pos2
|
||||||
* @param $random pocketmine\utils
|
* @param Block $block
|
||||||
* @param $randMax pocketmine\utils
|
* @param Random $random
|
||||||
|
* @param int $randMax
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function fillRandom(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block = null, Random $random = null, $randMax = 3) {
|
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
|
* Custom area filling
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
*
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
* @param $call callback
|
* @param Vector3 $pos2
|
||||||
* @param $params array
|
* @param callable $call
|
||||||
|
* @param array $params
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function fillCallback(Vector3 $pos1, Vector3 $pos2, callable $call, ...$params) : array {
|
public static function fillCallback(Vector3 $pos1, Vector3 $pos2, callable $call, ...$params) : array {
|
||||||
|
@ -87,12 +90,13 @@ class BuildingUtils {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Creates walls
|
* Creates walls
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
* @param $block pocketmine\block\Block
|
* @param Vector3 $pos2
|
||||||
|
* @param Block $block
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function walls(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
|
public static function walls(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
|
||||||
|
@ -113,12 +117,13 @@ class BuildingUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Creates the top of a structure
|
* Creates the top of a structure
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
* @param $block pocketmine\block\Block
|
* @param Vector3 $pos2
|
||||||
|
* @param Block $block
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function top(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
|
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.
|
* Creates the corners of the structures. Used for mineshaft "towers"
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
* @param $block pocketmine\block\Block
|
* @param Vector3 $pos2
|
||||||
|
* @param Block $block
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function corners(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
|
public static function corners(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
|
||||||
|
@ -152,12 +158,13 @@ class BuildingUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Creates the bottom of a structure
|
* Fills the bottom of a structure
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
* @param $block pocketmine\block\Block
|
* @param Vector3 $pos2
|
||||||
|
* @param Block $block
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function bottom(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
|
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
|
* Builds a structure randomly based on a circle algorithm. Used in caves and lakes.
|
||||||
* @param $level pocketmine\level\ChunkManager
|
*
|
||||||
* @param $pos pocketmine\math\Vector3
|
* @param ChunkManager $level
|
||||||
* @param $infos pocketmine\math\Vector3
|
* @param Vector3 $pos
|
||||||
* @param $random pocketmine\utils\Random
|
* @param Vector3 $infos
|
||||||
* @param $block pocketmine\block\Block
|
* @param Random $random
|
||||||
|
* @param Block $block
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function buildRandom(ChunkManager $level, Vector3 $pos, Vector3 $infos, Random $random, Block $block) {
|
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.
|
* Returns two Vector three, the biggest and lowest ones based on two provided vectors
|
||||||
* @param $pos1 pocketmine\math\Vector3
|
*
|
||||||
* @param $pos2 pocketmine\math\Vector3
|
* @param Vector3 $pos1
|
||||||
|
* @param Vector3 $pos2
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected static function minmax(Vector3 $pos1, Vector3 $pos2): array {
|
protected static function minmax(Vector3 $pos1, Vector3 $pos2): array {
|
||||||
|
|
Loading…
Reference in a new issue