From be6965b90987272408e4ee8fafdc081807d2897a Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Sat, 13 May 2017 23:27:10 +0200 Subject: [PATCH] Fixed formating. --- src/Ad5001/BetterGen/biome/BetterDesert.php | 34 ++-- src/Ad5001/BetterGen/biome/BetterForest.php | 8 +- .../BetterGen/biome/BetterIcePlains.php | 10 +- src/Ad5001/BetterGen/biome/BetterMesa.php | 90 +++++------ .../BetterGen/biome/BetterMesaPlains.php | 92 +++++------ src/Ad5001/BetterGen/biome/BetterRiver.php | 22 +-- .../generator/BetterBiomeSelector.php | 8 +- .../BetterGen/generator/BetterNormal.php | 94 +++++------ .../BetterGen/populator/CactusPopulator.php | 2 +- .../BetterGen/populator/CavePopulator.php | 41 +++-- .../BetterGen/populator/DeadbushPopulator.php | 2 +- .../populator/FallenTreePopulator.php | 2 +- .../populator/FloatingIslandPopulator.php | 4 +- .../BetterGen/populator/IglooPopulator.php | 6 +- .../BetterGen/populator/LakePopulator.php | 6 +- .../populator/MineshaftPopulator.php | 152 +++++++++--------- .../BetterGen/populator/RavinePopulator.php | 22 +-- .../populator/SugarCanePopulator.php | 2 +- .../BetterGen/populator/TemplePopulator.php | 4 +- .../BetterGen/populator/WellPopulator.php | 6 +- src/Ad5001/BetterGen/structure/Bush.php | 2 +- src/Ad5001/BetterGen/structure/Cactus.php | 4 +- src/Ad5001/BetterGen/structure/FallenTree.php | 2 +- src/Ad5001/BetterGen/structure/Igloo.php | 18 +-- src/Ad5001/BetterGen/structure/SakuraTree.php | 2 +- src/Ad5001/BetterGen/structure/SugarCane.php | 4 +- src/Ad5001/BetterGen/structure/Well.php | 4 +- src/Ad5001/BetterGen/utils/BuildingUtils.php | 28 ++-- 28 files changed, 335 insertions(+), 336 deletions(-) diff --git a/src/Ad5001/BetterGen/biome/BetterDesert.php b/src/Ad5001/BetterGen/biome/BetterDesert.php index ee5e2e7..4816f3e 100644 --- a/src/Ad5001/BetterGen/biome/BetterDesert.php +++ b/src/Ad5001/BetterGen/biome/BetterDesert.php @@ -53,23 +53,23 @@ class BetterDesert extends SandyBiome implements Mountainable { $this->temperature = 0.5; $this->rainfall = 0; $this->setGroundCover([ - Block::get(Block::SAND, 0 ), - Block::get(Block::SAND, 0 ), - Block::get(Block::SAND, 0 ), - Block::get(Block::SAND, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ) + Block::get(Block::SAND, 0), + Block::get(Block::SAND, 0), + Block::get(Block::SAND, 0), + Block::get(Block::SAND, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0) ]); } public function getName(): string { diff --git a/src/Ad5001/BetterGen/biome/BetterForest.php b/src/Ad5001/BetterGen/biome/BetterForest.php index 8e74035..d657542 100644 --- a/src/Ad5001/BetterGen/biome/BetterForest.php +++ b/src/Ad5001/BetterGen/biome/BetterForest.php @@ -50,7 +50,7 @@ class BetterForest extends ForestBiome implements Mountainable { $this->addPopulator($ft); $trees = new TreePopulator($type); - $trees->setBaseAmount((null !== @constant(TreePopulator::$types [$type] . "::maxPerChunk" )) ? constant(TreePopulator::$types [$type] . "::maxPerChunk" ) : 5); + $trees->setBaseAmount((null !== @constant(TreePopulator::$types [$type] . "::maxPerChunk")) ? constant(TreePopulator::$types [$type] . "::maxPerChunk") : 5); $this->addPopulator($trees); $tallGrass = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\TallGrass () : new \pocketmine\level\generator\populator\TallGrass(); @@ -81,10 +81,10 @@ class BetterForest extends ForestBiome implements Mountainable { * @return bool */ public static function registerForest(string $name, string $treeClass, array $infos): bool { - self::$types [] = str_ireplace("tree", "", explode("\\", $treeClass ) [count(explode("\\", $treeClass ) )] ) . " Forest"; + self::$types [] = str_ireplace("tree", "", explode("\\", $treeClass) [count(explode("\\", $treeClass))]) . " Forest"; TreePopulator::$types [] = $treeClass; - self::$ids [] = Main::SAKURA_FOREST + (count(self::$types ) - 2); - Main::register(Main::SAKURA_FOREST + (count(self::$types ) - 2), new BetterForest(count(self::$types ) - 1, $infos )); + self::$ids [] = Main::SAKURA_FOREST + (count(self::$types) - 2); + Main::register(Main::SAKURA_FOREST + (count(self::$types) - 2), new BetterForest(count(self::$types) - 1, $infos)); return true; } } \ No newline at end of file diff --git a/src/Ad5001/BetterGen/biome/BetterIcePlains.php b/src/Ad5001/BetterGen/biome/BetterIcePlains.php index 6700eae..edf960c 100644 --- a/src/Ad5001/BetterGen/biome/BetterIcePlains.php +++ b/src/Ad5001/BetterGen/biome/BetterIcePlains.php @@ -24,11 +24,11 @@ class BetterIcePlains extends SnowyBiome implements Mountainable { public function __construct() { parent::__construct (); $this->setGroundCover([ - Block::get(Block::SNOW, 0 ), - Block::get(Block::GRASS, 0 ), - Block::get(Block::DIRT, 0 ), - Block::get(Block::DIRT, 0 ), - Block::get(Block::DIRT, 0 ) + Block::get(Block::SNOW, 0), + Block::get(Block::GRASS, 0), + Block::get(Block::DIRT, 0), + Block::get(Block::DIRT, 0), + Block::get(Block::DIRT, 0) ]); $this->addPopulator(new IglooPopulator ()); diff --git a/src/Ad5001/BetterGen/biome/BetterMesa.php b/src/Ad5001/BetterGen/biome/BetterMesa.php index e82460b..63f1145 100644 --- a/src/Ad5001/BetterGen/biome/BetterMesa.php +++ b/src/Ad5001/BetterGen/biome/BetterMesa.php @@ -44,7 +44,7 @@ class BetterMesa extends SandyBiome { $ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore(); $ores->setOreTypes([ - Main::isOtherNS() ? new \pocketmine\level\generator\normal\object\OreType(new GoldOre (), 2, 8, 0, 32 ) : new \pocketmine\level\generator\object\OreType(new GoldOre (), 2, 8, 0, 32 ) + Main::isOtherNS() ? new \pocketmine\level\generator\normal\object\OreType(new GoldOre (), 2, 8, 0, 32) : new \pocketmine\level\generator\object\OreType(new GoldOre (), 2, 8, 0, 32) ]); $this->addPopulator($cactus); @@ -58,50 +58,50 @@ class BetterMesa extends SandyBiome { $this->temperature = 0.8; $this->rainfall = 0; $this->setGroundCover([ - Block::get(Block::DIRT, 0 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 7 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 12 ), - Block::get(Block::STAINED_HARDENED_CLAY, 12 ), - Block::get(Block::STAINED_HARDENED_CLAY, 12 ), - Block::get(Block::STAINED_HARDENED_CLAY, 14 ), - Block::get(Block::STAINED_HARDENED_CLAY, 14 ), - Block::get(Block::STAINED_HARDENED_CLAY, 14 ), - Block::get(Block::STAINED_HARDENED_CLAY, 4 ), - Block::get(Block::STAINED_HARDENED_CLAY, 7 ), - Block::get(Block::STAINED_HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 7 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ) + Block::get(Block::DIRT, 0), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 7), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 12), + Block::get(Block::STAINED_HARDENED_CLAY, 12), + Block::get(Block::STAINED_HARDENED_CLAY, 12), + Block::get(Block::STAINED_HARDENED_CLAY, 14), + Block::get(Block::STAINED_HARDENED_CLAY, 14), + Block::get(Block::STAINED_HARDENED_CLAY, 14), + Block::get(Block::STAINED_HARDENED_CLAY, 4), + Block::get(Block::STAINED_HARDENED_CLAY, 7), + Block::get(Block::STAINED_HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 7), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0) ]); } public function getName(): string { diff --git a/src/Ad5001/BetterGen/biome/BetterMesaPlains.php b/src/Ad5001/BetterGen/biome/BetterMesaPlains.php index 610e972..b349469 100644 --- a/src/Ad5001/BetterGen/biome/BetterMesaPlains.php +++ b/src/Ad5001/BetterGen/biome/BetterMesaPlains.php @@ -39,7 +39,7 @@ class BetterMesaPlains extends SandyBiome { $ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore(); $ores->setOreTypes([ - Main::isOtherNS() ? new \pocketmine\level\generator\normal\object\OreType(new GoldOre (), 2, 8, 0, 32 ) : new \pocketmine\level\generator\object\OreType(new GoldOre (), 2, 8, 0, 32 ) + Main::isOtherNS() ? new \pocketmine\level\generator\normal\object\OreType(new GoldOre (), 2, 8, 0, 32) : new \pocketmine\level\generator\object\OreType(new GoldOre (), 2, 8, 0, 32) ]); $this->addPopulator($cactus); @@ -53,51 +53,51 @@ class BetterMesaPlains extends SandyBiome { $this->temperature = 0.6; $this->rainfall = 0; $this->setGroundCover([ - Block::get(Block::SAND, 1 ), - Block::get(Block::SAND, 1 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 7 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 12 ), - Block::get(Block::STAINED_HARDENED_CLAY, 12 ), - Block::get(Block::STAINED_HARDENED_CLAY, 12 ), - Block::get(Block::STAINED_HARDENED_CLAY, 14 ), - Block::get(Block::STAINED_HARDENED_CLAY, 14 ), - Block::get(Block::STAINED_HARDENED_CLAY, 14 ), - Block::get(Block::STAINED_HARDENED_CLAY, 4 ), - Block::get(Block::STAINED_HARDENED_CLAY, 7 ), - Block::get(Block::STAINED_HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 7 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::HARDENED_CLAY, 0 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::STAINED_HARDENED_CLAY, 1 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ), - Block::get(Block::RED_SANDSTONE, 0 ) + Block::get(Block::SAND, 1), + Block::get(Block::SAND, 1), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 7), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 12), + Block::get(Block::STAINED_HARDENED_CLAY, 12), + Block::get(Block::STAINED_HARDENED_CLAY, 12), + Block::get(Block::STAINED_HARDENED_CLAY, 14), + Block::get(Block::STAINED_HARDENED_CLAY, 14), + Block::get(Block::STAINED_HARDENED_CLAY, 14), + Block::get(Block::STAINED_HARDENED_CLAY, 4), + Block::get(Block::STAINED_HARDENED_CLAY, 7), + Block::get(Block::STAINED_HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 7), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::HARDENED_CLAY, 0), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::STAINED_HARDENED_CLAY, 1), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0), + Block::get(Block::RED_SANDSTONE, 0) ]); } public function getName(): string { diff --git a/src/Ad5001/BetterGen/biome/BetterRiver.php b/src/Ad5001/BetterGen/biome/BetterRiver.php index b6f7df2..7b6dabc 100644 --- a/src/Ad5001/BetterGen/biome/BetterRiver.php +++ b/src/Ad5001/BetterGen/biome/BetterRiver.php @@ -22,17 +22,17 @@ class BetterRiver extends Biome { $this->clearPopulators (); $this->setGroundCover([ - Block::get(Block::SAND, 0 ), - Block::get(Block::SAND, 0 ), - Block::get(Block::SAND, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ), - Block::get(Block::SANDSTONE, 0 ) + Block::get(Block::SAND, 0), + Block::get(Block::SAND, 0), + Block::get(Block::SAND, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0), + Block::get(Block::SANDSTONE, 0) ]); $this->setElevation(60, 60); diff --git a/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php b/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php index a87a300..77b51f3 100644 --- a/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php +++ b/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php @@ -44,10 +44,10 @@ class BetterBiomeSelector extends BiomeSelector { $this->biomes [$biome->getId ()] = $biome; } public function getTemperature($x, $z) { - return ($this->temperature->noise2D($x, $z, true ) + 1) / 2; + return ($this->temperature->noise2D($x, $z, true) + 1) / 2; } public function getRainfall($x, $z) { - return ($this->rainfall->noise2D($x, $z, true ) + 1) / 2; + return ($this->rainfall->noise2D($x, $z, true) + 1) / 2; } /** @@ -60,8 +60,8 @@ class BetterBiomeSelector extends BiomeSelector { * @return Biome */ public function pickBiome($x, $z) { - $temperature = ($this->getTemperature($x, $z )); - $rainfall = ($this->getRainfall($x, $z )); + $temperature = ($this->getTemperature($x, $z)); + $rainfall = ($this->getRainfall($x, $z)); $biomeId = BetterNormal::getBiome($temperature, $rainfall); $b = (($biomeId instanceof Biome) ? $biomeId : ($this->biomes [$biomeId] ?? $this->fallback)); diff --git a/src/Ad5001/BetterGen/generator/BetterNormal.php b/src/Ad5001/BetterGen/generator/BetterNormal.php index 05bfbb9..f33d3bf 100644 --- a/src/Ad5001/BetterGen/generator/BetterNormal.php +++ b/src/Ad5001/BetterGen/generator/BetterNormal.php @@ -99,7 +99,7 @@ class BetterNormal extends Generator { } $b = $this->selector->pickBiome($x + $xNoise - 1, $z + $zNoise - 1); - if ($b instanceof Mountainable && $this->random->nextBoundedInt(1000 ) < 3) { + if ($b instanceof Mountainable && $this->random->nextBoundedInt(1000) < 3) { $b = clone $b; // $b->setElevation($b->getMinElevation () + (50 * $b->getMinElevation () / 100), $b->getMaxElevation () + (50 * $b->getMinElevation () / 100)); } @@ -122,35 +122,35 @@ class BetterNormal extends Generator { $this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 32); $this->random->setSeed($this->level->getSeed ()); - $this->registerBiome(Biome::getBiome(Biome::OCEAN )); - $this->registerBiome(Biome::getBiome(Biome::PLAINS )); + $this->registerBiome(Biome::getBiome(Biome::OCEAN)); + $this->registerBiome(Biome::getBiome(Biome::PLAINS)); $this->registerBiome(new BetterDesert ()); $this->registerBiome(new BetterMesa ()); $this->registerBiome(new BetterMesaPlains ()); - $this->registerBiome(Biome::getBiome(Biome::TAIGA )); - $this->registerBiome(Biome::getBiome(Biome::SWAMP )); + $this->registerBiome(Biome::getBiome(Biome::TAIGA)); + $this->registerBiome(Biome::getBiome(Biome::SWAMP)); $this->registerBiome(new BetterRiver ()); $this->registerBiome(new BetterIcePlains ()); $this->registerBiome(new BetterForest(0, [ 0.6, 0.5 - ] )); + ])); $this->registerBiome(new BetterForest(1, [ 0.7, 0.8 - ] )); + ])); $this->registerBiome(new BetterForest(2, [ 0.6, 0.4 - ] )); + ])); $this->selector = new BetterBiomeSelector($random, [ self::class, "getBiome" - ], self::getBiome(0, 0 )); + ], self::getBiome(0, 0)); - foreach(self::$biomes as $rain ) { - foreach($rain as $biome ) { + foreach(self::$biomes as $rain) { + foreach($rain as $biome) { $this->selector->addBiome($biome); } } @@ -189,24 +189,24 @@ class BetterNormal extends Generator { $ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore(); if(Main::isOtherNS()) $ores->setOreTypes([ - new OreType2(new CoalOre (), 20, 16, 0, 128 ), - new OreType2(new IronOre (), 20, 8, 0, 64 ), - new OreType2(new RedstoneOre (), 8, 7, 0, 16 ), - new OreType2(new LapisOre (), 1, 6, 0, 32 ), - new OreType2(new GoldOre (), 2, 8, 0, 32 ), - new OreType2(new DiamondOre (), 1, 7, 0, 16 ), - new OreType2(new Dirt (), 20, 32, 0, 128 ), - new OreType2(new Gravel (), 10, 16, 0, 128 ) + new OreType2(new CoalOre (), 20, 16, 0, 128), + new OreType2(new IronOre (), 20, 8, 0, 64), + new OreType2(new RedstoneOre (), 8, 7, 0, 16), + new OreType2(new LapisOre (), 1, 6, 0, 32), + new OreType2(new GoldOre (), 2, 8, 0, 32), + new OreType2(new DiamondOre (), 1, 7, 0, 16), + new OreType2(new Dirt (), 20, 32, 0, 128), + new OreType2(new Gravel (), 10, 16, 0, 128) ]); if(!Main::isOtherNS()) $ores->setOreTypes([ - new OreType(new CoalOre (), 20, 16, 0, 128 ), - new OreType(new IronOre (), 20, 8, 0, 64 ), - new OreType(new RedstoneOre (), 8, 7, 0, 16 ), - new OreType(new LapisOre (), 1, 6, 0, 32 ), - new OreType(new GoldOre (), 2, 8, 0, 32 ), - new OreType(new DiamondOre (), 1, 7, 0, 16 ), - new OreType(new Dirt (), 20, 32, 0, 128 ), - new OreType(new Gravel (), 10, 16, 0, 128 ) + new OreType(new CoalOre (), 20, 16, 0, 128), + new OreType(new IronOre (), 20, 8, 0, 64), + new OreType(new RedstoneOre (), 8, 7, 0, 16), + new OreType(new LapisOre (), 1, 6, 0, 32), + new OreType(new GoldOre (), 2, 8, 0, 32), + new OreType(new DiamondOre (), 1, 7, 0, 16), + new OreType(new Dirt (), 20, 32, 0, 128), + new OreType(new Gravel (), 10, 16, 0, 128) ]); $this->populators [] = $ores; } @@ -220,10 +220,10 @@ class BetterNormal extends Generator { if(\Ad5001\BetterGen\utils\CommonUtils::in_arrayi($biome->getName(), self::$options["deleteBiomes"])) { return false; } - foreach(self::$levels as $lvl ) if(isset($lvl->selector)) $lvl->selector->addBiome($biome); // If no selector created, it would cause errors. These will be added when selectoes - if (! isset(self::$biomes[(string) $biome->getRainfall ()] )) self::$biomes [( string ) $biome->getRainfall ()] = [ ]; - self::$biomes [( string ) $biome->getRainfall ()] [( string ) $biome->getTemperature ()] = $biome; - ksort(self::$biomes [( string ) $biome->getRainfall ()]); + foreach(self::$levels as $lvl) if(isset($lvl->selector)) $lvl->selector->addBiome($biome); // If no selector created, it would cause errors. These will be added when selectoes + if (! isset(self::$biomes[(string) $biome->getRainfall ()])) self::$biomes [( string) $biome->getRainfall ()] = [ ]; + self::$biomes [( string) $biome->getRainfall ()] [( string) $biome->getTemperature ()] = $biome; + ksort(self::$biomes [( string) $biome->getRainfall ()]); ksort(self::$biomes); self::$biomeById[$biome->getId()] = $biome; return true; @@ -236,26 +236,26 @@ class BetterNormal extends Generator { */ public static function getBiome($temperature, $rainfall) { $ret = null; - if (! isset(self::$biomes [( string ) round($rainfall, 1 )] )) { - while(! isset(self::$biomes [( string ) round($rainfall, 1 )] ) ) { - if (abs($rainfall - round($rainfall, 1 ) ) >= 0.05) + if (! isset(self::$biomes [( string) round($rainfall, 1)])) { + while(! isset(self::$biomes [( string) round($rainfall, 1)])) { + if (abs($rainfall - round($rainfall, 1)) >= 0.05) $rainfall += 0.1; - if (abs($rainfall - round($rainfall, 1 ) ) < 0.05) + if (abs($rainfall - round($rainfall, 1)) < 0.05) $rainfall -= 0.1; - if (round($rainfall, 1 ) < 0) + if (round($rainfall, 1) < 0) $rainfall = 0; - if (round($rainfall, 1 ) >= 0.9) + if (round($rainfall, 1) >= 0.9) $rainfall = 0.9; } } - $b = self::$biomes [( string ) round($rainfall, 1 )]; - foreach($b as $t => $biome ) { - if ($temperature <=(float ) $t) { + $b = self::$biomes [( string) round($rainfall, 1)]; + foreach($b as $t => $biome) { + if ($temperature <=(float) $t) { $ret = $biome; break; } } - if (is_string($ret )) { + if (is_string($ret)) { $ret = new $ret (); } return $ret; @@ -304,7 +304,7 @@ class BetterNormal extends Generator { $adjacent = $biome; } else { $index = Level::chunkHash($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz); - if (isset($biomeCache [$index] )) { + if (isset($biomeCache [$index])) { $adjacent = $biomeCache [$index]; } else { $biomeCache [$index] = $adjacent = $this->pickBiome($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz); @@ -338,7 +338,7 @@ class BetterNormal extends Generator { } } - foreach($this->generationPopulators as $populator ) { + foreach($this->generationPopulators as $populator) { $populator->populate($this->level, $chunkX, $chunkZ, $this->random); } } @@ -350,7 +350,7 @@ class BetterNormal extends Generator { */ public function populateChunk($chunkX, $chunkZ) { $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed ()); - foreach($this->populators as $populator ) { + foreach($this->populators as $populator) { $populator->populate($this->level, $chunkX, $chunkZ, $this->random); } @@ -358,12 +358,12 @@ class BetterNormal extends Generator { for($x = $chunkX; $x < $chunkX + 16; $x ++) for($z = $chunkZ; $z < $chunkZ + 16; $z ++) for($y = 1; $y < 11; $y ++) { - if (! in_array($this->level->getBlockIdAt($x, $y, $z ), self::NOT_OVERWRITABLE )) + if (! in_array($this->level->getBlockIdAt($x, $y, $z), self::NOT_OVERWRITABLE)) $this->level->setBlockIdAt($x, $y, $z, Block::LAVA); } $chunk = $this->level->getChunk($chunkX, $chunkZ); - $biome = self::getBiomeById($chunk->getBiomeId(7, 7 )); + $biome = self::getBiomeById($chunk->getBiomeId(7, 7)); $biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random); } @@ -429,7 +429,7 @@ class BetterNormal extends Generator { * Returns a safe spawn location */ 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); } /* diff --git a/src/Ad5001/BetterGen/populator/CactusPopulator.php b/src/Ad5001/BetterGen/populator/CactusPopulator.php index 9a2e28d..8475210 100644 --- a/src/Ad5001/BetterGen/populator/CactusPopulator.php +++ b/src/Ad5001/BetterGen/populator/CactusPopulator.php @@ -47,7 +47,7 @@ class CactusPopulator extends AmountPopulator { $x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15); $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15); $y = $this->getHighestWorkableBlock($x, $z); - if ($y !== -1 and $cactus->canPlaceObject($level, $x, $y, $z, $random )) { + if ($y !== -1 and $cactus->canPlaceObject($level, $x, $y, $z, $random)) { $cactus->placeObject($level, $x, $y, $z); } } diff --git a/src/Ad5001/BetterGen/populator/CavePopulator.php b/src/Ad5001/BetterGen/populator/CavePopulator.php index 8d885ce..6234aad 100644 --- a/src/Ad5001/BetterGen/populator/CavePopulator.php +++ b/src/Ad5001/BetterGen/populator/CavePopulator.php @@ -40,7 +40,7 @@ class CavePopulator extends AmountPopulator { for($i = 0; $i < $amount; $i++) { $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); - $y = $random->nextRange(10, $this->getHighestWorkableBlock($x, $z )); + $y = $random->nextRange(10, $this->getHighestWorkableBlock($x, $z)); // echo "Generating cave at $x, $y, $z." . PHP_EOL; $this->generateCave($x, $y, $z, $random); } @@ -49,8 +49,8 @@ class CavePopulator extends AmountPopulator { for($i = 0; $i < $random->nextBoundedInt(5) + 3; $i ++) { $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); - $y = $random->nextRange(10, $this->getHighestWorkableBlock($x, $z )); - if ($level->getBlockIdAt($x, $y, $z ) == Block::STONE && ($level->getBlockIdAt($x + 1, $y, $z ) == Block::AIR || $level->getBlockIdAt($x - 1, $y, $z ) == Block::AIR || $level->getBlockIdAt($x, $y, $z + 1 ) == Block::AIR || $level->getBlockIdAt($x, $y, $z - 1 ) == Block::AIR) && $level->getBlockIdAt($x, $y - 1, $z ) !== Block::AIR && $level->getBlockIdAt($x, $y + 1, $z ) !== Block::AIR) { + $y = $random->nextRange(10, $this->getHighestWorkableBlock($x, $z)); + if ($level->getBlockIdAt($x, $y, $z) == Block::STONE && ($level->getBlockIdAt($x + 1, $y, $z) == Block::AIR || $level->getBlockIdAt($x - 1, $y, $z) == Block::AIR || $level->getBlockIdAt($x, $y, $z + 1) == Block::AIR || $level->getBlockIdAt($x, $y, $z - 1) == Block::AIR) && $level->getBlockIdAt($x, $y - 1, $z) !== Block::AIR && $level->getBlockIdAt($x, $y + 1, $z) !== Block::AIR) { if ($y < 40 && $random->nextBoolean ()) { $level->setBlockIdAt($x, $y, $z, Block::LAVA); } else { @@ -87,9 +87,8 @@ class CavePopulator extends AmountPopulator { * @return void */ public function generateCave($x, $y, $z, Random $random) { - $generatedBranches = $random->nextBoundedInt(10 ) + 1; - // echo "Num of branch left => " . $generatedBranches . PHP_EOL; - foreach($gen = $this->generateBranch($x, $y, $z, 5, 3, 5, $random ) as $v3 ) { + $generatedBranches = $random->nextBoundedInt(10) + 1; + foreach($gen = $this->generateBranch($x, $y, $z, 5, 3, 5, $random) as $v3) { $generatedBranches --; if ($generatedBranches <= 0) { $gen->send(self::STOP); @@ -111,34 +110,34 @@ class CavePopulator extends AmountPopulator { * @return void */ public function generateBranch($x, $y, $z, $length, $height, $depth, Random $random) { - if (! (yield new Vector3($x, $y, $z ))) { + if (! (yield new Vector3($x, $y, $z))) { for($i = 0; $i <= 4; $i ++) { - BuildingUtils::buildRandom($this->level, new Vector3($x, $y, $z ), new Vector3($length - $i, $height - $i, $depth - $i ), $random, Block::get(Block::AIR )); - $x += round(($random->nextBoundedInt(round(30 * ($length / 10) ) + 1 ) / 10 - 2)); - $yP = $random->nextRange(- 14, 14); + BuildingUtils::buildRandom($this->level, new Vector3($x, $y, $z), new Vector3($length - $i, $height - $i, $depth - $i), $random, Block::get(Block::AIR)); + $x += round(($random->nextBoundedInt(round(30 * ($length / 10)) + 1) / 10 - 2)); + $yP = $random->nextRange(-14, 14); if ($yP > 12) { $y ++; } elseif ($yP < - 12) { $y --; } - $z += round(($random->nextBoundedInt(round(30 * ($depth / 10) ) + 1 ) / 10 - 1)); + $z += round(($random->nextBoundedInt(round(30 * ($depth / 10)) + 1) / 10 - 1)); return; } } - $repeat = $random->nextBoundedInt(25 ) + 15; - while($repeat -- > 0 ) { - BuildingUtils::buildRandom($this->level, new Vector3($x, $y, $z ), new Vector3($length, $height, $depth ), $random, Block::get(Block::AIR )); - $x += round(($random->nextBoundedInt(round(30 * ($length / 10) ) + 1 ) / 10 - 2)); + $repeat = $random->nextBoundedInt(25) + 15; + while($repeat-- > 0) { + BuildingUtils::buildRandom($this->level, new Vector3($x, $y, $z), new Vector3($length, $height, $depth), $random, Block::get(Block::AIR)); + $x += round(($random->nextBoundedInt(round(30 * ($length / 10)) + 1) / 10 - 2)); $yP = $random->nextRange(- 14, 14); if ($yP > 12) { $y ++; } elseif ($yP < - 12) { $y --; } - $z += round(($random->nextBoundedInt(round(30 * ($depth / 10) ) + 1 ) / 10 - 1)); - $height += $random->nextBoundedInt(3 ) - 1; - $length += $random->nextBoundedInt(3 ) - 1; - $depth += $random->nextBoundedInt(3 ) - 1; + $z += round(($random->nextBoundedInt(round(30 * ($depth / 10)) + 1) / 10 - 1)); + $height += $random->nextBoundedInt(3) - 1; + $length += $random->nextBoundedInt(3) - 1; + $depth += $random->nextBoundedInt(3) - 1; if ($height < 3) $height = 3; if ($length < 3) @@ -151,8 +150,8 @@ class CavePopulator extends AmountPopulator { $length = 7; if ($height < 7) $height = 7; - if ($random->nextBoundedInt(10 ) == 0) { - foreach($generator = $this->generateBranch($x, $y, $z, $length, $height, $depth, $random ) as $gen ) { + if ($random->nextBoundedInt(10) == 0) { + foreach($generator = $this->generateBranch($x, $y, $z, $length, $height, $depth, $random) as $gen) { if (! (yield $gen)) $generator->send(self::STOP); } diff --git a/src/Ad5001/BetterGen/populator/DeadbushPopulator.php b/src/Ad5001/BetterGen/populator/DeadbushPopulator.php index 6c9bcc4..a722a21 100644 --- a/src/Ad5001/BetterGen/populator/DeadbushPopulator.php +++ b/src/Ad5001/BetterGen/populator/DeadbushPopulator.php @@ -40,7 +40,7 @@ class DeadbushPopulator extends AmountPopulator { $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15); if(!in_array($level->getChunk($chunkX, $chunkZ)->getBiomeId(abs($x % 16), ($z % 16)), [40, 39, Biome::DESERT])) continue; $y = $this->getHighestWorkableBlock($x, $z); - if ($y !== -1 && $level->getBlockIdAt($x, $y - 1, $z ) == Block::SAND) { + if ($y !== -1 && $level->getBlockIdAt($x, $y - 1, $z) == Block::SAND) { $level->setBlockIdAt($x, $y, $z, Block::DEAD_BUSH); $level->setBlockDataAt($x, $y, $z, 1); } diff --git a/src/Ad5001/BetterGen/populator/FallenTreePopulator.php b/src/Ad5001/BetterGen/populator/FallenTreePopulator.php index 4447c1f..85c4ef7 100644 --- a/src/Ad5001/BetterGen/populator/FallenTreePopulator.php +++ b/src/Ad5001/BetterGen/populator/FallenTreePopulator.php @@ -54,7 +54,7 @@ class FallenTreePopulator extends AmountPopulator { $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15); $y = $this->getHighestWorkableBlock($x, $z); if(isset(FallenTree::$overridable[$level->getBlockIdAt($x, $y, $z)])) $y--; // Changing $y if 1 block to high. - if ($y !== -1 and $fallenTree->canPlaceObject($level, $x, $y + 1, $z, $random )) { + if ($y !== -1 and $fallenTree->canPlaceObject($level, $x, $y + 1, $z, $random)) { $fallenTree->placeObject($level, $x, $y + 1, $z); } } diff --git a/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php b/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php index f3e06b0..28795b0 100644 --- a/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php +++ b/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php @@ -146,7 +146,7 @@ class FloatingIslandPopulator extends AmountPopulator { 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(); if(Main::isOtherNS()) $ores->setOreTypes([ - new OreType2(new CoalOre (), 20, 16, $pos->y - $height, $pos->y ), + new OreType2(new CoalOre (), 20, 16, $pos->y - $height, $pos->y), new OreType2(new IronOre (), 20, 8, $pos->y - $height, $pos->y - round($height * 0.75)), new OreType2(new RedstoneOre (), 8, 7, $pos->y - $height, $pos->y - round($height / 2)), new OreType2(new LapisOre (), 1, 6, $pos->y - $height, $pos->y - round($height / 2)), @@ -154,7 +154,7 @@ class FloatingIslandPopulator extends AmountPopulator { new OreType2(new DiamondOre (), 1, 7, $pos->y - $height, $pos->y - round($height / 4)) ]); if(!Main::isOtherNS()) $ores->setOreTypes([ - new OreType(new CoalOre (), 20, 16, $pos->y - $height, $pos->y ), + new OreType(new CoalOre (), 20, 16, $pos->y - $height, $pos->y), new OreType(new IronOre (), 20, 8, $pos->y - $height, $pos->y - round($height * 0.75)), new OreType(new RedstoneOre (), 8, 7, $pos->y - $height, $pos->y - round($height / 2)), new OreType(new LapisOre (), 1, 6, $pos->y - $height, $pos->y - round($height / 2)), diff --git a/src/Ad5001/BetterGen/populator/IglooPopulator.php b/src/Ad5001/BetterGen/populator/IglooPopulator.php index 352763c..6d91bf7 100644 --- a/src/Ad5001/BetterGen/populator/IglooPopulator.php +++ b/src/Ad5001/BetterGen/populator/IglooPopulator.php @@ -33,13 +33,13 @@ class IglooPopulator extends AmountPopulator { */ public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) { $this->level = $level; - if ($random->nextBoundedInt(100 ) > 30) + if ($random->nextBoundedInt(100) > 30) return; $igloo = new Igloo (); $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); - $y = $this->getHighestWorkableBlock($x, $z ) - 1; - if ($igloo->canPlaceObject($level, $x, $y, $z, $random )) + $y = $this->getHighestWorkableBlock($x, $z) - 1; + if ($igloo->canPlaceObject($level, $x, $y, $z, $random)) $igloo->placeObject($level, $x, $y, $z, $random); } diff --git a/src/Ad5001/BetterGen/populator/LakePopulator.php b/src/Ad5001/BetterGen/populator/LakePopulator.php index 1462379..f05c826 100644 --- a/src/Ad5001/BetterGen/populator/LakePopulator.php +++ b/src/Ad5001/BetterGen/populator/LakePopulator.php @@ -42,13 +42,13 @@ class LakePopulator extends AmountPopulator { $x += $random->nextRange(- 1, 1); $y += $random->nextRange(- 1, 1); $z += $random->nextRange(- 1, 1); - if ($level->getBlockIdAt($x, $y, $z ) !== Block::AIR) - BuildingUtils::buildRandom($this->level, new Vector3($x, $y, $z ), new Vector3(5, 5, 5 ), $random, Block::get(Block::WATER )); + if ($level->getBlockIdAt($x, $y, $z) !== Block::AIR) + BuildingUtils::buildRandom($this->level, new Vector3($x, $y, $z), new Vector3(5, 5, 5), $random, Block::get(Block::WATER)); } for($xx = $x - 8; $xx <= $x + 8; $xx ++) for($zz = $z - 8; $zz <= $z + 8; $zz ++) for($yy = $ory + 1; $yy <= $y + 3; $yy ++) - if ($level->getBlockIdAt($xx, $yy, $zz ) == Block::WATER) + if ($level->getBlockIdAt($xx, $yy, $zz) == Block::WATER) $level->setBlockIdAt($xx, $yy, $zz, Block::AIR); } diff --git a/src/Ad5001/BetterGen/populator/MineshaftPopulator.php b/src/Ad5001/BetterGen/populator/MineshaftPopulator.php index c325063..e2db62c 100644 --- a/src/Ad5001/BetterGen/populator/MineshaftPopulator.php +++ b/src/Ad5001/BetterGen/populator/MineshaftPopulator.php @@ -41,31 +41,31 @@ class MineshaftPopulator extends AmountPopulator { * @param $random pocketmine\utils\Random */ public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) { - if ($this->getAmount($random ) < 100) + if ($this->getAmount($random) < 100) return; $this->level = $level; $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); $y = $random->nextRange(5, 50); // First filling the large dirt place (center of the mineshaft) - BuildingUtils::fill($level, new Vector3($x - 6, $y, $x - 6 ), new Vector3($x + 6, $y + 8, $z + 6 ), Block::get(Block::AIR )); - BuildingUtils::fill($level, new Vector3($x - 6, $y, $x - 6 ), new Vector3($x + 6, $y, $z + 6 ), Block::get(Block::DIRT )); + BuildingUtils::fill($level, new Vector3($x - 6, $y, $x - 6), new Vector3($x + 6, $y + 8, $z + 6), Block::get(Block::AIR)); + BuildingUtils::fill($level, new Vector3($x - 6, $y, $x - 6), new Vector3($x + 6, $y, $z + 6), Block::get(Block::DIRT)); $startingPath = $random->nextBoundedInt(4); - $this->maxPath = $random->nextBoundedInt(100 ) + 50; - foreach(array_fill(0, $startingPath, 1 ) as $hey ) { + $this->maxPath = $random->nextBoundedInt(100) + 50; + foreach(array_fill(0, $startingPath, 1) as $hey) { $dir = $random->nextBoundedInt(4); switch ($dir) { case self::DIR_XPLUS : - $this->generateMineshaftPart($x + 6, $y + $random->nextBoundedInt(5 ), $z + $random->nextBoundedInt(12 ) - 6, $dir, $random); + $this->generateMineshaftPart($x + 6, $y + $random->nextBoundedInt(5), $z + $random->nextBoundedInt(12) - 6, $dir, $random); break; case self::DIR_XMIN : - $this->generateMineshaftPart($x - 6, $y + $random->nextBoundedInt(5 ), $z + $random->nextBoundedInt(12 ) - 6, $dir, $random); + $this->generateMineshaftPart($x - 6, $y + $random->nextBoundedInt(5), $z + $random->nextBoundedInt(12) - 6, $dir, $random); break; case self::DIR_ZPLUS : - $this->generateMineshaftPart($x + $random->nextBoundedInt(12 ) - 6, $y + $random->nextBoundedInt(8 ), $z + 6, $dir, $random); + $this->generateMineshaftPart($x + $random->nextBoundedInt(12) - 6, $y + $random->nextBoundedInt(8), $z + 6, $dir, $random); break; case self::DIR_ZMIN : - $this->generateMineshaftPart($x + $random->nextBoundedInt(12 ) - 6, $y + $random->nextBoundedInt(8 ), $z - 6, $dir, $random); + $this->generateMineshaftPart($x + $random->nextBoundedInt(12) - 6, $y + $random->nextBoundedInt(8), $z - 6, $dir, $random); break; } } @@ -89,15 +89,15 @@ class MineshaftPopulator extends AmountPopulator { switch ($dir) { case self::DIR_XPLUS : // First, filling everything blank. - BuildingUtils::fill($this->level, new Vector3($x, $y, $z - 1 ), new Vector3($x + 4, $y + 2, $z + 1 ), Block::get(Block::AIR )); + BuildingUtils::fill($this->level, new Vector3($x, $y, $z - 1), new Vector3($x + 4, $y + 2, $z + 1), Block::get(Block::AIR)); // Then, making sure the floor is solid. - BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z - 1 ), new Vector3($x + 4, $y - 1, $z + 1 ), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z - 1), new Vector3($x + 4, $y - 1, $z + 1), function ($v3, ChunkManager $level) { + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); // Putting rails - BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x + 4, $y, $z ), function ($v3, ChunkManager $level, Random $random) { - if ($random->nextBoundedInt(3 ) !== 0) { + BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + 4, $y, $z), function ($v3, ChunkManager $level, Random $random) { + if ($random->nextBoundedInt(3) !== 0) { $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::RAIL); $level->setBlockDataAt($v3->x, $v3->y, $v3->z, 1); } @@ -113,32 +113,32 @@ class MineshaftPopulator extends AmountPopulator { $level->setBlockIdAt($x + 1, $y + 2, $z, Block::TORCH); $level->setBlockDataAt($x + 1, $y + 2, $z, 2); // Generating chest - if ($random->nextBoundedInt(30 ) == 0) { - $direction =(int ) $random->nextBoolean (); + if ($random->nextBoundedInt(30) == 0) { + $direction =(int) $random->nextBoolean (); if ($direction == 0) $direction = -1; // Choosing the part of the rail. - $direction2 =(int ) $random->nextBoolean (); + $direction2 =(int) $random->nextBoolean (); if ($direction2 == 0) $direction2 = 2; if ($direction2 == 1) $direction2 = 4; - LootTable::buildLootTable(new Vector3($x + $direction2, $y, $z + $direction ), LootTable::LOOT_MINESHAFT, $random); + LootTable::buildLootTable(new Vector3($x + $direction2, $y, $z + $direction), LootTable::LOOT_MINESHAFT, $random); } - if ($random->nextBoundedInt(30 ) !== 0) + if ($random->nextBoundedInt(30) !== 0) $this->generateMineshaftPart($x + 5, $y, $z, $dir, $random); break; case self::DIR_XMIN : // First, filling everything blank. - BuildingUtils::fill($this->level, new Vector3($x, $y, $z - 1 ), new Vector3($x - 4, $y + 2, $z + 1 )); + BuildingUtils::fill($this->level, new Vector3($x, $y, $z - 1), new Vector3($x - 4, $y + 2, $z + 1)); // Then, making sure the floor is solid. - BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z - 1 ), new Vector3($x - 4, $y - 1, $z + 1 ), function ($v3, ChunkManager $level) { + BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z - 1), new Vector3($x - 4, $y - 1, $z + 1), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); // Putting rails - BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x - 4, $y, $z ), function ($v3, ChunkManager $level, Random $random) { - if ($random->nextBoundedInt(3 ) !== 0) { + BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x - 4, $y, $z), function ($v3, ChunkManager $level, Random $random) { + if ($random->nextBoundedInt(3) !== 0) { $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::RAIL); $level->setBlockDataAt($v3->x, $v3->y, $v3->z, 1); } @@ -154,32 +154,32 @@ class MineshaftPopulator extends AmountPopulator { $level->setBlockIdAt($x - 1, $y + 2, $z, Block::TORCH); $level->setBlockDataAt($x - 1, $y + 2, $z, 1); // Generating chest - if ($random->nextBoundedInt(30 ) == 0) { - $direction =(int ) $random->nextBoolean (); + if ($random->nextBoundedInt(30) == 0) { + $direction =(int) $random->nextBoolean (); if ($direction == 0) $direction = -1; // Choosing the part of the rail. - $direction2 =(int ) $random->nextBoolean (); + $direction2 =(int) $random->nextBoolean (); if ($direction2 == 0) $direction2 = 2; if ($direction2 == 1) $direction2 = 4; - LootTable::buildLootTable(new Vector3($x - $direction2, $y, $z + $direction ), LootTable::LOOT_MINESHAFT, $random); + LootTable::buildLootTable(new Vector3($x - $direction2, $y, $z + $direction), LootTable::LOOT_MINESHAFT, $random); } - if ($random->nextBoundedInt(30 ) !== 0) + if ($random->nextBoundedInt(30) !== 0) $this->generateMineshaftPart($x - 5, $y, $z, $dir, $random); break; case self::DIR_ZPLUS : // First, filling everything blank. - BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z ), new Vector3($x + 1, $y + 2, $z + 4 )); + BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z), new Vector3($x + 1, $y + 2, $z + 4)); // Then, making sure the floor is solid. - BuildingUtils::fillCallback(new Vector3($x - 1, $y - 1, $z ), new Vector3($x + 1, $y - 1, $z + 4 ), function ($v3, ChunkManager $level) { + BuildingUtils::fillCallback(new Vector3($x - 1, $y - 1, $z), new Vector3($x + 1, $y - 1, $z + 4), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); // Putting rails - BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x, $y, $z + 4 ), function ($v3, ChunkManager $level, Random $random) { - if ($random->nextBoundedInt(3 ) !== 0) { + BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + 4), function ($v3, ChunkManager $level, Random $random) { + if ($random->nextBoundedInt(3) !== 0) { $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::RAIL); $level->setBlockDataAt($v3->x, $v3->y, $v3->z, 0); } @@ -195,32 +195,32 @@ class MineshaftPopulator extends AmountPopulator { $level->setBlockIdAt($x, $y + 2, $z - 1, Block::TORCH); $level->setBlockDataAt($x, $y + 2, $z - 1, 4); // Generating chest - if ($random->nextBoundedInt(30 ) == 0) { - $direction =(int ) $random->nextBoolean (); + if ($random->nextBoundedInt(30) == 0) { + $direction =(int) $random->nextBoolean (); if ($direction == 0) $direction = -1; // Choosing the part of the rail. - $direction2 =(int ) $random->nextBoolean (); + $direction2 =(int) $random->nextBoolean (); if ($direction2 == 0) $direction2 = 2; if ($direction2 == 1) $direction2 = 4; - LootTable::buildLootTable(new Vector3($x + $direction, $y, $z + $direction2 ), LootTable::LOOT_MINESHAFT, $random); + LootTable::buildLootTable(new Vector3($x + $direction, $y, $z + $direction2), LootTable::LOOT_MINESHAFT, $random); } - if ($random->nextBoundedInt(30 ) !== 0) + if ($random->nextBoundedInt(30) !== 0) $this->generateMineshaftPart($x, $y, $z + 5, $dir, $random); break; case self::DIR_ZMIN : // First, filling everything blank. - BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z ), new Vector3($x + 1, $y + 2, $z - 4 )); + BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z), new Vector3($x + 1, $y + 2, $z - 4)); // Then, making sure the floor is solid. - BuildingUtils::fillCallback(new Vector3($x - 1, $y - 1, $z ), new Vector3($x + 1, $y - 1, $z - 4 ), function ($v3, ChunkManager $level) { + BuildingUtils::fillCallback(new Vector3($x - 1, $y - 1, $z), new Vector3($x + 1, $y - 1, $z - 4), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); // Putting rails - BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x, $y, $z - 4 ), function ($v3, ChunkManager $level, Random $random) { - if ($random->nextBoundedInt(3 ) !== 0) { + BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z - 4), function ($v3, ChunkManager $level, Random $random) { + if ($random->nextBoundedInt(3) !== 0) { $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::RAIL); $level->setBlockDataAt($v3->x, $v3->y, $v3->z, 0); } @@ -236,28 +236,28 @@ class MineshaftPopulator extends AmountPopulator { $level->setBlockIdAt($x, $y + 2, $z - 1, Block::TORCH); $level->setBlockDataAt($x, $y + 2, $z - 1, 3); // Generating chest - if ($random->nextBoundedInt(30 ) == 0) { - $direction =(int ) $random->nextBoolean (); + if ($random->nextBoundedInt(30) == 0) { + $direction =(int) $random->nextBoolean (); if ($direction == 0) $direction = -1; // Choosing the part of the rail. - $direction2 =(int ) $random->nextBoolean (); + $direction2 =(int) $random->nextBoolean (); if ($direction2 == 0) $direction2 = 2; if ($direction2 == 1) $direction2 = 4; - LootTable::buildLootTable(new Vector3($x + $direction, $y, $z - $direction2 ), LootTable::LOOT_MINESHAFT, $random); + LootTable::buildLootTable(new Vector3($x + $direction, $y, $z - $direction2), LootTable::LOOT_MINESHAFT, $random); } - if ($random->nextBoundedInt(30 ) !== 0) + if ($random->nextBoundedInt(30) !== 0) $this->generateMineshaftPart($x, $y, $z - 5, $dir, $random); break; } // Doing cobwebs - $webNum = $random->nextBoundedInt(5 ) + 2; + $webNum = $random->nextBoundedInt(5) + 2; for($i = 0; $i < $webNum; $i ++) { - $xx = $x + $random->nextBoundedInt(5 ) - 2; + $xx = $x + $random->nextBoundedInt(5) - 2; $yy = $y + $random->nextBoundedInt(3); - $zz = $z + $random->nextBoundedInt(5 ) - 2; - if ($level->getBlockIdAt($xx, $yy, $zz ) == Block::AIR) + $zz = $z + $random->nextBoundedInt(5) - 2; + if ($level->getBlockIdAt($xx, $yy, $zz) == Block::AIR) $level->setBlockIdAt($xx, $yy, $zz, Block::COBWEB); } break; @@ -288,16 +288,16 @@ class MineshaftPopulator extends AmountPopulator { } // Then, making sure the floor is solid. - BuildingUtils::fillCallback(new Vector3($x + 1, $y - 1, $z - 1 ), new Vector3($x - 1, $y - 1, $z + 1 ), function ($v3, ChunkManager $level) { + BuildingUtils::fillCallback(new Vector3($x + 1, $y - 1, $z - 1), new Vector3($x - 1, $y - 1, $z + 1), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); // Putting rails - BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z - 1 ), new Vector3($x + 1, $y + 6, $z + 1 ), Block::get(Block::AIR )); + BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z - 1), new Vector3($x + 1, $y + 6, $z + 1), Block::get(Block::AIR)); - BuildingUtils::corners($this->level, new Vector3($x - 1, $y, $z - 1 ), new Vector3($x + 1, $y + 6, $z + 1 ), Block::get(Block::PLANK )); + BuildingUtils::corners($this->level, new Vector3($x - 1, $y, $z - 1), new Vector3($x + 1, $y + 6, $z + 1), Block::get(Block::PLANK)); $newFloor = $random->nextBoolean (); $numberFloor = $random->nextBoundedInt(4 + ($newFloor ? 5 : 0)); @@ -311,12 +311,12 @@ class MineshaftPopulator extends AmountPopulator { ] : [ ]) ]; for($i = 7; $i > $newFloor; $i --) { - $chooseNew =(int ) $newFloor && $random->nextBoolean (); + $chooseNew =(int) $newFloor && $random->nextBoolean (); $choose = $random->nextBoundedInt(4); unset($possiblePathes [$chooseNew] [$choose]); } // Building pathes - foreach($possiblePathes [0] as $path ) { + foreach($possiblePathes [0] as $path) { switch ($path) { case self::DIR_XPLUS : $this->generateMineshaftPart($x + 2, $y, $z, self::DIR_XPLUS, $random); @@ -332,7 +332,7 @@ class MineshaftPopulator extends AmountPopulator { break; } } - foreach($possiblePathes [1] as $path ) { + foreach($possiblePathes [1] as $path) { switch ($path) { case self::DIR_XPLUS : $this->generateMineshaftPart($x + 2, $y + 4, $z, self::DIR_XPLUS, $random); @@ -350,12 +350,12 @@ class MineshaftPopulator extends AmountPopulator { } // Doing cobwebs - $webNum = $random->nextBoundedInt(5 ) + 2; + $webNum = $random->nextBoundedInt(5) + 2; for($i = 0; $i < $webNum; $i ++) { - $xx = $x + $random->nextBoundedInt(3 ) - 1; + $xx = $x + $random->nextBoundedInt(3) - 1; $yy = $y + $random->nextBoundedInt(6); - $zz = $z + $random->nextBoundedInt(3 ) - 1; - if ($level->getBlockIdAt($xx, $yy, $zz ) == Block::AIR) + $zz = $z + $random->nextBoundedInt(3) - 1; + if ($level->getBlockIdAt($xx, $yy, $zz) == Block::AIR) $level->setBlockIdAt($xx, $yy, $zz, Block::COBWEB); } break; @@ -368,33 +368,33 @@ class MineshaftPopulator extends AmountPopulator { for($i = 0; $i < 4; $i ++) { switch ($i) { case self::DIR_XPLUS : - BuildingUtils::fill($this->level, new Vector3($x + $i, $y - $i - 1, $z - 2 ), new Vector3($x + $i, $y - $i + 3, $z + 2 ), Block::get(Block::AIR )); - BuildingUtils::fillCallback(new Vector3($x + $i, $y - $i - 2, $z - 2 ), new Vector3($x + $i, $y - $i - 2, $z + 2 ), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + BuildingUtils::fill($this->level, new Vector3($x + $i, $y - $i - 1, $z - 2), new Vector3($x + $i, $y - $i + 3, $z + 2), Block::get(Block::AIR)); + BuildingUtils::fillCallback(new Vector3($x + $i, $y - $i - 2, $z - 2), new Vector3($x + $i, $y - $i - 2, $z + 2), function ($v3, ChunkManager $level) { + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); break; case self::DIR_XMIN : - BuildingUtils::fill($this->level, new Vector3($x - $i, $y - $i - 1, $z - 2 ), new Vector3($x - $i, $y - $i + 3, $z + 2 ), Block::get(Block::AIR )); - BuildingUtils::fillCallback(new Vector3($x - $i, $y - $i - 2, $z - 2 ), new Vector3($x - $i, $y - $i - 2, $z + 2 ), function ($v3, ChunkManager $level) { + BuildingUtils::fill($this->level, new Vector3($x - $i, $y - $i - 1, $z - 2), new Vector3($x - $i, $y - $i + 3, $z + 2), Block::get(Block::AIR)); + BuildingUtils::fillCallback(new Vector3($x - $i, $y - $i - 2, $z - 2), new Vector3($x - $i, $y - $i - 2, $z + 2), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); break; case self::DIR_ZPLUS : - BuildingUtils::fill($this->level, new Vector3($x - 2, $y - $i - 1, $z + $i ), new Vector3($x + 2, $y - $i + 3, $z + $i ), Block::get(Block::AIR )); - BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z + $i ), new Vector3($x + 2, $y - $i - 2, $z + $i ), function ($v3, ChunkManager $level) { + BuildingUtils::fill($this->level, new Vector3($x - 2, $y - $i - 1, $z + $i), new Vector3($x + 2, $y - $i + 3, $z + $i), Block::get(Block::AIR)); + BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z + $i), new Vector3($x + 2, $y - $i - 2, $z + $i), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); break; case self::DIR_ZMIN : - BuildingUtils::fill($this->level, new Vector3($x - 2, $y - $i - 1, $z - $i ), new Vector3($x + 2, $y - $i + 3, $z - $i ), Block::get(Block::AIR )); - BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z - $i ), new Vector3($x + 2, $y - $i - 2, $z - $i ), function ($v3, ChunkManager $level) { + BuildingUtils::fill($this->level, new Vector3($x - 2, $y - $i - 1, $z - $i), new Vector3($x + 2, $y - $i + 3, $z - $i), Block::get(Block::AIR)); + BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z - $i), new Vector3($x + 2, $y - $i - 2, $z - $i), function ($v3, ChunkManager $level) { - if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z ) == Block::AIR) + if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR) $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK); }, $this->level); break; diff --git a/src/Ad5001/BetterGen/populator/RavinePopulator.php b/src/Ad5001/BetterGen/populator/RavinePopulator.php index d278bf0..c7bcbcd 100644 --- a/src/Ad5001/BetterGen/populator/RavinePopulator.php +++ b/src/Ad5001/BetterGen/populator/RavinePopulator.php @@ -36,10 +36,10 @@ class RavinePopulator extends AmountPopulator { $this->level = $level; $amount = $this->getAmount($random); if ($amount > 50) { // Only build one per chunk - $depth = $random->nextBoundedInt(60 ) + 30; // 2Much4U? + $depth = $random->nextBoundedInt(60) + 30; // 2Much4U? $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); - $y = $random->nextRange(5, $this->getHighestWorkableBlock($x, $z )); + $y = $random->nextRange(5, $this->getHighestWorkableBlock($x, $z)); $deffX = $x; $deffZ = $z; $height = $random->nextRange(15, 30); @@ -60,11 +60,11 @@ class RavinePopulator extends AmountPopulator { $length = 10; if ($length < 5) $length = 5; - $x += $random->nextRange(0 + $diffX, 2 + $diffX ) - 1; - $y += $random->nextRange(0, 2 ) - 1; - $z += $random->nextRange(0 + $diffZ, 2 + $diffZ ) - 1; - $height += $random->nextRange(0, 2 ) - 1; - $length += $random->nextRange(0, 2 ) - 1; + $x += $random->nextRange(0 + $diffX, 2 + $diffX) - 1; + $y += $random->nextRange(0, 2) - 1; + $z += $random->nextRange(0 + $diffZ, 2 + $diffZ) - 1; + $height += $random->nextRange(0, 2) - 1; + $length += $random->nextRange(0, 2) - 1; } } } @@ -103,9 +103,9 @@ class RavinePopulator extends AmountPopulator { for($yy = $y; $yy <= $y + $height; $yy ++) { for($zz = $z - $length; $zz <= $z + $length; $zz ++) { $oldXB = $xBounded; - $xBounded = $random->nextBoundedInt(self::NOISE * 2 ) - self::NOISE; + $xBounded = $random->nextBoundedInt(self::NOISE * 2) - self::NOISE; $oldZB = $zBounded; - $zBounded = $random->nextBoundedInt(self::NOISE * 2 ) - self::NOISE; + $zBounded = $random->nextBoundedInt(self::NOISE * 2) - self::NOISE; if ($xBounded > self::NOISE - 2) { $xBounded = 1; } elseif ($xBounded < - self::NOISE + 2) { @@ -120,8 +120,8 @@ class RavinePopulator extends AmountPopulator { } else { $zBounded = $oldZB; } - if (abs((abs($xx ) - abs($x )) ** 2 + (abs($zz ) - abs($z )) ** 2 ) < ((($length / 2 - $xBounded) + ($length / 2 - $zBounded)) / 2) ** 2 && $y > 0 && ! in_array($this->level->getBlockIdAt(( int ) round($xx ),(int ) round($yy ),(int ) round($zz ) ), BuildingUtils::TO_NOT_OVERWRITE ) && ! in_array($this->level->getBlockIdAt(( int ) round($xx ),(int ) round($yy + 1 ),(int ) round($zz ) ), BuildingUtils::TO_NOT_OVERWRITE )) { - $this->level->setBlockIdAt(( int ) round($xx ),(int ) round($yy ),(int ) round($zz ), Block::AIR); + if (abs((abs($xx) - abs($x)) ** 2 + (abs($zz) - abs($z)) ** 2) < ((($length / 2 - $xBounded) + ($length / 2 - $zBounded)) / 2) ** 2 && $y > 0 && ! in_array($this->level->getBlockIdAt(( int) round($xx),(int) round($yy),(int) round($zz)), BuildingUtils::TO_NOT_OVERWRITE) && ! in_array($this->level->getBlockIdAt(( int) round($xx),(int) round($yy + 1),(int) round($zz)), BuildingUtils::TO_NOT_OVERWRITE)) { + $this->level->setBlockIdAt(( int) round($xx),(int) round($yy),(int) round($zz), Block::AIR); } } } diff --git a/src/Ad5001/BetterGen/populator/SugarCanePopulator.php b/src/Ad5001/BetterGen/populator/SugarCanePopulator.php index b027d20..13518ae 100644 --- a/src/Ad5001/BetterGen/populator/SugarCanePopulator.php +++ b/src/Ad5001/BetterGen/populator/SugarCanePopulator.php @@ -46,7 +46,7 @@ class SugarCanePopulator extends AmountPopulator { $x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15); $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15); $y = $this->getHighestWorkableBlock($x, $z); - if ($y !== -1 and $sugarcane->canPlaceObject($level, $x, $y, $z, $random )) { + if ($y !== -1 and $sugarcane->canPlaceObject($level, $x, $y, $z, $random)) { $sugarcane->placeObject($level, $x, $y, $z); } } diff --git a/src/Ad5001/BetterGen/populator/TemplePopulator.php b/src/Ad5001/BetterGen/populator/TemplePopulator.php index 36b0147..05295f5 100644 --- a/src/Ad5001/BetterGen/populator/TemplePopulator.php +++ b/src/Ad5001/BetterGen/populator/TemplePopulator.php @@ -33,13 +33,13 @@ class TemplePopulator extends AmountPopulator { */ public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) { $this->level = $level; - if ($random->nextBoundedInt(1000 ) > 70) + if ($random->nextBoundedInt(1000) > 70) return; $temple = new Temple (); $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); $y = $this->getHighestWorkableBlock($x, $z); - if ($temple->canPlaceObject($level, $x, $y, $z, $random )) + if ($temple->canPlaceObject($level, $x, $y, $z, $random)) $temple->placeObject($level, $x, $y - 1, $z, $random); } diff --git a/src/Ad5001/BetterGen/populator/WellPopulator.php b/src/Ad5001/BetterGen/populator/WellPopulator.php index 33e2aa0..5f265c3 100644 --- a/src/Ad5001/BetterGen/populator/WellPopulator.php +++ b/src/Ad5001/BetterGen/populator/WellPopulator.php @@ -33,13 +33,13 @@ class WellPopulator extends AmountPopulator { */ public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) { $this->level = $level; - if ($random->nextBoundedInt(1000 ) > 25) + if ($random->nextBoundedInt(1000) > 25) return; // ~1 chance / 1000 due to building limitations. $well = new Well (); $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); - $y = $this->getHighestWorkableBlock($x, $z ) - 1; - if ($well->canPlaceObject($level, $x, $y, $z, $random )) + $y = $this->getHighestWorkableBlock($x, $z) - 1; + if ($well->canPlaceObject($level, $x, $y, $z, $random)) $well->placeObject($level, $x, $y, $z, $random); } diff --git a/src/Ad5001/BetterGen/structure/Bush.php b/src/Ad5001/BetterGen/structure/Bush.php index 796636d..b215e7d 100644 --- a/src/Ad5001/BetterGen/structure/Bush.php +++ b/src/Ad5001/BetterGen/structure/Bush.php @@ -72,7 +72,7 @@ class Bush extends Object { * @param $level pocketmine\level\ChunkManager */ 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)])) { $level->setBlockIdAt($x, $y, $z, $this->leaf [0]); $level->setBlockDataAt($x, $y, $z, $this->leaf [1]); } diff --git a/src/Ad5001/BetterGen/structure/Cactus.php b/src/Ad5001/BetterGen/structure/Cactus.php index 27cf28c..aff98e0 100644 --- a/src/Ad5001/BetterGen/structure/Cactus.php +++ b/src/Ad5001/BetterGen/structure/Cactus.php @@ -35,7 +35,7 @@ class Cactus extends Object { $this->totalHeight = 1 + $random->nextBoundedInt(3); $below = $level->getBlockIdAt($x, $y - 1, $z); for($yy = $y; $yy <= $y + $this->totalHeight; $yy ++) { - if ($level->getBlockIdAt($x, $yy, $z ) !== Block::AIR || ($below !== Block::SAND && $below !== Block::CACTUS) || ($level->getBlockIdAt($x - 1, $yy, $z ) !== Block::AIR || $level->getBlockIdAt($x + 1, $yy, $z ) !== Block::AIR || $level->getBlockIdAt($x, $yy, $z - 1 ) !== Block::AIR || $level->getBlockIdAt($x, $yy, $z + 1 ) !== Block::AIR)) { + if ($level->getBlockIdAt($x, $yy, $z) !== Block::AIR || ($below !== Block::SAND && $below !== Block::CACTUS) || ($level->getBlockIdAt($x - 1, $yy, $z) !== Block::AIR || $level->getBlockIdAt($x + 1, $yy, $z) !== Block::AIR || $level->getBlockIdAt($x, $yy, $z - 1) !== Block::AIR || $level->getBlockIdAt($x, $yy, $z + 1) !== Block::AIR)) { return false; } } @@ -51,7 +51,7 @@ class Cactus extends Object { */ public function placeObject(ChunkManager $level, int $x, int $y, int $z) { for($yy = 0; $yy < $this->totalHeight; $yy ++) { - if ($level->getBlockIdAt($x, $y + $yy, $z ) != Block::AIR) { + if ($level->getBlockIdAt($x, $y + $yy, $z) != Block::AIR) { return; } $level->setBlockIdAt($x, $y + $yy, $z, Block::CACTUS); diff --git a/src/Ad5001/BetterGen/structure/FallenTree.php b/src/Ad5001/BetterGen/structure/FallenTree.php index 54238eb..ad6091a 100644 --- a/src/Ad5001/BetterGen/structure/FallenTree.php +++ b/src/Ad5001/BetterGen/structure/FallenTree.php @@ -155,7 +155,7 @@ class FallenTree extends Object { * @param $level pocketmine\level\ChunkManager */ 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)])) { $level->setBlockIdAt($x, $y, $z, $this->trunk [0]); $level->setBlockDataAt($x, $y, $z, $this->trunk [1]); } diff --git a/src/Ad5001/BetterGen/structure/Igloo.php b/src/Ad5001/BetterGen/structure/Igloo.php index d76fdac..9f3fdc7 100644 --- a/src/Ad5001/BetterGen/structure/Igloo.php +++ b/src/Ad5001/BetterGen/structure/Igloo.php @@ -49,28 +49,28 @@ class Igloo extends Object { for($xx = $x - 3; $xx <= $x + 4; $xx ++) for($yy = $y + 1; $yy <= $y + 4; $yy ++) for($zz = $z - 3; $zz <= $z + 3; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)])) return false; break; case 1 : // Entrance is x- for($xx = $x - 4; $xx <= $x + 3; $xx ++) for($yy = $y + 1; $yy <= $y + 4; $yy ++) for($zz = $z - 3; $zz <= $z + 3; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)])) return false; break; case 2 : // Entrance is z+ for($xx = $x - 3; $xx <= $x + 3; $xx ++) for($yy = $y + 1; $yy <= $y + 4; $yy ++) for($zz = $z - 3; $zz <= $z + 4; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)])) return false; break; case 3 : // Entrance is z- for($xx = $x - 3; $xx <= $x + 3; $xx ++) for($yy = $y + 1; $yy <= $y + 4; $yy ++) for($zz = $z - 4; $zz <= $z + 3; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)])) return false; break; } @@ -87,14 +87,14 @@ class Igloo extends Object { * @return bool placed */ 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)) return false; switch ($this->direction) { case 0 : // Entrance is x+ // Ground for($xx = $x - 3; $xx <= $x + 4; $xx ++) for($zz = $z - 3; $zz <= $z + 3; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)])) $level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK); // Entrance for($i = 0; $i < 2; $i ++) { @@ -169,7 +169,7 @@ class Igloo extends Object { // Ground for($xx = $x - 4; $xx <= $x + 3; $xx ++) for($zz = $z - 3; $zz <= $z + 3; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)])) $level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK); // Entrance for($i = 0; $i < 2; $i ++) { @@ -243,7 +243,7 @@ class Igloo extends Object { // Ground for($xx = $x - 3; $xx <= $x + 3; $xx ++) for($zz = $z - 3; $zz <= $z + 4; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)])) $level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK); // Entrance for($i = 0; $i < 2; $i ++) { @@ -317,7 +317,7 @@ class Igloo extends Object { // Ground for($xx = $x - 3; $xx <= $x + 3; $xx ++) for($zz = $z - 4; $zz <= $z + 3; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)])) $level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK); // Entrance for($i = 0; $i < 2; $i ++) { diff --git a/src/Ad5001/BetterGen/structure/SakuraTree.php b/src/Ad5001/BetterGen/structure/SakuraTree.php index 99cd793..490eb1f 100644 --- a/src/Ad5001/BetterGen/structure/SakuraTree.php +++ b/src/Ad5001/BetterGen/structure/SakuraTree.php @@ -680,7 +680,7 @@ class SakuraTree extends Tree { $data = [ $this->leafType, $this->leaf2Type - ] [( int )$random->nextBoolean()]; + ] [( int)$random->nextBoolean()]; $level->setBlockIdAt($x, $y, $z, $this->realLeafBlock); $level->setBlockDataAt($x, $y, $z, $data); } diff --git a/src/Ad5001/BetterGen/structure/SugarCane.php b/src/Ad5001/BetterGen/structure/SugarCane.php index cbbc670..8720639 100644 --- a/src/Ad5001/BetterGen/structure/SugarCane.php +++ b/src/Ad5001/BetterGen/structure/SugarCane.php @@ -35,7 +35,7 @@ class SugarCane extends Object { 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); - if (($below == Block::SAND || $below == Block::GRASS) && ($level->getBlockIdAt($x + 1, $y - 1, $z ) == Block::WATER || $level->getBlockIdAt($x - 1, $y - 1, $z ) == Block::WATER || $level->getBlockIdAt($x, $y - 1, $z + 1 ) == Block::WATER || $level->getBlockIdAt($x, $y - 1, $z - 1 ) == Block::WATER)) { + if (($below == Block::SAND || $below == Block::GRASS) && ($level->getBlockIdAt($x + 1, $y - 1, $z) == Block::WATER || $level->getBlockIdAt($x - 1, $y - 1, $z) == Block::WATER || $level->getBlockIdAt($x, $y - 1, $z + 1) == Block::WATER || $level->getBlockIdAt($x, $y - 1, $z - 1) == Block::WATER)) { return true; } return false; @@ -50,7 +50,7 @@ class SugarCane extends Object { */ public function placeObject(ChunkManager $level, int $x, int $y, int $z) { for($yy = 0; $yy < $this->totalHeight; $yy ++) { - if ($level->getBlockIdAt($x, $y + $yy, $z ) != Block::AIR) { + if ($level->getBlockIdAt($x, $y + $yy, $z) != Block::AIR) { return; } $level->setBlockIdAt($x, $y + $yy, $z, Block::SUGARCANE_BLOCK); diff --git a/src/Ad5001/BetterGen/structure/Well.php b/src/Ad5001/BetterGen/structure/Well.php index eb0dcc1..4f3f666 100644 --- a/src/Ad5001/BetterGen/structure/Well.php +++ b/src/Ad5001/BetterGen/structure/Well.php @@ -69,7 +69,7 @@ class Well extends Object { for($xx = $x - 2; $xx <= $x + 2; $xx ++) for($yy = $y; $yy <= $y + 3; $yy ++) for($zz = $z - 2; $zz <= $z + 2; $zz ++) - if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz )] )) + if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)])) return false; return true; } @@ -84,7 +84,7 @@ class Well extends Object { */ public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) { $this->level = $level; - foreach($this->directions as $direction ) { + foreach($this->directions as $direction) { // Building pillars for($yy = $y; $yy < $y + 3; $yy ++) $this->placeBlock($x + $direction [0], $yy, $z + $direction [1], Block::SANDSTONE); diff --git a/src/Ad5001/BetterGen/utils/BuildingUtils.php b/src/Ad5001/BetterGen/utils/BuildingUtils.php index cd9cf3e..b80db85 100644 --- a/src/Ad5001/BetterGen/utils/BuildingUtils.php +++ b/src/Ad5001/BetterGen/utils/BuildingUtils.php @@ -40,7 +40,7 @@ class BuildingUtils { */ public static function fill(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block = null) { if ($block == null) $block = Block::get(Block::AIR); - list($pos1, $pos2 ) = self::minmax($pos1, $pos2); + list($pos1, $pos2) = self::minmax($pos1, $pos2); for($x = $pos1->x; $x >= $pos2->x; $x --) for($y = $pos1->y; $y >= $pos2->y; $y --) for($z = $pos1->z; $z >= $pos2->z; $z --) { $level->setBlockIdAt($x, $y, $z, $block->getId ()); $level->setBlockDataAt($x, $y, $z, $block->getDamage ()); @@ -60,7 +60,7 @@ class BuildingUtils { */ public static function fillRandom(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block = null, Random $random = null, $randMax = 3) { if ($block == null) $block = Block::get(Block::AIR); - list($pos1, $pos2 ) = self::minmax($pos1, $pos2); + list($pos1, $pos2) = self::minmax($pos1, $pos2); for($x = $pos1->x; $x >= $pos2->x; $x --) for($y = $pos1->y; $y >= $pos2->y; $y --) for($z = $pos1->z; $z >= $pos2->z; $z --) if($random !== null ? $random->nextBoundedInt($randMax) == 0 : rand(0, $randMax) == 0) { $level->setBlockIdAt($x, $y, $z, $block->getId ()); $level->setBlockDataAt($x, $y, $z, $block->getDamage ()); @@ -76,10 +76,10 @@ class BuildingUtils { * @return array */ public static function fillCallback(Vector3 $pos1, Vector3 $pos2, callable $call, ...$params) : array { - list($pos1, $pos2 ) = self::minmax($pos1, $pos2); + list($pos1, $pos2) = self::minmax($pos1, $pos2); $return = []; for($x = $pos1->x; $x >= $pos2->x; $x --) for($y = $pos1->y; $y >= $pos2->y; $y --) for($z = $pos1->z; $z >= $pos2->z; $z --) { - $return[] = call_user_func($call, new Vector3($x, $y, $z ), ...$params); + $return[] = call_user_func($call, new Vector3($x, $y, $z), ...$params); } return $return; } @@ -93,7 +93,7 @@ class BuildingUtils { * @return void */ public static function walls(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) { - list($pos1, $pos2 ) = self::minmax($pos1, $pos2); + list($pos1, $pos2) = self::minmax($pos1, $pos2); for($y = $pos1->y; $y >= $pos2->y; $y --) { for($x = $pos1->x; $x >= $pos2->x; $x --) { $level->setBlockIdAt($x, $y, $pos1->z, $block->getId ()); @@ -119,7 +119,7 @@ class BuildingUtils { * @return void */ public static function top(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) { - list($pos1, $pos2 ) = self::minmax($pos1, $pos2); + list($pos1, $pos2) = self::minmax($pos1, $pos2); for($x = $pos1->x; $x >= $pos2->x; $x --) for($z = $pos1->z; $z >= $pos2->z; $z --) { $level->setBlockIdAt($x, $pos1->y, $z, $block->getId ()); @@ -136,7 +136,7 @@ class BuildingUtils { * @return void */ public static function corners(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) { - list($pos1, $pos2 ) = self::minmax($pos1, $pos2); + list($pos1, $pos2) = self::minmax($pos1, $pos2); for($y = $pos1->y; $y >= $pos2->y; $y --) { $level->setBlockIdAt($pos1->x, $y, $pos1->z, $block->getId ()); $level->setBlockDataAt($pos1->x, $y, $pos1->z, $block->getDamage ()); @@ -158,7 +158,7 @@ class BuildingUtils { * @return void */ public static function bottom(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) { - list($pos1, $pos2 ) = self::minmax($pos1, $pos2); + list($pos1, $pos2) = self::minmax($pos1, $pos2); for($x = $pos1->x; $x >= $pos2->x; $x --) for($z = $pos1->z; $z >= $pos2->z; $z --) { $level->setBlockIdAt($x, $pos2->y, $z, $block->getId ()); @@ -176,15 +176,15 @@ class BuildingUtils { * @return void */ public static function buildRandom(ChunkManager $level, Vector3 $pos, Vector3 $infos, Random $random, Block $block) { - $xBounded = $random->nextBoundedInt(3 ) - 1; - $yBounded = $random->nextBoundedInt(3 ) - 1; - $zBounded = $random->nextBoundedInt(3 ) - 1; + $xBounded = $random->nextBoundedInt(3) - 1; + $yBounded = $random->nextBoundedInt(3) - 1; + $zBounded = $random->nextBoundedInt(3) - 1; $pos = $pos->round (); for($x = $pos->x - ($infos->x / 2); $x <= $pos->x + ($infos->x / 2); $x ++) { for($y = $pos->y - ($infos->y / 2); $y <= $pos->y + ($infos->y / 2); $y ++) { for($z = $pos->z - ($infos->z / 2); $z <= $pos->z + ($infos->z / 2); $z ++) { // if(abs((abs($x) - abs($pos->x)) ** 2 + ($y - $pos->y) ** 2 + (abs($z) - abs($pos->z)) ** 2) < (abs($infos->x / 2 + $xBounded) + abs($infos->y / 2 + $yBounded) + abs($infos->z / 2 + $zBounded)) ** 2 - if (abs((abs($x ) - abs($pos->x )) ** 2 + ($y - $pos->y) ** 2 + (abs($z ) - abs($pos->z )) ** 2 ) < ((($infos->x / 2 - $xBounded) + ($infos->y / 2 - $yBounded) + ($infos->z / 2 - $zBounded)) / 3) ** 2 && $y > 0 && ! in_array($level->getBlockIdAt($x, $y, $z ), self::TO_NOT_OVERWRITE ) && ! in_array($level->getBlockIdAt($x, $y + 1, $z ), self::TO_NOT_OVERWRITE )) { + if (abs((abs($x) - abs($pos->x)) ** 2 + ($y - $pos->y) ** 2 + (abs($z) - abs($pos->z)) ** 2) < ((($infos->x / 2 - $xBounded) + ($infos->y / 2 - $yBounded) + ($infos->z / 2 - $zBounded)) / 3) ** 2 && $y > 0 && ! in_array($level->getBlockIdAt($x, $y, $z), self::TO_NOT_OVERWRITE) && ! in_array($level->getBlockIdAt($x, $y + 1, $z), self::TO_NOT_OVERWRITE)) { $level->setBlockIdAt($x, $y, $z, $block->getId ()); $level->setBlockDataAt($x, $y, $z, $block->getDamage ()); } @@ -200,8 +200,8 @@ class BuildingUtils { * @return array */ protected static function minmax(Vector3 $pos1, Vector3 $pos2): array { - $v1 = new Vector3(max($pos1->x, $pos2->x ), max($pos1->y, $pos2->y ), max($pos1->z, $pos2->z )); - $v2 = new Vector3(min($pos1->x, $pos2->x ), min($pos1->y, $pos2->y ), min($pos1->z, $pos2->z )); + $v1 = new Vector3(max($pos1->x, $pos2->x), max($pos1->y, $pos2->y), max($pos1->z, $pos2->z)); + $v2 = new Vector3(min($pos1->x, $pos2->x), min($pos1->y, $pos2->y), min($pos1->z, $pos2->z)); return [ $v1, $v2