From 512ac47f7001e6d9698d7cae4c1ae9f00401b287 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Mon, 22 May 2017 19:08:00 +0200 Subject: [PATCH] Adding dugeons --- .../BetterGen/generator/BetterNormal.php | 2 +- src/Ad5001/BetterGen/structure/Dungeons.php | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/Ad5001/BetterGen/structure/Dungeons.php diff --git a/src/Ad5001/BetterGen/generator/BetterNormal.php b/src/Ad5001/BetterGen/generator/BetterNormal.php index 9acc304..ec2c1c0 100644 --- a/src/Ad5001/BetterGen/generator/BetterNormal.php +++ b/src/Ad5001/BetterGen/generator/BetterNormal.php @@ -276,7 +276,7 @@ class BetterNormal extends Generator { } $b = self::$biomes[( string) round($rainfall, 1)]; foreach($b as $t => $biome) { - if ($temperature <=(float) $t) { + if ($temperature <= (float) $t) { $ret = $biome; break; } diff --git a/src/Ad5001/BetterGen/structure/Dungeons.php b/src/Ad5001/BetterGen/structure/Dungeons.php new file mode 100644 index 0000000..7d62086 --- /dev/null +++ b/src/Ad5001/BetterGen/structure/Dungeons.php @@ -0,0 +1,62 @@ +, XenialDan + * @link https://github.com/Ad5001/BetterGen + * @category World Generator + * @api 3.0.0 + * @version 1.1 + */ + +namespace Ad5001\BetterGen\structure; + +use Ad5001\BetterGen\utils\BuildingUtils; +use pocketmine\block\Block; +use pocketmine\level\ChunkManager; +use pocketmine\level\generator\object\Object; +use pocketmine\math\Vector3; +use pocketmine\utils\Random; + +class Dungeons extends Object { + public $overridable = [ + Block::AIR => true, + 17 => true, + Block::SNOW_LAYER => true, + Block::LOG2 => true + ]; + /** @var int */ + protected $height; + + /** + * Places a bush + * + * @param ChunkManager $level + * @param int $x + * @param int $y + * @param int $z + * @param Random $random + * @return void + */ + public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) { + $xDepth = 2 + $random->nextBoundedInt(4); + $zDepth = 2 + $random->nextBoundedInt(4); + BuildingUtils::fillCallback(new Vector3($x + $xDepth, $y, $x + $zDepth), new Vector3($x - $xDepth, $y, $z - $zDepth), function($v3, $level, $v3n2, $xDepth, $zDepth, $random) { + if($v3->x == $v3n2->x + $xDepth || $v3->x == $v3n2->x - $xDepth || $v3->y == $v3n2->y || $v3->y == $v3n2->y + 5 || $v3->z == $v3n2->z + $zDepth || $v3->z == $v3n2->z - $zDepth) { + if($random->nextBoolean()) { + $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::MOSSY_STONE); + } else { + $level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::COBBLESTONE); + + } + } + }, $level, new Vector3($x, $y, $z), $xDepth, $zDepth, $random); + $level->setBlockIdAt($x, $y + 1, $z, Block::MOB_SPAWNER); + } +} \ No newline at end of file