From 58b4870feeffc4c9801cea5aa42e757de5d8971c Mon Sep 17 00:00:00 2001
From: thebigsmileXD <thebigsmilexd@gmail.com>
Date: Sun, 14 May 2017 07:58:25 +0200
Subject: [PATCH 1/3] Add default addon submodule for lootfiles, Reformatting,
 fix structure command #20, cleanups, Looting file replacement

---
 .gitmodules                                   |   3 +
 plugin.yml                                    |  12 +-
 resources/loots/mineshaft.json                | 183 --------
 resources/loots/temple.json                   | 154 -------
 resources/mcpe-default-addon                  |   1 +
 src/Ad5001/BetterGen/Main.php                 | 214 ++++-----
 src/Ad5001/BetterGen/biome/BetterDesert.php   |  78 ++--
 src/Ad5001/BetterGen/biome/BetterForest.php   |  73 +--
 .../BetterGen/biome/BetterIcePlains.php       |  39 +-
 src/Ad5001/BetterGen/biome/BetterMesa.php     | 131 +++---
 .../BetterGen/biome/BetterMesaPlains.php      | 129 +++---
 src/Ad5001/BetterGen/biome/BetterRiver.php    |  47 +-
 src/Ad5001/BetterGen/biome/Mountainable.php   |  10 +-
 .../generator/BetterBiomeSelector.php         |  50 +-
 .../BetterGen/generator/BetterNormal.php      | 432 +++++++++---------
 src/Ad5001/BetterGen/loot/LootTable.php       | 240 ++++++----
 .../BetterGen/populator/AmountPopulator.php   |  58 +--
 .../BetterGen/populator/BushPopulator.php     |  30 +-
 .../BetterGen/populator/CactusPopulator.php   |  27 +-
 .../BetterGen/populator/CavePopulator.php     |  69 +--
 .../BetterGen/populator/DeadbushPopulator.php |  27 +-
 .../populator/FallenTreePopulator.php         |  19 +-
 .../populator/FloatingIslandPopulator.php     | 126 +++--
 .../BetterGen/populator/IglooPopulator.php    |  26 +-
 .../BetterGen/populator/LakePopulator.php     |  40 +-
 .../populator/MineshaftPopulator.php          | 119 ++---
 .../BetterGen/populator/RavinePopulator.php   |  54 +--
 .../populator/SugarCanePopulator.php          |  27 +-
 .../BetterGen/populator/TemplePopulator.php   |  22 +-
 .../BetterGen/populator/TreePopulator.php     |  44 +-
 .../BetterGen/populator/WellPopulator.php     |  22 +-
 src/Ad5001/BetterGen/structure/Bush.php       |  42 +-
 src/Ad5001/BetterGen/structure/Cactus.php     |  22 +-
 src/Ad5001/BetterGen/structure/FallenTree.php |  88 ++--
 src/Ad5001/BetterGen/structure/Igloo.php      | 292 ++++++------
 src/Ad5001/BetterGen/structure/SakuraTree.php |   8 +-
 src/Ad5001/BetterGen/structure/SugarCane.php  |  20 +-
 src/Ad5001/BetterGen/structure/Temple.php     |   4 +-
 src/Ad5001/BetterGen/structure/Well.php       | 102 ++---
 src/Ad5001/BetterGen/utils/BuildingUtils.php  | 197 ++++----
 src/Ad5001/BetterGen/utils/CommonUtils.php    |  32 +-
 41 files changed, 1522 insertions(+), 1791 deletions(-)
 create mode 100644 .gitmodules
 delete mode 100644 resources/loots/mineshaft.json
 delete mode 100644 resources/loots/temple.json
 create mode 160000 resources/mcpe-default-addon

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..6fcdd61
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "resources/mcpe-default-addon"]
+	path = resources/mcpe-default-addon
+	url = https://github.com/dktapps/mcpe-default-addon.git
diff --git a/plugin.yml b/plugin.yml
index 03e96c0..4aa625f 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -10,11 +10,11 @@
 # @author Ad5001
 # @link https://github.com/Ad5001/BetterGen
 name: BetterGen
-author: Ad5001
+authors: Ad5001, XenialDan
 main: Ad5001\BetterGen\Main
-version: 1.1
+version: 2.0
 load: STARTUP
-api: [3.0.1, 3.0.0-ALPHA3]
+api: [3.0.0-ALPHA3, 3.0.0-ALPHA5]
 commands:
     createworld:
         description: Generates a new world.
@@ -24,9 +24,9 @@ commands:
         description: Teleports you to an another world
         usage: "/worldtp <world name>"
         permission: bettergen.cmd.worldtp
-    temple:
-        description: Spawns a temple for debugging
-        usage: "/temple"
+    structure:
+        description: Spawns a structure for debugging
+        usage: "/structure <type>"
         permission: bettergen.cmd.debug
 permissions:
     bettergen.cmd.createworld:
diff --git a/resources/loots/mineshaft.json b/resources/loots/mineshaft.json
deleted file mode 100644
index 9f326e5..0000000
--- a/resources/loots/mineshaft.json
+++ /dev/null
@@ -1,183 +0,0 @@
-{
-	"max": 27,
-	"rail": {
-		"percentage": 79,
-		"minCount": 4,
-		"maxCount": 8,
-		"minStacks": 3,
-		"maxStacks": 3,
-		"id": 66,
-		"data": 0
-	},
-	"torch": {
-		"percentage": 66,
-		"minCount": 1,
-		"maxCount": 16,
-		"minStacks": 3,
-		"maxStacks": 3,
-		"id": 50,
-		"data": 0
-	},
-	"bread": {
-		"percentage": 45,
-		"minCount": 1,
-		"maxCount": 3,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 297,
-		"data": 0
-	},
-	"name tag": {
-		"percentage": 42,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 297,
-		"data": 0
-	},
-	"coal": {
-		"percentage": 32,
-		"minCount": 3,
-		"maxCount": 8,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 263,
-		"data": 0
-	},
-	"beetroot seeds": {
-		"percentage": 32,
-		"minCount": 2,
-		"maxCount": 4,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 458,
-		"data": 0
-	},
-	"melon seeds": {
-		"percentage": 32,
-		"minCount": 2,
-		"maxCount": 4,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 362,
-		"data": 0
-	},
-	"pumpkin seeds": {
-		"percentage": 32,
-		"minCount": 2,
-		"maxCount": 4,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 361,
-		"data": 0
-	},
-	"iron ingot": {
-		"percentage": 32,
-		"minCount": 1,
-		"maxCount": 5,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 365,
-		"data": 0
-	},
-	"golden apple": {
-		"percentage": 28,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 1,
-		"maxStacks": 1,
-		"id": 322,
-		"data": 0
-	},
-	"activator rail": {
-		"percentage": 27,
-		"minCount": 1,
-		"maxCount": 4,
-		"minStacks": 3,
-		"maxStacks": 3,
-		"id": 126,
-		"data": 0
-	},
-	"detector rail": {
-		"percentage": 27,
-		"minCount": 1,
-		"maxCount": 4,
-		"minStacks": 3,
-		"maxStacks": 3,
-		"id": 28,
-		"data": 0
-	},
-	"powered rail": {
-		"percentage": 27,
-		"minCount": 1,
-		"maxCount": 4,
-		"minStacks": 3,
-		"maxStacks": 3,
-		"id": 27,
-		"data": 0
-	},
-	"lapis lazuli": {
-		"percentage": 17,
-		"minCount": 4,
-		"maxCount": 9,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 351,
-		"data": 4
-	},
-	"redstone": {
-		"percentage": 17,
-		"minCount": 4,
-		"maxCount": 9,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 331,
-		"data": 0
-	},
-	"gold ingot": {
-		"percentage": 17,
-		"minCount": 1,
-		"maxCount": 3,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 366,
-		"data": 0
-	},
-	"enchanted book": {
-		"percentage": 14,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 1,
-		"maxStacks": 1,
-		"id": 403,
-		"data": 0
-	},
-	"diamond": {
-		"percentage": 11,
-		"minCount": 1,
-		"maxCount": 2,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 264,
-		"data": 0
-	},
-	"iron pickaxe": {
-		"percentage": 7,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 1,
-		"maxStacks": 1,
-		"id": 257,
-		"data": 0
-	},
-	"enchanted golden apple": {
-		"percentage": 1,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 1,
-		"maxStacks": 1,
-		"id": 466,
-		"data": 0
-	}
-}
\ No newline at end of file
diff --git a/resources/loots/temple.json b/resources/loots/temple.json
deleted file mode 100644
index 30c5e07..0000000
--- a/resources/loots/temple.json
+++ /dev/null
@@ -1,154 +0,0 @@
-{
-	"max": 27,
-	"bone": {
-		"percentage": 71,
-		"minCount": 4,
-		"maxCount": 6,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 352,
-		"data": 0
-	},
-	"rotten_flesh": {
-		"percentage": 71,
-		"minCount": 3,
-		"maxCount": 7,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 367,
-		"data": 0
-	},
-	"gunpowder": {
-		"percentage": 59,
-		"minCount": 1,
-		"maxCount": 8,
-		"minStacks": 4,
-		"maxStacks": 4,
-		"id": 289,
-		"data": 0
-	},
-	"sand": {
-		"percentage": 59,
-		"minCount": 1,
-		"maxCount": 8,
-		"minStacks": 4,
-		"maxStacks": 4,
-		"id": 12,
-		"data": 0
-	},
-	"string": {
-		"percentage": 59,
-		"minCount": 1,
-		"maxCount": 8,
-		"minStacks": 4,
-		"maxStacks": 4,
-		"id": 287,
-		"data": 0
-	},
-	"spider_eye": {
-		"percentage": 29,
-		"minCount": 1,
-		"maxCount": 3,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 375,
-		"data": 0
-	},
-	"enchanted_book": {
-		"percentage": 24,
-		"minCount": 1,
-		"maxCount": 1,
-		"id": 403,
-		"data": 0
-	},
-	"saddle": {
-		"percentage": 24,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 329,
-		"data": 0
-	},
-	"golden_apple": {
-		"percentage": 24,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 1,
-		"maxStacks": 1,
-		"id": 322,
-		"data": 0
-	},
-	"gold_ingot": {
-		"percentage": 18,
-		"minCount": 2,
-		"maxCount": 7,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 266,
-		"data": 0
-	},
-	"iron_ingot": {
-		"percentage": 18,
-		"minCount": 1,
-		"maxCount": 5,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 265,
-		"data": 0
-	},
-	"emerald": {
-		"percentage": 18,
-		"minCount": 1,
-		"maxCount": 3,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 388,
-		"data": 0
-	},
-	"iron_horse_armor": {
-		"percentage": 18,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 417,
-		"data": 0
-	},
-	"gold_horse_armor": {
-		"percentage": 12,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 418,
-		"data": 0
-	},
-	"diamond": {
-		"percentage": 6,
-		"minCount": 1,
-		"maxCount": 3,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 264,
-		"data": 0
-	},
-	"diamond_horse_armor": {
-		"percentage": 6,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 419,
-		"data": 0
-	},
-	"enchanted_golden_apple": {
-		"percentage": 3,
-		"minCount": 1,
-		"maxCount": 1,
-		"minStacks": 2,
-		"maxStacks": 4,
-		"id": 466,
-		"data": 0
-	}
-}
\ No newline at end of file
diff --git a/resources/mcpe-default-addon b/resources/mcpe-default-addon
new file mode 160000
index 0000000..f74c058
--- /dev/null
+++ b/resources/mcpe-default-addon
@@ -0,0 +1 @@
+Subproject commit f74c0588519ea390f5a09270d9c5d28d53e2de57
diff --git a/src/Ad5001/BetterGen/Main.php b/src/Ad5001/BetterGen/Main.php
index 4c0ded0..e3ed7ff 100644
--- a/src/Ad5001/BetterGen/Main.php
+++ b/src/Ad5001/BetterGen/Main.php
@@ -17,44 +17,52 @@ namespace Ad5001\BetterGen;
 use Ad5001\BetterGen\biome\BetterForest;
 use Ad5001\BetterGen\generator\BetterNormal;
 use Ad5001\BetterGen\loot\LootTable;
+use Ad5001\BetterGen\structure\FallenTree;
+use Ad5001\BetterGen\structure\Igloo;
+use Ad5001\BetterGen\structure\SakuraTree;
 use Ad5001\BetterGen\structure\Temple;
+use Ad5001\BetterGen\structure\Well;
 use pocketmine\block\Block;
 use pocketmine\command\Command;
 use pocketmine\command\CommandSender;
-use pocketmine\command\ConsoleCommandSender;
 use pocketmine\event\block\BlockBreakEvent;
-use pocketmine\event\level\ChunkPopulateEvent;
 use pocketmine\event\Listener;
 use pocketmine\event\player\PlayerInteractEvent;
 use pocketmine\level\generator\biome\Biome;
 use pocketmine\level\generator\Generator;
+use pocketmine\level\generator\object\OakTree;
+use pocketmine\level\Position;
 use pocketmine\nbt\tag\CompoundTag;
 use pocketmine\nbt\tag\IntTag;
 use pocketmine\nbt\tag\ListTag;
 use pocketmine\nbt\tag\StringTag;
 use pocketmine\Player;
 use pocketmine\plugin\PluginBase;
-use pocketmine\tile\Chest;
+use pocketmine\tile\Chest as TileChest;
+use pocketmine\block\Chest;
 use pocketmine\tile\Tile;
 use pocketmine\utils\Config;
 use pocketmine\utils\Random;
+use pocketmine\utils\TextFormat;
 
 class Main extends PluginBase implements Listener {
 	const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f ";
 	const SAKURA_FOREST = 100; // Letting some place for future biomes.
 
-	/*
-	 * Called when the plugin enables
-	 */
 
+	/**
+	 * 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 static function registerBiome(int $id, Biome $biome) {
 		BetterNormal::registerBiome($biome);
 	}
 
-	/*
-	 * Called when the plugin disables
+	/**
+	 * Called when the plugin enables
 	 */
-
 	public function onEnable() {
 		$this->getServer()->getPluginManager()->registerEvents($this, $this);
 		Generator::addGenerator(BetterNormal::class, "betternormal");
@@ -64,15 +72,10 @@ class Main extends PluginBase implements Listener {
 			file_put_contents(LootTable::getPluginFolder() . "processingLoots.json", "{}");
 	}
 
-	/*
-	 * Called when one of the defined commands of the plugin has been called
-	 * @param $sender \pocketmine\command\CommandSender
-	 * @param $cmd \pocketmine\command\Command
-	 * @param $label mixed
-	 * @param $args array
-	 * return bool
+	/**
+	 * Check if it's a Tesseract like namespace
+	 * @return 	bool
 	 */
-
 	public static function isOtherNS() {
 		try {
 			return @class_exists("pocketmine\\level\\generator\\normal\\object\\OakTree");
@@ -81,24 +84,22 @@ class Main extends PluginBase implements Listener {
 		}
 	}
 
-	/*
-	 * Registers a forest type.
-	 * @param $name string
-	 * @param $treeClass string
-	 * @params $infos Array(temperature, rainfall)
-	 * @return bool
-	 */
 
+	/**
+	 * Called when the plugin disables
+	 */
 	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
-	 */
 
+	/**
+	 * 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
+	 */
 	public function onCommand(CommandSender $sender, Command $cmd, $label, array $args): bool {
 		switch ($cmd->getName()) {
 			case "createworld": // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
@@ -179,49 +180,90 @@ class Main extends PluginBase implements Listener {
 				return true;
 				break;
 			case "worldtp":
-				if(isset($args[0])) {
-					if(is_null($this->getServer()->getLevelByName($args[0]))) {
+				if (!$sender instanceof Player) {
+					$sender->sendMessage(TextFormat::RED . 'You can\'t use this command');
+					return true;
+				}
+				/** @var Player $sender */
+				if (isset($args[0])) {
+					if (is_null($this->getServer()->getLevelByName($args[0]))) {
 						$this->getServer()->loadLevel($args[0]);
-						if(is_null($this->getServer()->getLevelByName($args[0]))) {
+						if (is_null($this->getServer()->getLevelByName($args[0]))) {
 							$sender->sendMessage("Could not find level {$args[0]}.");
 							return false;
 						}
 					}
-					$sender->teleport(\pocketmine\level\Position::fromObject($player, $this->getServer()->getLevelByName($args[0])));
+					$sender->teleport(Position::fromObject($sender, $this->getServer()->getLevelByName($args[0])));
 					$sender->sendMessage("§aTeleporting to {$args[0]}...");
 					return true;
 				} else {
 					return false;
 				}
 				break;
-			case 'temple':{
-				if($sender instanceof ConsoleCommandSender) return false;
+			case 'structure': {
+				if (!$sender instanceof Player) {
+					$sender->sendMessage(TextFormat::RED . 'You can\'t use this command');
+					return true;
+				}
 				/** @var Player $sender */
-				$temple = new Temple();
-				$temple->placeObject($sender->getLevel(), $sender->x, $sender->y, $sender->z, new Random(microtime()));
+				if (isset($args[0])) {
+					switch ($args[0]) {
+						case 'temple': {
+							$temple = new Temple();
+							$temple->placeObject($sender->getLevel(), $sender->x, $sender->y, $sender->z, new Random(microtime()));
+							return true;
+						}
+							break;
+						case 'fallen': {
+							$temple = new FallenTree(new OakTree());
+							$temple->placeObject($sender->getLevel(), $sender->x, $sender->y, $sender->z);
+							return true;
+						}
+							break;
+						case 'igloo': {
+							$temple = new Igloo();
+							$temple->placeObject($sender->getLevel(), $sender->x, $sender->y, $sender->z, new Random(microtime()));
+							return true;
+						}
+							break;
+						case 'well': {
+							$temple = new Well();
+							$temple->placeObject($sender->getLevel(), $sender->x, $sender->y, $sender->z, new Random(microtime()));
+							return true;
+						}
+							break;
+						case 'sakura': {
+							$temple = new SakuraTree();
+							$temple->placeObject($sender->getLevel(), $sender->x, $sender->y, $sender->z, new Random(microtime()));
+							return true;
+						}
+							break;
+						default: {
+						}
+					}
+				}
+				$sender->sendMessage(implode(', ', ['temple', 'fallen', 'igloo', 'well', 'sakura']));
 				return true;
 			}
 		}
 		return false;
 	}
 
-	/*
+	/**
 	 * Generates a(semi) random seed.
 	 * @return int
 	 */
-
 	public function generateRandomSeed(): int {
 		return (int)round(rand(0, round(time()) / memory_get_usage(true)) * (int)str_shuffle("127469453645108") / (int)str_shuffle("12746945364"));
 	}
 
-	// Listener
-
-	/*
-	 * Checks after a chunk populates so we an add tiles and loot tables
-	 * @param $event pocketmine\event\level\ChunkPopulateEvent
-	 * @return int
+	/**
+	 * Registers a forest type.
+	 * @param $name string
+	 * @param $treeClass string
+	 * @params $infos Array(temperature, rainfall)
+	 * @return bool
 	 */
-
 	public function registerForest(string $name, string $treeClass, array $infos): bool {
 		if (!@class_exists($treeClass))
 			return false;
@@ -233,65 +275,33 @@ class Main extends PluginBase implements Listener {
 	}
 
 
-	/*
-	 * Checks when a player interacts with a loot chest to create it.
+	/**
+	 * Checks when a player attempts to open a loot chest which is not created yet
+	 * @param PlayerInteractEvent $event
 	 */
-
-	public function onChunkPopulate(ChunkPopulateEvent $event) {
-		$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
-		foreach ($cfg->getAll() as $key => $value) {
-			list($x, $y, $z) = explode(";", $key);
-			if ($value["saveAs"] == "chest" && $event->getLevel()->getBlockIdAt($x, $y, $z) == Block::AIR) {
-				$event->getLevel()->setBlockIdAt($x, $y, $z, Block::CHEST);
-			} else {
-				$cfg->remove($key);
-				$cfg->save();
-			}
-		}
-	}
-
-
-	/*
-	 * Checks when a player breaks a loot chest which is not created to create it
-	 */
-
 	public function onInteract(PlayerInteractEvent $event) {
-		$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
-		if ($event->getBlock()->getId() !== Block::CHEST) return;
-		if (!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return;
-		$nbt = new CompoundTag("", [
-			new ListTag("Items", []),
-			new StringTag("id", Tile::CHEST),
-			new IntTag("x", $event->getBlock()->x),
-			new IntTag("y", $event->getBlock()->y),
-			new IntTag("z", $event->getBlock()->z)
-		]);
-		/** @var Chest $chest */
-		$chest = Tile::createTile(Tile::CHEST, $event->getBlock()->getLevel(), $nbt);
-		$chest->setName("§k(Fake)§r Minecart chest");
-		LootTable::fillChest($chest->getInventory(), $event->getBlock());
+		if (($block = $event->getBlock())->getId() !== Block::CHEST) return;
+		$this->generateLootChest($block);
 	}
 
-	/*
-	* Check if it's a Tesseract like namespace
-	* @return 	bool
-	*/
-
+	/**
+	 * Checks when a player breaks a loot chest which is not created yet
+	 * @param BlockBreakEvent $event
+	 */
 	public function onBlockBreak(BlockBreakEvent $event) {
-		$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
-		if ($event->getBlock()->getId() !== Block::CHEST) return;
-		if (!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return;
-		$nbt = new CompoundTag("", [
-			new ListTag("Items", []),
-			new StringTag("id", Tile::CHEST),
-			new IntTag("x", $event->getBlock()->x),
-			new IntTag("y", $event->getBlock()->y),
-			new IntTag("z", $event->getBlock()->z)
-		]);
-		/** @var Chest $chest */
-		$chest = Tile::createTile(Tile::CHEST, $event->getBlock()->getLevel(), $nbt);
-		$chest->setName("§k(Fake)§r Minecart chest");
-		LootTable::fillChest($chest->getInventory(), $event->getBlock());
-		// $event->setCancelled(); //i think nope. You want to break it with items
+		if (($block = $event->getBlock())->getId() !== Block::CHEST) return;
+		$this->generateLootChest($block);
+	}
+
+	private function generateLootChest(Block $block) {
+		//TODO
+		if (!$block instanceof Chest) return;
+		if (is_null($block->getLevel()->getTile($block))) {
+			//TODO new tile, but no loot, because we don't know which type of loot it is
+			return;
+		}
+		if (!($tile = $block->getLevel()->getTile($block)) instanceof TileChest) return;
+		/** TileChest $tile */
+		$tile->getInventory()->setContents([]);//TODO
 	}
 }
diff --git a/src/Ad5001/BetterGen/biome/BetterDesert.php b/src/Ad5001/BetterGen/biome/BetterDesert.php
index 8a17e9b..f55bb31 100644
--- a/src/Ad5001/BetterGen/biome/BetterDesert.php
+++ b/src/Ad5001/BetterGen/biome/BetterDesert.php
@@ -1,24 +1,25 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
  * @author Ad5001
  * @link https://github.com/Ad5001/BetterGen
  */
+
 namespace Ad5001\BetterGen\biome;
 
+use Ad5001\BetterGen\generator\BetterNormal;
 use Ad5001\BetterGen\populator\CactusPopulator;
 use Ad5001\BetterGen\populator\DeadbushPopulator;
 use Ad5001\BetterGen\populator\SugarCanePopulator;
 use Ad5001\BetterGen\populator\TemplePopulator;
 use Ad5001\BetterGen\populator\WellPopulator;
-use Ad5001\BetterGen\generator\BetterNormal;
 use pocketmine\block\Block;
 use pocketmine\level\generator\biome\Biome;
 use pocketmine\level\generator\normal\biome\SandyBiome;
@@ -29,55 +30,56 @@ class BetterDesert extends SandyBiome implements Mountainable {
 		$deadBush = new DeadbushPopulator ();
 		$deadBush->setBaseAmount(1);
 		$deadBush->setRandomAmount(2);
-		
+
 		$cactus = new CactusPopulator ();
 		$cactus->setBaseAmount(1);
 		$cactus->setRandomAmount(2);
-		
+
 		$sugarCane = new SugarCanePopulator ();
 		$sugarCane->setRandomAmount(20);
 		$sugarCane->setBaseAmount(3);
-		
+
 		$temple = new TemplePopulator ();
-		
+
 		$well = new WellPopulator ();
-		
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Cactus", BetterNormal::$options["delStruct"])) $this->addPopulator($cactus);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Deadbush", BetterNormal::$options["delStruct"])) $this->addPopulator($deadBush);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("SugarCane", BetterNormal::$options["delStruct"])) $this->addPopulator($sugarCane);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Temples", BetterNormal::$options["delStruct"])) $this->addPopulator($temple);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Wells", BetterNormal::$options["delStruct"])) $this->addPopulator($well);
-		
+
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Cactus", BetterNormal::$options["delStruct"])) $this->addPopulator($cactus);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Deadbush", BetterNormal::$options["delStruct"])) $this->addPopulator($deadBush);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("SugarCane", BetterNormal::$options["delStruct"])) $this->addPopulator($sugarCane);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Temples", BetterNormal::$options["delStruct"])) $this->addPopulator($temple);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Wells", BetterNormal::$options["delStruct"])) $this->addPopulator($well);
+
 		$this->setElevation(63, 70);
 		// $this->setElevation(66, 70);
-		
+
 		$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) 
+		$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)
 		]);
 	}
+
 	public function getName(): string {
 		return "BetterDesert";
 	}
-	
-	/*
+
+	/**
 	 * Returns biome id
 	 */
 	public function getId() {
diff --git a/src/Ad5001/BetterGen/biome/BetterForest.php b/src/Ad5001/BetterGen/biome/BetterForest.php
index 36f8ec5..e88b1b5 100644
--- a/src/Ad5001/BetterGen/biome/BetterForest.php
+++ b/src/Ad5001/BetterGen/biome/BetterForest.php
@@ -1,11 +1,11 @@
 <?php
 
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -24,56 +24,47 @@ use pocketmine\level\generator\normal\biome\ForestBiome;
 
 
 class BetterForest extends ForestBiome implements Mountainable {
-	static $types = [ 
-			"Oak Forest",
-			"Birch Forest",
-			"Sakura Forest" 
+	static $types = [
+		"Oak Forest",
+		"Birch Forest",
+		"Sakura Forest"
 	];
-	static $ids = [ 
-			Biome::FOREST,
-			Biome::BIRCH_FOREST,
-			Main::SAKURA_FOREST 
+	static $ids = [
+		Biome::FOREST,
+		Biome::BIRCH_FOREST,
+		Main::SAKURA_FOREST
 	];
+
 	public function __construct($type = 0, array $infos = [0.6, 0.5]) {
 		parent::__construct($type);
-		$this->clearPopulators ();
-		
+		$this->clearPopulators();
+
 		$this->type = $type;
-		
+
 		$bush = new BushPopulator($type);
 		$bush->setBaseAmount(10);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Bushes", BetterNormal::$options["delStruct"])) $this->addPopulator($bush);
-		
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Bushes", BetterNormal::$options["delStruct"])) $this->addPopulator($bush);
+
 		$ft = new FallenTreePopulator($type);
 		$ft->setBaseAmount(0);
 		$ft->setRandomAmount(4);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("FallenTrees", BetterNormal::$options["delStruct"])) $this->addPopulator($ft);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("FallenTrees", BetterNormal::$options["delStruct"])) $this->addPopulator($ft);
 
 		$trees = new TreePopulator($type);
 		$trees->setBaseAmount((null !== @constant(TreePopulator::$types[$type] . "::maxPerChunk")) ? constant(TreePopulator::$types[$type] . "::maxPerChunk") : 5);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Trees", BetterNormal::$options["delStruct"])) $this->addPopulator($trees);
-		
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Trees", BetterNormal::$options["delStruct"])) $this->addPopulator($trees);
+
 		$tallGrass = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\TallGrass () : new \pocketmine\level\generator\populator\TallGrass();
 		$tallGrass->setBaseAmount(3);
-		
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("TallGrass", BetterNormal::$options["delStruct"])) $this->addPopulator($tallGrass);
-		
+
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("TallGrass", BetterNormal::$options["delStruct"])) $this->addPopulator($tallGrass);
+
 		$this->setElevation(63, 69);
-		
+
 		$this->temperature = $infos[0];
 		$this->rainfall = $infos[1];
 	}
-	public function getName() {
-		return str_ireplace(" ", "", self::$types[$this->type]);
-	}
 
-	/**
-	 * Returns the ID relatively.
-	 * @return int
-	 */
-	public function getId() {
-		return self::$ids[$this->type];
-	}
 	/**
 	 * @param string $name
 	 * @param string $treeClass
@@ -87,4 +78,16 @@ class BetterForest extends ForestBiome implements Mountainable {
 		Main::register(Main::SAKURA_FOREST + (count(self::$types) - 2), new BetterForest(count(self::$types) - 1, $infos));
 		return true;
 	}
+
+	public function getName() {
+		return str_ireplace(" ", "", self::$types[$this->type]);
+	}
+
+	/**
+	 * Returns the ID relatively.
+	 * @return int
+	 */
+	public function getId() {
+		return self::$ids[$this->type];
+	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/biome/BetterIcePlains.php b/src/Ad5001/BetterGen/biome/BetterIcePlains.php
index f377073..7221db0 100644
--- a/src/Ad5001/BetterGen/biome/BetterIcePlains.php
+++ b/src/Ad5001/BetterGen/biome/BetterIcePlains.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -22,30 +22,31 @@ use pocketmine\level\generator\normal\biome\SnowyBiome;
 
 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) 
+		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)
 		]);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Igloos", BetterNormal::$options["delStruct"])) $this->addPopulator(new IglooPopulator ());
-				
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Igloos", BetterNormal::$options["delStruct"])) $this->addPopulator(new IglooPopulator ());
+
 		$tallGrass = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\TallGrass() : new \pocketmine\level\generator\populator\TallGrass();
 		$tallGrass->setBaseAmount(3);
-		
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("TallGrass", BetterNormal::$options["delStruct"])) $this->addPopulator($tallGrass);
-		
+
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("TallGrass", BetterNormal::$options["delStruct"])) $this->addPopulator($tallGrass);
+
 		$this->setElevation(63, 74);
-		
+
 		$this->temperature = 0.05;
 		$this->rainfall = 0.8;
 	}
+
 	public function getName() {
 		return "BetterIcePlains";
 	}
-	
+
 	/**
 	 * Returns the biomes' id.
 	 * @return int biome id
diff --git a/src/Ad5001/BetterGen/biome/BetterMesa.php b/src/Ad5001/BetterGen/biome/BetterMesa.php
index 5ae0494..f4ae5f5 100644
--- a/src/Ad5001/BetterGen/biome/BetterMesa.php
+++ b/src/Ad5001/BetterGen/biome/BetterMesa.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -29,86 +29,87 @@ class BetterMesa extends SandyBiome {
 		$deadBush = new DeadbushPopulator ();
 		$deadBush->setBaseAmount(1);
 		$deadBush->setRandomAmount(2);
-		
+
 		$cactus = new CactusPopulator ();
 		$cactus->setBaseAmount(1);
 		$cactus->setRandomAmount(2);
-		
+
 		$sugarCane = new SugarCanePopulator ();
 		$sugarCane->setRandomAmount(20);
 		$sugarCane->setBaseAmount(3);
-		
+
 		$sugarCane = new TreePopulator ();
 		$sugarCane->setRandomAmount(2);
 		$sugarCane->setBaseAmount(0);
-				
+
 		$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) 
+		$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)
 		]);
-		
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Cactus", BetterNormal::$options["delStruct"])) $this->addPopulator($cactus);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("DeadBush", BetterNormal::$options["delStruct"])) $this->addPopulator($deadBush);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("SugarCane", BetterNormal::$options["delStruct"])) $this->addPopulator($sugarCane);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ores", BetterNormal::$options["delStruct"])) $this->addPopulator($ores);
-		
+
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Cactus", BetterNormal::$options["delStruct"])) $this->addPopulator($cactus);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("DeadBush", BetterNormal::$options["delStruct"])) $this->addPopulator($deadBush);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("SugarCane", BetterNormal::$options["delStruct"])) $this->addPopulator($sugarCane);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ores", BetterNormal::$options["delStruct"])) $this->addPopulator($ores);
+
 		$this->setElevation(80, 83);
 		// $this->setElevation(66, 70);
-		
+
 		$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) 
+		$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)
 		]);
 	}
+
 	public function getName(): string {
 		return "BetterMesa";
 	}
-	
-	/*
+
+	/**
 	 * Returns biome id
 	 */
 	public function getId() {
diff --git a/src/Ad5001/BetterGen/biome/BetterMesaPlains.php b/src/Ad5001/BetterGen/biome/BetterMesaPlains.php
index 2fcb936..924ca84 100644
--- a/src/Ad5001/BetterGen/biome/BetterMesaPlains.php
+++ b/src/Ad5001/BetterGen/biome/BetterMesaPlains.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -28,83 +28,84 @@ class BetterMesaPlains extends SandyBiome {
 		$deadBush = new DeadbushPopulator ();
 		$deadBush->setBaseAmount(1);
 		$deadBush->setRandomAmount(2);
-		
+
 		$cactus = new CactusPopulator ();
 		$cactus->setBaseAmount(1);
 		$cactus->setRandomAmount(2);
-		
+
 		$sugarCane = new SugarCanePopulator ();
 		$sugarCane->setRandomAmount(20);
 		$sugarCane->setBaseAmount(3);
 
 		$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) 
+		$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)
 		]);
-		
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Cactus", BetterNormal::$options["delStruct"])) $this->addPopulator($cactus);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("DeadBush", BetterNormal::$options["delStruct"])) $this->addPopulator($deadBush);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("SugarCane", BetterNormal::$options["delStruct"])) $this->addPopulator($sugarCane);
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ores", BetterNormal::$options["delStruct"])) $this->addPopulator($ores);
-		
+
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Cactus", BetterNormal::$options["delStruct"])) $this->addPopulator($cactus);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("DeadBush", BetterNormal::$options["delStruct"])) $this->addPopulator($deadBush);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("SugarCane", BetterNormal::$options["delStruct"])) $this->addPopulator($sugarCane);
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ores", BetterNormal::$options["delStruct"])) $this->addPopulator($ores);
+
 		$this->setElevation(62, 67);
 		// $this->setElevation(66, 70);
-		
+
 		$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) 
+		$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)
 		]);
 	}
+
 	public function getName(): string {
 		return "BetterMesaPlains";
 	}
-	
-	/*
+
+	/**
 	 * Returns biome id
 	 */
 	public function getId() {
diff --git a/src/Ad5001/BetterGen/biome/BetterRiver.php b/src/Ad5001/BetterGen/biome/BetterRiver.php
index 7b6dabc..ac27f24 100644
--- a/src/Ad5001/BetterGen/biome/BetterRiver.php
+++ b/src/Ad5001/BetterGen/biome/BetterRiver.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -19,32 +19,33 @@ use pocketmine\level\generator\biome\Biome;
 
 class BetterRiver extends Biome {
 	public function __construct() {
-		$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) 
+		$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)
 		]);
-		
+
 		$this->setElevation(60, 60);
-		
+
 		$this->temperature = 0.5;
 		$this->rainfall = 0.7;
 	}
+
 	public function getName() {
 		return "BetterRiver";
 	}
-	
-	/*
+
+	/**
 	 * Returns the ID relatively.
 	 */
 	public function getId() {
diff --git a/src/Ad5001/BetterGen/biome/Mountainable.php b/src/Ad5001/BetterGen/biome/Mountainable.php
index f2175a0..8680e48 100644
--- a/src/Ad5001/BetterGen/biome/Mountainable.php
+++ b/src/Ad5001/BetterGen/biome/Mountainable.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
diff --git a/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php b/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php
index e6e200b..62f4cb8 100644
--- a/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php
+++ b/src/Ad5001/BetterGen/generator/BetterBiomeSelector.php
@@ -1,16 +1,17 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
  * @author Ad5001
  * @link https://github.com/Ad5001/BetterGen
-*/
+ */
+
 namespace Ad5001\BetterGen\generator;
 
 use pocketmine\level\generator\biome\Biome;
@@ -19,18 +20,19 @@ use pocketmine\level\generator\noise\Simplex;
 use pocketmine\utils\Random;
 
 class BetterBiomeSelector extends BiomeSelector {
-	
+
 	/** @var Biome */
 	private $fallback;
-	
+
 	/** @var Simplex */
 	private $temperature;
 	/** @var Simplex */
 	private $rainfall;
-	
+
 	/** @var Biome[] */
-	private $biomes = [ ];
+	private $biomes = [];
 	private $lookup;
+
 	public function __construct(Random $random, callable $lookup, Biome $fallback) {
 		parent::__construct($random, $lookup, $fallback);
 		$this->fallback = $fallback;
@@ -38,33 +40,37 @@ class BetterBiomeSelector extends BiomeSelector {
 		$this->temperature = new Simplex($random, 2, 1 / 16, 1 / 512);
 		$this->rainfall = new Simplex($random, 2, 1 / 16, 1 / 512);
 	}
+
 	public function recalculate() {
 	} // Using our own system, No need for that
+
 	public function addBiome(Biome $biome) {
-		$this->biomes[$biome->getId ()] = $biome;
+		$this->biomes[$biome->getId()] = $biome;
 	}
-	public function getTemperature($x, $z) {
-		return ($this->temperature->noise2D($x, $z, true) + 1) / 2;
-	}
-	public function getRainfall($x, $z) {
-		return ($this->rainfall->noise2D($x, $z, true) + 1) / 2;
-	}
-	
+
 	/**
 	 *
 	 * @param
-	 *        	$x
+	 *            $x
 	 * @param
-	 *        	$z
-	 *        	
+	 *            $z
+	 *
 	 * @return Biome
 	 */
 	public function pickBiome($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));
 		return $b;
 	}
+
+	public function getTemperature($x, $z) {
+		return ($this->temperature->noise2D($x, $z, true) + 1) / 2;
+	}
+
+	public function getRainfall($x, $z) {
+		return ($this->rainfall->noise2D($x, $z, true) + 1) / 2;
+	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/generator/BetterNormal.php b/src/Ad5001/BetterGen/generator/BetterNormal.php
index a0c7528..9cda895 100644
--- a/src/Ad5001/BetterGen/generator/BetterNormal.php
+++ b/src/Ad5001/BetterGen/generator/BetterNormal.php
@@ -1,16 +1,16 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
  * @author Ad5001
  * @link https://github.com/Ad5001/BetterGen
-*/
+ */
 
 namespace Ad5001\BetterGen\generator;
 
@@ -47,31 +47,23 @@ use pocketmine\utils\Random;
 
 class BetterNormal extends Generator {
 	const NOT_OVERWRITABLE = [
-			Block::STONE,
-			Block::GRAVEL,
-			Block::BEDROCK,
-			Block::DIAMOND_ORE,
-			Block::GOLD_ORE,
-			Block::LAPIS_ORE,
-			Block::REDSTONE_ORE,
-			Block::IRON_ORE,
-			Block::COAL_ORE,
-			Block::WATER,
-			Block::STILL_WATER 
+		Block::STONE,
+		Block::GRAVEL,
+		Block::BEDROCK,
+		Block::DIAMOND_ORE,
+		Block::GOLD_ORE,
+		Block::LAPIS_ORE,
+		Block::REDSTONE_ORE,
+		Block::IRON_ORE,
+		Block::COAL_ORE,
+		Block::WATER,
+		Block::STILL_WATER
 	];
-	/** @var BetterBiomeSelector */
-	protected $selector;
-	/** @var Level */
-	protected $level;
-	/** @var Random */
-	protected $random;
-	protected $populators = [ ];
-	protected $generationPopulators = [ ];
-	public static $biomes = [ ];
+	public static $biomes = [];
 	/** @var Biome[] */
-	public static $biomeById = [ ];
-	public static $levels = [ ];
-	protected static $GAUSSIAN_KERNEL = null; // From main class
+	public static $biomeById = [];
+	public static $levels = [];
+protected static $GAUSSIAN_KERNEL = null;
 	protected static $SMOOTH_SIZE = 2;
 	protected static $options = [
 		"delBio" => [
@@ -80,51 +72,77 @@ class BetterNormal extends Generator {
 			"Lakes"
 		]
 	];
+	/** @var BetterBiomeSelector */
+	protected $selector;
+	/** @var Level */
+	protected $level;
+		/** @var Random */
+	protected $random; // From main class
+	protected $populators = [];
+	protected $generationPopulators = [];
 	protected $waterHeight = 63;
 	private $noiseBase;
 
-	/*
-	 * Picks a biome by X and Z
-	 * @param	$x	int
-	 * @param	$z 	int
-	 * @return Biome
+	/**
+	 * Constructs the class
+	 * @param $options array
 	 */
-	public function pickBiome($x, $z) {
-		$hash = $x * 2345803 ^ $z * 9236449 ^ $this->level->getSeed ();
-		$hash *= $hash + 223;
-		$xNoise = $hash >> 20 & 3;
-		$zNoise = $hash >> 22 & 3;
-		if ($xNoise == 3) {
-			$xNoise = 1;
+	public function __construct(array $options = []) {
+		self::$options["preset"] = $options["preset"];
+		$options = (array)json_decode($options["preset"]);
+		if (isset($options["delBio"])) {
+			if (is_string($options["de"])) $options["delBio"] = explode(",", $options["delBio"]);
+			if (count($options["delBio"]) !== 0) {
+				self::$options["delBio"] = $options["delBio"];
+			}
 		}
-		if ($zNoise == 3) {
-			$zNoise = 1;
+		if (isset($options["delStruct"])) {
+			if (is_string($options["delStruct"])) $options["delStruct"] = explode(",", $options["delStruct"]);
+			if (count($options["delStruct"]) !== 0) {
+				self::$options["delStruct"] = $options["delStruct"];
+			}
 		}
-		
-		$b = $this->selector->pickBiome($x + $xNoise - 1, $z + $zNoise - 1);
-		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));
+		if (self::$GAUSSIAN_KERNEL === null) {
+			self::generateKernel();
+		}
+	}
+
+	/**
+	 * Generates the generation kernel based on smooth size (here 2)
+	 */
+	private static function generateKernel() {
+		self::$GAUSSIAN_KERNEL = [];
+
+		$bellSize = 1 / self::$SMOOTH_SIZE;
+		$bellHeight = 2 * self::$SMOOTH_SIZE;
+
+		for ($sx = -self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; $sx++) {
+			self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] = [];
+
+			for ($sz = -self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; $sz++) {
+				$bx = $bellSize * $sx;
+				$bz = $bellSize * $sz;
+				self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] [$sz + self::$SMOOTH_SIZE] = $bellHeight * exp(-($bx * $bx + $bz * $bz) / 2);
+			}
 		}
-		return $b;
 	}
 
 	/**
 	 * Inits the class for the var
-	 * @param		ChunkManager		$level
-	 * @param		Random				$random
-	 * @return		void
+	 * @param        ChunkManager $level
+	 * @param        Random $random
+	 * @return        void
 	 */
 	public function init(ChunkManager $level, Random $random) {
 		$this->level = $level;
 		$this->random = $random;
-		
+
 		self::$levels[] = $level;
-		
-		$this->random->setSeed($this->level->getSeed ());
+
+		$this->random->setSeed($this->level->getSeed());
 		$this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 32);
-		$this->random->setSeed($this->level->getSeed ());
-		
+		$this->random->setSeed($this->level->getSeed());
+
 		$this->registerBiome(Biome::getBiome(Biome::OCEAN));
 		$this->registerBiome(Biome::getBiome(Biome::PLAINS));
 		$this->registerBiome(new BetterDesert ());
@@ -134,123 +152,123 @@ class BetterNormal extends Generator {
 		$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(0, [
+			0.6,
+			0.5
 		]));
-		$this->registerBiome(new BetterForest(1, [ 
-				0.7,
-				0.8 
+		$this->registerBiome(new BetterForest(1, [
+			0.7,
+			0.8
 		]));
-		$this->registerBiome(new BetterForest(2, [ 
-				0.6,
-				0.4 
+		$this->registerBiome(new BetterForest(2, [
+			0.6,
+			0.4
 		]));
-		
-		$this->selector = new BetterBiomeSelector($random, [ 
-				self::class,
-				"getBiome" 
+
+		$this->selector = new BetterBiomeSelector($random, [
+			self::class,
+			"getBiome"
 		], 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);
 			}
 		}
-		
-		$this->selector->recalculate ();
-		
+
+		$this->selector->recalculate();
+
 		$cover = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\GroundCover() : new \pocketmine\level\generator\populator\GroundCover();
 		$this->generationPopulators[] = $cover;
-		
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Lakes", self::$options["delStruct"])) {
+
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Lakes", self::$options["delStruct"])) {
 			$lake = new LakePopulator();
 			$lake->setBaseAmount(0);
 			$lake->setRandomAmount(1);
 			$this->generationPopulators[] = $lake;
 		}
 
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Caves", self::$options["delStruct"])) {
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Caves", self::$options["delStruct"])) {
 			$cave = new CavePopulator ();
 			$cave->setBaseAmount(0);
 			$cave->setRandomAmount(2);
 			$this->generationPopulators[] = $cave;
 		}
 
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ravines", self::$options["delStruct"])) {
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ravines", self::$options["delStruct"])) {
 			$ravine = new RavinePopulator ();
 			$ravine->setBaseAmount(0);
 			$ravine->setRandomAmount(51);
 			$this->generationPopulators[] = $ravine;
 		}
 
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Mineshafts", self::$options["delStruct"])) {
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Mineshafts", self::$options["delStruct"])) {
 			$mineshaft = new MineshaftPopulator ();
 			$mineshaft->setBaseAmount(0);
 			$mineshaft->setRandomAmount(102);
 			$this->populators[] = $mineshaft;
 		}
 
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("FloatingIslands", self::$options["delStruct"])) {
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("FloatingIslands", self::$options["delStruct"])) {
 			$fisl = new FloatingIslandPopulator();
 			$fisl->setBaseAmount(0);
 			$fisl->setRandomAmount(132);
 			$this->populators[] = $fisl;
 		}
 
-		if(!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ores", self::$options["delStruct"])) {
+		if (!\Ad5001\BetterGen\utils\CommonUtils::in_arrayi("Ores", self::$options["delStruct"])) {
 			$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) 
+			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)
 			]);
-			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) 
+			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)
 			]);
 			$this->populators[] = $ores;
 		}
 	}
-	
-	/*
+
+	/**
 	 * Adds a biome to the selector. Do not use this method directly use Main::registerBiome which registers it properly
 	 * @param $biome Biome
 	 * @return bool
 	 */
 	public static function registerBiome(Biome $biome): bool {
-		if(\Ad5001\BetterGen\utils\CommonUtils::in_arrayi($biome->getName(), self::$options["delBio"])) {
+		if (\Ad5001\BetterGen\utils\CommonUtils::in_arrayi($biome->getName(), self::$options["delBio"])) {
 			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;
 	}
-	
-	/*
+
+	/**
 	 * Returns a biome by temperature
 	 * @param $temperature float
 	 * @param $rainfall float
 	 */
 	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 (!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)
@@ -261,9 +279,9 @@ class BetterNormal extends Generator {
 					$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;
 			}
@@ -273,46 +291,37 @@ class BetterNormal extends Generator {
 		}
 		return $ret;
 	}
-	
-	/*
-	 * Returns a biome by its id
-	 * @param 	$id 	int
-	 * @return	Biome
-	 */
-	public function getBiomeById(int $id): Biome {
-		return self::$biomeById[$id] ?? self::$biomeById[Biome::OCEAN];
-	}
-	
-	/*
+
+	/**
 	 * Generates a chunk.
 	 * Cloning method to make it work with new methods.
 	 * @param $chunkX int
 	 * @param $chunkZ int
 	 */
 	public function generateChunk($chunkX, $chunkZ) {
-		
-		$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed ());
-		
+
+		$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());
+
 		$noise = Generator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 8, 4, $chunkX * 16, 0, $chunkZ * 16);
-		
+
 		$chunk = $this->level->getChunk($chunkX, $chunkZ);
-		
-		$biomeCache = [ ];
-		
-		for($x = 0; $x < 16; $x++) {
-			for($z = 0; $z < 16; $z++) {
+
+		$biomeCache = [];
+
+		for ($x = 0; $x < 16; $x++) {
+			for ($z = 0; $z < 16; $z++) {
 				$minSum = 0;
 				$maxSum = 0;
 				$weightSum = 0;
-				
+
 				$biome = $this->pickBiome($chunkX * 16 + $x, $chunkZ * 16 + $z);
-				$chunk->setBiomeId($x, $z, $biome->getId ());
-				
-				for($sx = - self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; $sx++) {
-					for($sz = - self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; $sz++) {
-						
+				$chunk->setBiomeId($x, $z, $biome->getId());
+
+				for ($sx = -self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; $sx++) {
+					for ($sz = -self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; $sz++) {
+
 						$weight = self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] [$sz + self::$SMOOTH_SIZE];
-						
+
 						if ($sx === 0 and $sz === 0) {
 							$adjacent = $biome;
 						} else {
@@ -323,25 +332,25 @@ class BetterNormal extends Generator {
 								$biomeCache[$index] = $adjacent = $this->pickBiome($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz);
 							}
 						}
-						$minSum += ($adjacent->getMinElevation () - 1) * $weight;
-						$maxSum += $adjacent->getMaxElevation () * $weight;
-						
+						$minSum += ($adjacent->getMinElevation() - 1) * $weight;
+						$maxSum += $adjacent->getMaxElevation() * $weight;
+
 						$weightSum += $weight;
 					}
 				}
-				
+
 				$minSum /= $weightSum;
 				$maxSum /= $weightSum;
-				
+
 				$smoothHeight = ($maxSum - $minSum) / 2;
-				
-				for($y = 0; $y < 128; $y++) {
-					if ($y < 3 || ($y < 5 && $this->random->nextBoolean ())) {
+
+				for ($y = 0; $y < 128; $y++) {
+					if ($y < 3 || ($y < 5 && $this->random->nextBoolean())) {
 						$chunk->setBlockId($x, $y, $z, Block::BEDROCK);
 						continue;
 					}
 					$noiseValue = $noise[$x] [$z] [$y] - 1 / $smoothHeight * ($y - $smoothHeight - $minSum);
-					
+
 					if ($noiseValue > 0) {
 						$chunk->setBlockId($x, $y, $z, Block::STONE);
 					} elseif ($y <= $this->waterHeight) {
@@ -350,118 +359,111 @@ class BetterNormal extends Generator {
 				}
 			}
 		}
-		
-		foreach($this->generationPopulators as $populator) {
+
+		foreach ($this->generationPopulators as $populator) {
 			$populator->populate($this->level, $chunkX, $chunkZ, $this->random);
 		}
 	}
-	
-	/*
+
+	/**
+	 * Picks a biome by X and Z
+	 * @param    $x    int
+	 * @param    $z    int
+	 * @return Biome
+	 */
+	public function pickBiome($x, $z) {
+		$hash = $x * 2345803 ^ $z * 9236449 ^ $this->level->getSeed();
+		$hash *= $hash + 223;
+		$xNoise = $hash >> 20 & 3;
+		$zNoise = $hash >> 22 & 3;
+		if ($xNoise == 3) {
+			$xNoise = 1;
+		}
+		if ($zNoise == 3) {
+			$zNoise = 1;
+		}
+
+		$b = $this->selector->pickBiome($x + $xNoise - 1, $z + $zNoise - 1);
+		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));
+		}
+		return $b;
+	}
+
+	/**
 	 * Populates a chunk.
 	 * @param $chunkX int
 	 * @param $chunk2 int
 	 */
 	public function populateChunk($chunkX, $chunkZ) {
-		$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed ());
-		foreach($this->populators as $populator) {
+		$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());
+		foreach ($this->populators as $populator) {
 			$populator->populate($this->level, $chunkX, $chunkZ, $this->random);
 		}
-		
+
 		// Filling lava (lakes & rivers underground)...
-		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))
+		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))
 						$this->level->setBlockIdAt($x, $y, $z, Block::LAVA);
 				}
-		
+
 		$chunk = $this->level->getChunk($chunkX, $chunkZ);
 		$biome = self::getBiomeById($chunk->getBiomeId(7, 7));
 		$biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random);
 	}
-	
-	/*
-	 * Constructs the class
-	 * @param $options array
+
+	/**
+	 * Returns a biome by its id
+	 * @param    $id    int
+	 * @return    Biome
 	 */
-	public function __construct(array $options = []) {
-		self::$options["preset"] = $options["preset"];
-		$options = (array) json_decode($options["preset"]);
-		if(isset($options["delBio"])) {
-			if(is_string($options["de"])) $options["delBio"] = explode(",", $options["delBio"]);
-			if(count($options["delBio"]) !== 0) {
-				self::$options["delBio"] = $options["delBio"];
-			}
-		}
-		if(isset($options["delStruct"])) {
-			if(is_string($options["delStruct"])) $options["delStruct"] = explode(",", $options["delStruct"]);
-			if(count($options["delStruct"]) !== 0) {
-				self::$options["delStruct"] = $options["delStruct"];
-			}
-		}
-		if (self::$GAUSSIAN_KERNEL === null) {
-			self::generateKernel ();
-		}
+	public function getBiomeById(int $id): Biome {
+		return self::$biomeById[$id] ?? self::$biomeById[Biome::OCEAN];
 	}
-	
-	/*
-	 * Generates the generation kernel based on smooth size (here 2)
-	 */
-	private static function generateKernel() {
-		self::$GAUSSIAN_KERNEL = [ ];
-		
-		$bellSize = 1 / self::$SMOOTH_SIZE;
-		$bellHeight = 2 * self::$SMOOTH_SIZE;
-		
-		for($sx = - self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; $sx++) {
-			self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] = [ ];
-			
-			for($sz = - self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; $sz++) {
-				$bx = $bellSize * $sx;
-				$bz = $bellSize * $sz;
-				self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] [$sz + self::$SMOOTH_SIZE] = $bellHeight * exp(- ($bx * $bx + $bz * $bz) / 2);
-			}
-		}
-	}
-	
+
 	//  Returns the name of the generator
+
 	public function getName() {
 		return "betternormal";
 	}
-	
-	/*
+
+	/**
 	 * Gives the generators settings.
 	 * @return array
 	 */
 	public function getSettings(): array {
 		return self::$options;
 	}
+
 	public function getSpawn() {
 		return new Vector3(127.5, 128, 127.5);
 	}
-	
-	/*
+
+	/**
 	 * Returns a safe spawn location
 	 */
 	public function getSafeSpawn() {
 		return new Vector3(127.5, $this->getHighestWorkableBlock(127, 127), 127.5);
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL) {
 				break;
 			} elseif ($b !== 0 and $b !== Block::SNOW_LAYER) {
-				return - 1;
+				return -1;
 			}
 		}
-		
+
 		return ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/loot/LootTable.php b/src/Ad5001/BetterGen/loot/LootTable.php
index 24c0cdf..c613ebd 100644
--- a/src/Ad5001/BetterGen/loot/LootTable.php
+++ b/src/Ad5001/BetterGen/loot/LootTable.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -14,116 +14,154 @@
 
 namespace Ad5001\BetterGen\loot;
 
-use pocketmine\inventory\BaseInventory;
 use pocketmine\item\Item;
-use pocketmine\math\Vector3;
-use pocketmine\nbt\NBT;
+use pocketmine\item\Tool;
+use pocketmine\Server;
 use pocketmine\utils\Config;
 use pocketmine\utils\Random;
 
-/*
- * This class is used for loot setting.
- * Please note that they AREN'T as powerful as PC ones due to some implementations limitations.
- * Loot table format:
- * {
- * "max": Max number of loots (storable amount)
- * "example": {
- * "percentage": Chance of appearing(in percent)
- * "minCount": Minimal count
- * "maxCount": Maximal count
- * "id": Id of the item
- * "data": Item damage
- * "tags": {"display": {"Name": "Example NBT data"}}. This parameter is optional
- * "minStacks": If chosen, the minimum amount of stacks that can be found
- * "maxStacks": If chosen the maximum number of stacks that can be chosen
- * }
- * }
- */
 class LootTable {
-	const LOOT_NAMES = [
-			"temple",
-			"igloo",
-			"mineshaft" 
-	];
-	const LOOT_SAVE = [
-			"chest",
-			"chest",
-			"chest"
-	];
-	const LOOT_DESERT_TEMPLE = 0;
-	const LOOT_IGLOO = 1;
-	const LOOT_MINESHAFT = 2;
-	
-	/*
-	 * Asynchronous loot table choosing
-	 * @param $place pocketmine\math\Vector3
-	 * @param $type int
-	 * @param $random pocketmine\utils\Random
-	 * @return void
+
+	/**
+	 * @var null|Config The lootfile (.json) thats used
 	 */
-	public static function buildLootTable(Vector3 $place, int $type, Random $random) {
-		if($place->y < 1) return; // Making sure sometimes that it doesn't write for nothing
-		$cfg = new Config(self::getPluginFolder() . "processingLoots.json", Config::JSON);
-		$lootsFromJson = json_decode(file_get_contents(self::getResourcesFolder() . "loots/" . self::LOOT_NAMES[$type] . ".json"), true);
-		$loots =[];
-		foreach($lootsFromJson as $loot) {
-			if(is_array($loot) && $random->nextBoundedInt(101) < $loot["percentage"])
-				$loots[] = $loot;
-		}
-		if($lootsFromJson["max"] < count($loots)) {
-			while($lootsFromJson["max"] < count($loots))
-				unset($loots[array_rand($loots)]);
-		}
-		$loots["saveAs"] = self::LOOT_SAVE[$type];
-		$cfg->set($place->x . ";" . $place->y . ";" . $place->z, $loots);
-		$cfg->save();
+	private $lootFile = null;
+
+	/**
+	 * LootTable constructor.
+	 * @param Config $lootFile
+	 */
+	public function __construct(Config $lootFile) {
+		$this->lootFile = $lootFile;
 	}
-	
-	/*
-	 * Synchronous inventory filling with loot table.
-	 * @param $inv pocketmine\inventory\BaseInventory
-	 * @param $pos pocketmine\math\Vector3
-	 * @return void
+
+	/**
+	 * Public function to generate loot. A {@link: \pocketmine\utils\Random} can be passed.
+	 * @param Random|null $random
+	 * @return Item[]
 	 */
-	public static function fillChest(BaseInventory $inv, Vector3 $pos) {
-		$cfg = new Config(self::getPluginFolder() . "processingLoots.json", Config::JSON);	
-		if($cfg->exists($pos->x . ";" . $pos->y . ";" . $pos->z)) {
-			$loots = $cfg->get($pos->x . ";" . $pos->y . ";" . $pos->z);
-			$items = [];
-			foreach($loots as $loot) {
-				if(!is_array($loot)) continue;
-				$randCount = rand($loot["minStacks"], $loot["maxStacks"]);
-				for($i = 0; $i <= $randCount; $i++) {
-					$rand = rand(0, count($loots));
-					$items[$rand] = Item::get($loot["id"], $loot["data"], rand($loot["minCount"], $loot["maxCount"]));
-					if(isset($loot["tags"])) $items[$rand]->setCompoundTag(NBT::parseJSON($loot["tags"]));
+	public function createLoot(Random $random = null) {
+		return self::getRandomLoot($random);
+	}
+
+	/**
+	 * Internal function. Serves as actual file reader + sub-table loader
+	 * Do _NOT_ use this in the source, use LootTable::createLoot instead
+	 * @param Random|null $random
+	 * @return Item[]
+	 */
+	private function getRandomLoot(Random $random = null) {
+		if (is_null($random)) $random = new Random(microtime());
+		$array = [];
+		$items = [];
+		foreach ($this->lootFile->get("pools") as $rolls) {
+			$maxrolls = $rolls["rolls"];//TODO: $rolls["conditions"]
+			while ($maxrolls > 0) {
+				$maxrolls--;
+				foreach ($rolls["entries"] as $index => $entries) {
+					$array[] = $entries["weight"]??1;
 				}
 			}
-			$inv->setContents($items);
-			$cfg->remove($pos->x . ";" . $pos->y . ";" . $pos->z);
-			$cfg->save();
+			$val = $rolls["entries"][$this->getRandomWeightedElement($array)];
+			//typecheck
+			if ($val["type"] == "loot_table") {
+				$loottable = new self(new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/" . $val["name"] . ".json", Config::JSON, []));
+				$items = array_merge($items, $loottable->getRandomLoot());
+				unset($loottable);
+			} elseif ($val["type"] == "item") {
+				print $val["name"] . PHP_EOL;
+				//name fix
+				$val["name"] = self::fixItemName($val["name"]);
+				$item = Item::fromString($val["name"]);
+				if (isset($val["functions"])) {
+					foreach ($val["functions"] as $function) {
+						switch ($functionname = $function["function"]) {
+							case "set_damage": {
+								if ($item instanceof Tool) $item->setDamage(mt_rand($function["damage"]["min"] * $item->getMaxDurability(), $function["damage"]["max"] * $item->getMaxDurability()));
+								else $item->setDamage($random->nextRange($function["damage"]["min"], $function["damage"]["max"]));
+							}
+								break;
+							case "set_data": {
+								//fish fix, blame mojang
+								if ($item->getId() == Item::RAW_FISH) {
+									switch ($function["data"]) {
+										case 1:
+											$item = Item::get(Item::RAW_SALMON, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
+											break;
+										case 2:
+											$item = Item::get(Item::CLOWN_FISH, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
+											break;
+										case 3:
+											$item = Item::get(Item::PUFFER_FISH, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
+											break;
+										default:
+											break;
+									}
+								} else $item->setDamage($function["data"]);
+							}
+								break;
+							case "set_count": {
+								$item->setCount($random->nextRange($function["count"]["min"], $function["count"]["max"]));
+							}
+								break;
+							case "furnace_smelt": {
+								/* TODO
+								Mostly bound to conditions (burning)
+                            "conditions": [
+                                {
+                                    "condition": "entity_properties",
+                                    "entity": "this",
+                                    "properties": {
+                                        "on_fire": true
+                                    }
+                                }
+                            ]
+								*/
+							}
+								break;
+							case "enchant_randomly": {
+								//TODO
+							}
+								break;
+							case "enchant_with_levels": {
+								//TODO
+							}
+								break;
+							case "looting_enchant": {
+								//TODO
+							}
+								break;
+							default:
+								assert("Unknown looting table function $functionname, skipping");
+						}
+					}
+				}
+				$items[] = $item;
+			}
 		}
+		return $items;
 	}
-	
-	/*
-	 * Returns the plugins folder.
-	 * @return string
+
+	/**
+	 * TODO: Make random actually useful here.
+	 * @param array $weightedValues
+	 * @return mixed
 	 */
-	public static function getPluginFolder(): string {
-		$dir = explode(DIRECTORY_SEPARATOR, __DIR__);
-		$c = count($dir);
-		unset($dir[$c - 1], $dir[$c - 2], $dir[$c - 3], $dir[$c - 4], $dir[$c - 5]);
-		return str_ireplace("phar://", "", implode(DIRECTORY_SEPARATOR, $dir)) . DIRECTORY_SEPARATOR . "BetterGen" . DIRECTORY_SEPARATOR;
+	private function getRandomWeightedElement(array $weightedValues) {
+		$array = array();
+		foreach ($weightedValues as $key => $weight) {
+			$array = array_merge(array_fill(0, $weight, $key), $array);
+		}
+		return $array[array_rand($array)];
 	}
-	
-	/*
-	 * Returns the resources folder.
-	 * @return string
+
+	/**
+	 * Fixes the item names because #BlameMojang for not changing the id's from PC -> PE
+	 * @param $name
+	 * @return mixed
 	 */
-	public static function getResourcesFolder(): string {
-		$dir = explode(DIRECTORY_SEPARATOR, __DIR__);
-		$c = count($dir);
-		unset($dir[$c - 1], $dir[$c - 2], $dir[$c - 3], $dir[$c - 4]);
-		return str_ireplace("phar://", "", implode(DIRECTORY_SEPARATOR, $dir)) . DIRECTORY_SEPARATOR . "resources" . DIRECTORY_SEPARATOR;
+	private static function fixItemName($name) {
+		//TODO add a switch-case here
+		return $name;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/AmountPopulator.php b/src/Ad5001/BetterGen/populator/AmountPopulator.php
index aee3766..0ea2475 100644
--- a/src/Ad5001/BetterGen/populator/AmountPopulator.php
+++ b/src/Ad5001/BetterGen/populator/AmountPopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -20,48 +20,48 @@ use pocketmine\utils\Random;
 abstract class AmountPopulator extends Populator {
 	protected $baseAmount = 0;
 	protected $randomAmount = 0;
-	
-	/*
+
+	/**
 	 * Crosssoftware class for random amount
 	 */
-	
-	/*
-	 * Sets the random addition amount
-	 * @param $amount int
-	 */
-	public function setRandomAmount(int $amount) {
-		$this->randomAmount = $amount;
-	}
-	
-	/*
-	 * Sets the base addition amount
-	 * @param $amount int
-	 */
-	public function setBaseAmount(int $amount) {
-		$this->baseAmount = $amount;
-	}
-	
-	/*
+
+	/**
 	 * Returns the amount based on random
 	 * @param $random Random
 	 */
 	public function getAmount(Random $random) {
 		return $this->baseAmount + $random->nextRange(0, $this->randomAmount + 1);
 	}
-	
-	/*
+
+	/**
 	 * Returns the base amount
 	 * @return int
 	 */
 	public function getBaseAmount(): int {
 		return $this->baseAmount;
 	}
-	
-	/*
+
+	/**
+	 * Sets the base addition amount
+	 * @param $amount int
+	 */
+	public function setBaseAmount(int $amount) {
+		$this->baseAmount = $amount;
+	}
+
+	/**
 	 * Returns the random additional amount
 	 * @return int
 	 */
 	public function getRandomAmount(): int {
 		return $this->randomAmount;
 	}
+
+	/**
+	 * Sets the random addition amount
+	 * @param $amount int
+	 */
+	public function setRandomAmount(int $amount) {
+		$this->randomAmount = $amount;
+	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/BushPopulator.php b/src/Ad5001/BetterGen/populator/BushPopulator.php
index c1363cb..1ac9137 100644
--- a/src/Ad5001/BetterGen/populator/BushPopulator.php
+++ b/src/Ad5001/BetterGen/populator/BushPopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -24,16 +24,16 @@ class BushPopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
 	protected $type;
-	
-	/*
+
+	/**
 	 * Constructs the class
 	 * @param $type int
 	 */
 	public function __construct($type = 0) {
 		$this->type = $type;
 	}
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -43,7 +43,7 @@ class BushPopulator extends AmountPopulator {
 	public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
 		$this->level = $level;
 		$amount = $this->getAmount($random);
-		for($i = 0; $i < $amount; $i++) {
+		for ($i = 0; $i < $amount; $i++) {
 			$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);
 			$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);
 			$y = $this->getHighestWorkableBlock($x, $z);
@@ -55,22 +55,22 @@ class BushPopulator extends AmountPopulator {
 			$bush->placeObject($level, $x, $y, $z, $random);
 		}
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL) {
 				break;
 			} elseif ($b !== 0 and $b !== Block::SNOW_LAYER) {
-				return - 1;
+				return -1;
 			}
 		}
-		
+
 		return ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/CactusPopulator.php b/src/Ad5001/BetterGen/populator/CactusPopulator.php
index 8475210..12be296 100644
--- a/src/Ad5001/BetterGen/populator/CactusPopulator.php
+++ b/src/Ad5001/BetterGen/populator/CactusPopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -24,15 +24,16 @@ use pocketmine\utils\Random;
 class CactusPopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
-	/*
+
+	/**
 	 * Constructs the class
 	 */
 	public function __construct() {
 		$this->setBaseAmount(1);
 		$this->setRandomAmount(2);
 	}
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -43,7 +44,7 @@ class CactusPopulator extends AmountPopulator {
 		$this->level = $level;
 		$amount = $this->getAmount($random);
 		$cactus = new Cactus ();
-		for($i = 0; $i < $amount; $i++) {
+		for ($i = 0; $i < $amount; $i++) {
 			$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
 			$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);
 			$y = $this->getHighestWorkableBlock($x, $z);
@@ -52,19 +53,19 @@ class CactusPopulator extends AmountPopulator {
 			}
 		}
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y >= 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y >= 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2) {
 				break;
 			}
 		}
-		return $y === 0 ? - 1 : ++$y;
+		return $y === 0 ? -1 : ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/CavePopulator.php b/src/Ad5001/BetterGen/populator/CavePopulator.php
index 6234aad..6608a20 100644
--- a/src/Ad5001/BetterGen/populator/CavePopulator.php
+++ b/src/Ad5001/BetterGen/populator/CavePopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -22,12 +22,12 @@ use pocketmine\math\Vector3;
 use pocketmine\utils\Random;
 
 class CavePopulator extends AmountPopulator {
-	/** @var ChunkManager */
-	protected $level;
 	const STOP = false;
 	const CONTINUE = true;
-	
-	/*
+	/** @var ChunkManager */
+	protected $level;
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -37,7 +37,7 @@ class CavePopulator extends AmountPopulator {
 	public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
 		$this->level = $level;
 		$amount = $this->getAmount($random);
-		for($i = 0; $i < $amount; $i++) {
+		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));
@@ -46,12 +46,12 @@ class CavePopulator extends AmountPopulator {
 		}
 		// echo "Finished Populating chunk $chunkX, $chunkZ !" . PHP_EOL;
 		// Filling water & lava sources randomly
-		for($i = 0; $i < $random->nextBoundedInt(5) + 3; $i ++) {
+		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) {
-				if ($y < 40 && $random->nextBoolean ()) {
+				if ($y < 40 && $random->nextBoolean()) {
 					$level->setBlockIdAt($x, $y, $z, Block::LAVA);
 				} else {
 					$level->setBlockIdAt($x, $y, $z, Block::WATER);
@@ -59,26 +59,26 @@ class CavePopulator extends AmountPopulator {
 			}
 		}
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL or $b === Block::SAND or $b === Block::SNOW_BLOCK or $b === Block::SANDSTONE) {
 				break;
 			} elseif ($b !== 0 and $b !== Block::SNOW_LAYER and $b !== Block::WATER) {
-				return - 1;
+				return -1;
 			}
 		}
-		
+
 		return ++$y;
 	}
-	
-	/*
+
+	/**
 	 * Generates a cave
 	 * @param $x int
 	 * @param $y int
@@ -88,8 +88,8 @@ class CavePopulator extends AmountPopulator {
 	 */
 	public function generateCave($x, $y, $z, Random $random) {
 		$generatedBranches = $random->nextBoundedInt(10) + 1;
-		foreach($gen = $this->generateBranch($x, $y, $z, 5, 3, 5, $random) as $v3) {
-			$generatedBranches --;
+		foreach ($gen = $this->generateBranch($x, $y, $z, 5, 3, 5, $random) as $v3) {
+			$generatedBranches--;
 			if ($generatedBranches <= 0) {
 				$gen->send(self::STOP);
 			} else {
@@ -97,7 +97,8 @@ class CavePopulator extends AmountPopulator {
 			}
 		}
 	}
-	/*
+
+	/**
 	 * Generates a cave branch.
 	 * @param $x int
 	 * @param $y int
@@ -110,29 +111,29 @@ class CavePopulator extends AmountPopulator {
 	 * @return void
 	 */
 	public function generateBranch($x, $y, $z, $length, $height, $depth, Random $random) {
-		if (! (yield new Vector3($x, $y, $z))) {
-			for($i = 0; $i <= 4; $i ++) {
+		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);
 				if ($yP > 12) {
-					$y ++;
-				} elseif ($yP < - 12) {
-					$y --;
+					$y++;
+				} elseif ($yP < -12) {
+					$y--;
 				}
 				$z += round(($random->nextBoundedInt(round(30 * ($depth / 10)) + 1) / 10 - 1));
 				return;
 			}
 		}
 		$repeat = $random->nextBoundedInt(25) + 15;
-		while($repeat-- > 0) {
+		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);
+			$yP = $random->nextRange(-14, 14);
 			if ($yP > 12) {
-				$y ++;
-			} elseif ($yP < - 12) {
-				$y --;
+				$y++;
+			} elseif ($yP < -12) {
+				$y--;
 			}
 			$z += round(($random->nextBoundedInt(round(30 * ($depth / 10)) + 1) / 10 - 1));
 			$height += $random->nextBoundedInt(3) - 1;
@@ -151,8 +152,8 @@ class CavePopulator extends AmountPopulator {
 			if ($height < 7)
 				$height = 7;
 			if ($random->nextBoundedInt(10) == 0) {
-				foreach($generator = $this->generateBranch($x, $y, $z, $length, $height, $depth, $random) as $gen) {
-					if (! (yield $gen))
+				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 a722a21..9cf4886 100644
--- a/src/Ad5001/BetterGen/populator/DeadbushPopulator.php
+++ b/src/Ad5001/BetterGen/populator/DeadbushPopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -14,7 +14,6 @@
 
 namespace Ad5001\BetterGen\populator;
 
-use Ad5001\BetterGen\generator\BetterBiomeSelector;
 use pocketmine\block\Block;
 use pocketmine\level\ChunkManager;
 use pocketmine\level\generator\biome\Biome;
@@ -24,8 +23,8 @@ use pocketmine\utils\Random;
 class DeadbushPopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -35,10 +34,10 @@ class DeadbushPopulator extends AmountPopulator {
 	public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
 		$this->level = $level;
 		$amount = $this->getAmount($random);
-		for($i = 0; $i < $amount; $i++) {
+		for ($i = 0; $i < $amount; $i++) {
 			$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
 			$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;
+			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) {
 				$level->setBlockIdAt($x, $y, $z, Block::DEAD_BUSH);
@@ -53,12 +52,12 @@ class DeadbushPopulator extends AmountPopulator {
 	 * @param $z
 	 * @return int
 	 */
-	private function getHighestWorkableBlock($x, $z){
-		for($y = Level::Y_MAX - 1; $y > 0; --$y){
+	private function getHighestWorkableBlock($x, $z) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
-			if($b === Block::DIRT or $b === Block::GRASS or $b === Block::SAND or $b === Block::SANDSTONE or $b === Block::HARDENED_CLAY or $b === Block::STAINED_HARDENED_CLAY){
+			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::SAND or $b === Block::SANDSTONE or $b === Block::HARDENED_CLAY or $b === Block::STAINED_HARDENED_CLAY) {
 				break;
-			}elseif($b !== Block::AIR){
+			} elseif ($b !== Block::AIR) {
 				return -1;
 			}
 		}
diff --git a/src/Ad5001/BetterGen/populator/FallenTreePopulator.php b/src/Ad5001/BetterGen/populator/FallenTreePopulator.php
index 85c4ef7..72e2808 100644
--- a/src/Ad5001/BetterGen/populator/FallenTreePopulator.php
+++ b/src/Ad5001/BetterGen/populator/FallenTreePopulator.php
@@ -25,7 +25,8 @@ class FallenTreePopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
 	protected $type;
-	/*
+
+	/**
 	 * Constructs the class
 	 * @param $type int
 	 */
@@ -35,7 +36,7 @@ class FallenTreePopulator extends AmountPopulator {
 		$this->setRandomAmount(2);
 	}
 
-	/*
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -45,15 +46,15 @@ class FallenTreePopulator extends AmountPopulator {
 	public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
 		$this->level = $level;
 		$amount = $this->getAmount($random);
-		$tree =  TreePopulator::$types[$this->type];
+		$tree = TreePopulator::$types[$this->type];
 		$fallenTree = new \Ad5001\BetterGen\structure\FallenTree(
 			new $tree()
 		);
-		for($i = 0; $i < $amount; $i++) {
+		for ($i = 0; $i < $amount; $i++) {
 			$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
 			$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 (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)) {
 				$fallenTree->placeObject($level, $x, $y + 1, $z);
 			}
@@ -66,12 +67,12 @@ class FallenTreePopulator extends AmountPopulator {
 	 * @param $z
 	 * @return int
 	 */
-	private function getHighestWorkableBlock($x, $z){
-		for($y = Level::Y_MAX - 1; $y > 0; --$y){
+	private function getHighestWorkableBlock($x, $z) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
-			if($b === Block::DIRT or $b === Block::GRASS){
+			if ($b === Block::DIRT or $b === Block::GRASS) {
 				break;
-			}elseif($b !== Block::AIR and $b !== Block::SNOW_LAYER){
+			} elseif ($b !== Block::AIR and $b !== Block::SNOW_LAYER) {
 				return -1;
 			}
 		}
diff --git a/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php b/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php
index 28795b0..0c72aac 100644
--- a/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php
+++ b/src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php
@@ -1,17 +1,17 @@
-<?php 
+<?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
  * @author Ad5001
  * @link https://github.com/Ad5001/BetterGen
  */
- 
+
 namespace Ad5001\BetterGen\populator;
 
 use Ad5001\BetterGen\generator\BetterNormal;
@@ -32,20 +32,20 @@ use pocketmine\utils\Random;
 
 
 class FloatingIslandPopulator extends AmountPopulator {
-	
-	/*
+
+	/**
 	 * Populate the chunk
-	 * @param $level 	pocketmine\level\ChunkManager
-	 * @param $chunkX 	int
-	 * @param $chunkZ 	int
-	 * @param $random 	pocketmine\utils\Random
+	 * @param $level    pocketmine\level\ChunkManager
+	 * @param $chunkX    int
+	 * @param $chunkZ    int
+	 * @param $random    pocketmine\utils\Random
 	 */
 	/** @var ChunkManager */
 	private $level;
 
 	public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
 		$this->level = $level;
-		if($this->getAmount($random) > 130) {
+		if ($this->getAmount($random) > 130) {
 			$x = $random->nextRange(($chunkX << 4), ($chunkX << 4) + 15);
 			$z = $random->nextRange(($chunkX << 4), ($chunkX << 4) + 15);
 			$y = $random->nextRange($this->getHighestWorkableBlock($x, $z) < 96 ? $this->getHighestWorkableBlock($x, $z) + 20 : $this->getHighestWorkableBlock($x, $z), 126);
@@ -55,21 +55,20 @@ class FloatingIslandPopulator extends AmountPopulator {
 			$chunk = $level->getChunk($chunkX, $chunkZ);
 			$biome = BetterNormal::$biomeById[$chunk->getBiomeId($x % 16, $z % 16)];
 			$populators = $biome->getPopulators();
-			foreach($populators as $populator) {
+			foreach ($populators as $populator) {
 				$populator->populate($level, $chunkX, $chunkZ, $random);
 			}
-		} 
+		}
 	}
-	
-	
-	
-	/*
+
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL or $b === Block::SAND) {
 				break;
@@ -77,39 +76,38 @@ class FloatingIslandPopulator extends AmountPopulator {
 				return 90;
 			}
 		}
-		
+
 		return ++$y;
 	}
-	
-	
-	
-	/*
+
+
+	/**
 	 * Builds a an island shape
-	 * @param 	$level 		pocketmine\level\ChunkManager
-	 * @param 	$pos 		pocketmine\math\Vector3
-	 * @param	$radius		int
-	 * @param 	$random 	pocketmine\utils\Random
-	 * @return 	int			lowest ore point
+	 * @param    $level        pocketmine\level\ChunkManager
+	 * @param    $pos        pocketmine\math\Vector3
+	 * @param    $radius        int
+	 * @param    $random    pocketmine\utils\Random
+	 * @return    int            lowest ore point
 	 */
 	public function buildIslandBottomShape(ChunkManager $level, Vector3 $pos, int $radius, Random $random) {
 		$pos = $pos->round();
 		$currentLen = 1;
 		$hBound = 0;
 		$current = 0;
-		for($y = $pos->y - 1; $radius > 0; $y--) {
-			for($x = $pos->x - $radius; $x <= $pos->x + $radius; $x++) {
-				for($z = $pos->z - $radius; $z <= $pos->z + $radius; $z ++) {
-					if(abs(abs($x - $pos->x) ** 2) + abs(abs($z - $pos->z) ** 2) == ($radius ** 2) * 0.67) {
+		for ($y = $pos->y - 1; $radius > 0; $y--) {
+			for ($x = $pos->x - $radius; $x <= $pos->x + $radius; $x++) {
+				for ($z = $pos->z - $radius; $z <= $pos->z + $radius; $z++) {
+					if (abs(abs($x - $pos->x) ** 2) + abs(abs($z - $pos->z) ** 2) == ($radius ** 2) * 0.67) {
 						$isEdge = true;
 					} else {
 						$isEdge = false;
 					}
-					if(abs(abs($x - $pos->x) ** 2) + abs(abs($z - $pos->z) ** 2) <= ($radius ** 2) * 0.67 && $y < 128) { 
-						if($chunk = $level->getChunk($x >> 4, $z >> 4)) {
+					if (abs(abs($x - $pos->x) ** 2) + abs(abs($z - $pos->z) ** 2) <= ($radius ** 2) * 0.67 && $y < 128) {
+						if ($chunk = $level->getChunk($x >> 4, $z >> 4)) {
 							$biome = BetterNormal::$biomeById[$chunk->getBiomeId($x % 16, $z % 16)];
 							$block = $biome->getGroundCover()[$pos->y - $y - 1] ?? Block::get(Block::STONE);
 							$block = $block->getId();
-						} elseif($random->nextBoundedInt(5) == 0 && $isEdge) {
+						} elseif ($random->nextBoundedInt(5) == 0 && $isEdge) {
 							$block = Block::AIR;
 						} else {
 							$block = Block::STONE;
@@ -121,8 +119,8 @@ class FloatingIslandPopulator extends AmountPopulator {
 			$current++;
 			$oldHB = $hBound;
 			$hBound = $random->nextFloat();
-			if($current >= $currentLen + $hBound) {
-				if($radius == 0) return $pos->y;
+			if ($current >= $currentLen + $hBound) {
+				if ($radius == 0) return $pos->y;
 				$current = 0;
 				$currentLen += 0.3 * ($random->nextFloat() + 0.5);
 				$radius--;
@@ -130,36 +128,34 @@ class FloatingIslandPopulator extends AmountPopulator {
 		}
 		return $pos->y - 1 - $y;
 	}
-	
-	
-	
-	
-	/*
+
+
+	/**
 	 * BPopulate the island with ores
-	 * @param 	$level 		pocketmine\level\ChunkManager
-	 * @param 	$pos 		pocketmine\math\Vector3 
-	 * @param	$width		int
-	 * @param 	$height 	int
-	 * @param 	$random 	pocketmine\utils\Random
-	 * @return 	void
+	 * @param    $level        pocketmine\level\ChunkManager
+	 * @param    $pos        pocketmine\math\Vector3
+	 * @param    $width        int
+	 * @param    $height    int
+	 * @param    $random    pocketmine\utils\Random
+	 * @return    void
 	 */
 	public function populateOres(ChunkManager $level, Vector3 $pos, int $width, int $height, Random $random) {
 		$ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore();
-		if(Main::isOtherNS()) $ores->setOreTypes([
-				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)),
-				new OreType2(new GoldOre (), 2, 8, $pos->y - $height, $pos->y - round($height / 2)),
-				new OreType2(new DiamondOre (), 1, 7, $pos->y - $height, $pos->y - round($height / 4))
+		if (Main::isOtherNS()) $ores->setOreTypes([
+			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)),
+			new OreType2(new GoldOre (), 2, 8, $pos->y - $height, $pos->y - round($height / 2)),
+			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 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)),
-				new OreType(new GoldOre (), 2, 8, $pos->y - $height, $pos->y - round($height / 2)),
-				new OreType(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 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)),
+			new OreType(new GoldOre (), 2, 8, $pos->y - $height, $pos->y - round($height / 2)),
+			new OreType(new DiamondOre (), 1, 7, $pos->y - $height, $pos->y - round($height / 4))
 		]);
 		$ores->populate($level, $pos->x >> 4, $pos->z >> 4, $random);//x z undefined
 	}
diff --git a/src/Ad5001/BetterGen/populator/IglooPopulator.php b/src/Ad5001/BetterGen/populator/IglooPopulator.php
index 6d91bf7..3111ffe 100644
--- a/src/Ad5001/BetterGen/populator/IglooPopulator.php
+++ b/src/Ad5001/BetterGen/populator/IglooPopulator.php
@@ -1,17 +1,17 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
  * @author Ad5001
  * @link https://github.com/Ad5001/BetterGen
  */
- 
+
 namespace Ad5001\BetterGen\populator;
 
 use Ad5001\BetterGen\structure\Igloo;
@@ -23,8 +23,8 @@ use pocketmine\utils\Random;
 class IglooPopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -42,22 +42,22 @@ class IglooPopulator extends AmountPopulator {
 		if ($igloo->canPlaceObject($level, $x, $y, $z, $random))
 			$igloo->placeObject($level, $x, $y, $z, $random);
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL) {
 				break;
 			} elseif ($b !== 0 and $b !== Block::SNOW_LAYER) {
-				return - 1;
+				return -1;
 			}
 		}
-		
+
 		return ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/LakePopulator.php b/src/Ad5001/BetterGen/populator/LakePopulator.php
index f05c826..5451828 100644
--- a/src/Ad5001/BetterGen/populator/LakePopulator.php
+++ b/src/Ad5001/BetterGen/populator/LakePopulator.php
@@ -1,17 +1,17 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
  * @author Ad5001
  * @link https://github.com/Ad5001/BetterGen
  */
- 
+
 namespace Ad5001\BetterGen\populator;
 
 use Ad5001\BetterGen\utils\BuildingUtils;
@@ -24,8 +24,8 @@ use pocketmine\utils\Random;
 class LakePopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -38,35 +38,35 @@ class LakePopulator extends AmountPopulator {
 		$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);
 		$ory = $random->nextRange(20, 63); // Water level
 		$y = $ory;
-		for($i = 0; $i < 4; $i ++) {
-			$x += $random->nextRange(- 1, 1);
-			$y += $random->nextRange(- 1, 1);
-			$z += $random->nextRange(- 1, 1);
+		for ($i = 0; $i < 4; $i++) {
+			$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));
 		}
-		for($xx = $x - 8; $xx <= $x + 8; $xx ++)
-			for($zz = $z - 8; $zz <= $z + 8; $zz ++)
-				for($yy = $ory + 1; $yy <= $y + 3; $yy ++)
+		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)
 						$level->setBlockIdAt($xx, $yy, $zz, Block::AIR);
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL) {
 				break;
 			} elseif ($b !== 0 and $b !== Block::SNOW_LAYER) {
-				return - 1;
+				return -1;
 			}
 		}
-		
+
 		return ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/MineshaftPopulator.php b/src/Ad5001/BetterGen/populator/MineshaftPopulator.php
index 8a24c92..0c4196f 100644
--- a/src/Ad5001/BetterGen/populator/MineshaftPopulator.php
+++ b/src/Ad5001/BetterGen/populator/MineshaftPopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -22,9 +22,6 @@ use pocketmine\math\Vector3;
 use pocketmine\utils\Random;
 
 class MineshaftPopulator extends AmountPopulator {
-	protected $maxPath;
-	/** @var ChunkManager */
-	protected $level;
 	const DIR_XPLUS = 0;
 	const DIR_XMIN = 1;
 	const DIR_ZPLUS = 2;
@@ -32,8 +29,11 @@ class MineshaftPopulator extends AmountPopulator {
 	const TYPE_FORWARD = 0;
 	const TYPE_CROSSPATH = 1;
 	const TYPE_STAIRS = 2;
-	
-	/*
+	protected $maxPath;
+	/** @var ChunkManager */
+	protected $level;
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -52,7 +52,7 @@ class MineshaftPopulator extends AmountPopulator {
 		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) {
+		foreach (array_fill(0, $startingPath, 1) as $hey) {
 			$dir = $random->nextBoundedInt(4);
 			switch ($dir) {
 				case self::DIR_XPLUS :
@@ -80,7 +80,7 @@ class MineshaftPopulator extends AmountPopulator {
 	 * @param Random $random
 	 */
 	public function generateMineshaftPart(int $x, int $y, int $z, int $dir, Random $random) {
-		if ($this->maxPath -- < 1)
+		if ($this->maxPath-- < 1)
 			return;
 		$type = $random->nextBoundedInt(3);
 		$level = $this->level;
@@ -114,10 +114,10 @@ class MineshaftPopulator extends AmountPopulator {
 						$level->setBlockDataAt($x + 1, $y + 2, $z, 2);
 						// Generating chest
 						if ($random->nextBoundedInt(30) == 0) {
-							$direction =(int) $random->nextBoolean ();
+							$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)
@@ -132,7 +132,7 @@ class MineshaftPopulator extends AmountPopulator {
 						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) {
-							
+
 							if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
 								$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
 						}, $this->level);
@@ -155,10 +155,10 @@ class MineshaftPopulator extends AmountPopulator {
 						$level->setBlockDataAt($x - 1, $y + 2, $z, 1);
 						// Generating chest
 						if ($random->nextBoundedInt(30) == 0) {
-							$direction =(int) $random->nextBoolean ();
+							$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)
@@ -173,7 +173,7 @@ class MineshaftPopulator extends AmountPopulator {
 						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) {
-							
+
 							if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
 								$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
 						}, $this->level);
@@ -196,10 +196,10 @@ class MineshaftPopulator extends AmountPopulator {
 						$level->setBlockDataAt($x, $y + 2, $z - 1, 4);
 						// Generating chest
 						if ($random->nextBoundedInt(30) == 0) {
-							$direction =(int) $random->nextBoolean ();
+							$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)
@@ -214,7 +214,7 @@ class MineshaftPopulator extends AmountPopulator {
 						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) {
-							
+
 							if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
 								$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
 						}, $this->level);
@@ -237,10 +237,10 @@ class MineshaftPopulator extends AmountPopulator {
 						$level->setBlockDataAt($x, $y + 2, $z - 1, 3);
 						// Generating chest
 						if ($random->nextBoundedInt(30) == 0) {
-							$direction =(int) $random->nextBoolean ();
+							$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)
@@ -253,7 +253,7 @@ class MineshaftPopulator extends AmountPopulator {
 				}
 				// Doing cobwebs
 				$webNum = $random->nextBoundedInt(5) + 2;
-				for($i = 0; $i < $webNum; $i ++) {
+				for ($i = 0; $i < $webNum; $i++) {
 					$xx = $x + $random->nextBoundedInt(5) - 2;
 					$yy = $y + $random->nextBoundedInt(3);
 					$zz = $z + $random->nextBoundedInt(5) - 2;
@@ -262,61 +262,61 @@ class MineshaftPopulator extends AmountPopulator {
 				}
 				break;
 			case self::TYPE_CROSSPATH :
-				$possiblePathes = [ 
-						self::DIR_XPLUS,
-						self::DIR_XMIN,
-						self::DIR_ZPLUS,
-						self::DIR_ZMIN 
+				$possiblePathes = [
+					self::DIR_XPLUS,
+					self::DIR_XMIN,
+					self::DIR_ZPLUS,
+					self::DIR_ZMIN
 				];
 				switch ($dir) {
 					case self::DIR_XPLUS :
-						$x ++;
+						$x++;
 						unset($possiblePathes[0]);
 						break;
 					case self::DIR_XMIN :
-						$x --;
+						$x--;
 						unset($possiblePathes[1]);
 						break;
 					case self::DIR_ZPLUS :
-						$z ++;
+						$z++;
 						unset($possiblePathes[2]);
 						break;
 					case self::DIR_ZMIN :
-						$z --;
+						$z--;
 						unset($possiblePathes[3]);
 						break;
 				}
-				
+
 				// 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) {
-					
+
 					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::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 ();
+
+				$newFloor = $random->nextBoolean();
 				$numberFloor = $random->nextBoundedInt(4 + ($newFloor ? 5 : 0));
-				$possiblePathes = [ 
-						$possiblePathes,
-						($newFloor ?[ 
-								self::DIR_XPLUS,
-								self::DIR_XMIN,
-								self::DIR_ZPLUS,
-								self::DIR_ZMIN 
-						] : [ ]) 
+				$possiblePathes = [
+					$possiblePathes,
+					($newFloor ? [
+						self::DIR_XPLUS,
+						self::DIR_XMIN,
+						self::DIR_ZPLUS,
+						self::DIR_ZMIN
+					] : [])
 				];
-				for($i = 7; $i > $newFloor; $i --) {
-					$chooseNew =(int) $newFloor && $random->nextBoolean ();
+				for ($i = 7; $i > $newFloor; $i--) {
+					$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);
@@ -348,10 +348,10 @@ class MineshaftPopulator extends AmountPopulator {
 							break;
 					}
 				}
-				
+
 				// Doing cobwebs
 				$webNum = $random->nextBoundedInt(5) + 2;
-				for($i = 0; $i < $webNum; $i ++) {
+				for ($i = 0; $i < $webNum; $i++) {
 					$xx = $x + $random->nextBoundedInt(3) - 1;
 					$yy = $y + $random->nextBoundedInt(6);
 					$zz = $z + $random->nextBoundedInt(3) - 1;
@@ -360,12 +360,12 @@ class MineshaftPopulator extends AmountPopulator {
 				}
 				break;
 			case self::TYPE_STAIRS :
-				if($y <= 5) {
+				if ($y <= 5) {
 					$this->generateMineshaftPart($x, $y, $z, $dir, $random);
 					return;
 				}
 				// Building stairs
-				for($i = 0; $i < 4; $i ++) {
+				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));
@@ -377,7 +377,7 @@ class MineshaftPopulator extends AmountPopulator {
 						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) {
-								
+
 								if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
 									$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
 							}, $this->level);
@@ -385,7 +385,7 @@ class MineshaftPopulator extends AmountPopulator {
 						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) {
-								
+
 								if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
 									$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
 							}, $this->level);
@@ -393,14 +393,14 @@ class MineshaftPopulator extends AmountPopulator {
 						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) {
-								
+
 								if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
 									$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
 							}, $this->level);
 							break;
 					}
 				}
-				
+
 				// Next one
 				switch ($i) {
 					case self::DIR_XPLUS :
@@ -420,4 +420,5 @@ class MineshaftPopulator extends AmountPopulator {
 		}
 	}
 }
+
 ?>
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/RavinePopulator.php b/src/Ad5001/BetterGen/populator/RavinePopulator.php
index c7bcbcd..de0425f 100644
--- a/src/Ad5001/BetterGen/populator/RavinePopulator.php
+++ b/src/Ad5001/BetterGen/populator/RavinePopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -21,11 +21,11 @@ use pocketmine\level\Level;
 use pocketmine\utils\Random;
 
 class RavinePopulator extends AmountPopulator {
+	const NOISE = 250;
 	/** @var ChunkManager */
 	protected $level;
-	const NOISE = 250;
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -44,18 +44,18 @@ class RavinePopulator extends AmountPopulator {
 			$deffZ = $z;
 			$height = $random->nextRange(15, 30);
 			$length = $random->nextRange(5, 12);
-			for($i = 0; $i < $depth; $i ++) {
+			for ($i = 0; $i < $depth; $i++) {
 				$this->buildRavinePart($x, $y, $z, $height, $length, $random);
 				$diffX = $x - $deffX;
 				$diffZ = $z - $deffZ;
 				if ($diffX > $length / 2)
 					$diffX = $length / 2;
-				if ($diffX < - $length / 2)
-					$diffX = - $length / 2;
+				if ($diffX < -$length / 2)
+					$diffX = -$length / 2;
 				if ($diffZ > $length / 2)
 					$diffZ = $length / 2;
-				if ($diffZ < - $length / 2)
-					$diffZ = - $length / 2;
+				if ($diffZ < -$length / 2)
+					$diffZ = -$length / 2;
 				if ($length > 10)
 					$length = 10;
 				if ($length < 5)
@@ -68,26 +68,26 @@ class RavinePopulator extends AmountPopulator {
 			}
 		}
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL or $b === Block::SAND or $b === Block::SNOW_BLOCK or $b === Block::SANDSTONE) {
 				break;
 			} elseif ($b !== 0 and $b !== Block::SNOW_LAYER and $b !== Block::WATER) {
-				return - 1;
+				return -1;
 			}
 		}
-		
+
 		return ++$y;
 	}
-	
-	/*
+
+	/**
 	 * Builds a ravine part
 	 * @param $x int
 	 * @param $y int
@@ -99,29 +99,29 @@ class RavinePopulator extends AmountPopulator {
 	protected function buildRavinePart($x, $y, $z, $height, $length, Random $random) {
 		$xBounded = 0;
 		$zBounded = 0;
-		for($xx = $x - $length; $xx <= $x + $length; $xx ++) {
-			for($yy = $y; $yy <= $y + $height; $yy ++) {
-				for($zz = $z - $length; $zz <= $z + $length; $zz ++) {
+		for ($xx = $x - $length; $xx <= $x + $length; $xx++) {
+			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;
 					$oldZB = $zBounded;
 					$zBounded = $random->nextBoundedInt(self::NOISE * 2) - self::NOISE;
 					if ($xBounded > self::NOISE - 2) {
 						$xBounded = 1;
-					} elseif ($xBounded < - self::NOISE + 2) {
+					} elseif ($xBounded < -self::NOISE + 2) {
 						$xBounded = -1;
 					} else {
 						$xBounded = $oldXB;
 					}
 					if ($zBounded > self::NOISE - 2) {
 						$zBounded = 1;
-					} elseif ($zBounded < - self::NOISE + 2) {
+					} elseif ($zBounded < -self::NOISE + 2) {
 						$zBounded = -1;
 					} 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 13518ae..d41c2b8 100644
--- a/src/Ad5001/BetterGen/populator/SugarCanePopulator.php
+++ b/src/Ad5001/BetterGen/populator/SugarCanePopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -23,15 +23,16 @@ use pocketmine\utils\Random;
 class SugarCanePopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
-	/*
+
+	/**
 	 * Constructs the class
 	 */
 	public function __construct() {
 		$this->setBaseAmount(1);
 		$this->setRandomAmount(2);
 	}
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -42,7 +43,7 @@ class SugarCanePopulator extends AmountPopulator {
 		$this->level = $level;
 		$amount = $this->getAmount($random);
 		$sugarcane = new SugarCane ();
-		for($i = 0; $i < $amount; $i++) {
+		for ($i = 0; $i < $amount; $i++) {
 			$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
 			$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);
 			$y = $this->getHighestWorkableBlock($x, $z);
@@ -51,19 +52,19 @@ class SugarCanePopulator extends AmountPopulator {
 			}
 		}
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y >= 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y >= 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2) {
 				break;
 			}
 		}
-		return $y === 0 ? - 1 : ++$y;
+		return $y === 0 ? -1 : ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/TemplePopulator.php b/src/Ad5001/BetterGen/populator/TemplePopulator.php
index 05295f5..407fab4 100644
--- a/src/Ad5001/BetterGen/populator/TemplePopulator.php
+++ b/src/Ad5001/BetterGen/populator/TemplePopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -23,8 +23,8 @@ use pocketmine\utils\Random;
 class TemplePopulator extends AmountPopulator {
 	/** @var  Level */
 	protected $level;
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -42,20 +42,20 @@ class TemplePopulator extends AmountPopulator {
 		if ($temple->canPlaceObject($level, $x, $y, $z, $random))
 			$temple->placeObject($level, $x, $y - 1, $z, $random);
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::SAND) {
 				break;
 			}
 		}
-		
+
 		return ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/TreePopulator.php b/src/Ad5001/BetterGen/populator/TreePopulator.php
index 7ff5fb3..8dd0f88 100644
--- a/src/Ad5001/BetterGen/populator/TreePopulator.php
+++ b/src/Ad5001/BetterGen/populator/TreePopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -24,30 +24,30 @@ use pocketmine\utils\Random;
 
 class TreePopulator extends AmountPopulator {
 	/** @var Tree[] */
-	static $types = [ 
-			"pocketmine\\level\\generator\\object\\OakTree",
-			"pocketmine\\level\\generator\\object\\BirchTree",
-			"Ad5001\\BetterGen\\structure\\SakuraTree" 
+	static $types = [
+		"pocketmine\\level\\generator\\object\\OakTree",
+		"pocketmine\\level\\generator\\object\\BirchTree",
+		"Ad5001\\BetterGen\\structure\\SakuraTree"
 	];
 	/** @var ChunkManager */
 	protected $level;
 	protected $type;
-	
-	/*
+
+	/**
 	 * Constructs the class
 	 */
 	public function __construct($type = 0) {
 		$this->type = $type;
-		if(Main::isOtherNS()) {
-			self::$types = [ 
+		if (Main::isOtherNS()) {
+			self::$types = [
 				"pocketmine\\level\\generator\\normal\\object\\OakTree",
 				"pocketmine\\level\\generator\\normal\\object\\BirchTree",
-				"Ad5001\\BetterGen\\structure\\SakuraTree" 
+				"Ad5001\\BetterGen\\structure\\SakuraTree"
 			];
 		}
 	}
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -57,7 +57,7 @@ class TreePopulator extends AmountPopulator {
 	public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) {
 		$this->level = $level;
 		$amount = $this->getAmount($random);
-		for($i = 0; $i < $amount; $i++) {
+		for ($i = 0; $i < $amount; $i++) {
 			$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);
 			$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);
 			$y = $this->getHighestWorkableBlock($x, $z);
@@ -70,22 +70,22 @@ class TreePopulator extends AmountPopulator {
 			$tree->placeObject($level, $x, $y, $z, $random);
 		}
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL) {
 				break;
 			} elseif ($b !== 0 and $b !== Block::SNOW_LAYER) {
-				return - 1;
+				return -1;
 			}
 		}
-		
+
 		return ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/populator/WellPopulator.php b/src/Ad5001/BetterGen/populator/WellPopulator.php
index 5f265c3..8ce79f7 100644
--- a/src/Ad5001/BetterGen/populator/WellPopulator.php
+++ b/src/Ad5001/BetterGen/populator/WellPopulator.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -23,8 +23,8 @@ use pocketmine\utils\Random;
 class WellPopulator extends AmountPopulator {
 	/** @var ChunkManager */
 	protected $level;
-	
-	/*
+
+	/**
 	 * Populate the chunk
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $chunkX int
@@ -42,20 +42,20 @@ class WellPopulator extends AmountPopulator {
 		if ($well->canPlaceObject($level, $x, $y, $z, $random))
 			$well->placeObject($level, $x, $y, $z, $random);
 	}
-	
-	/*
+
+	/**
 	 * Gets the top block (y) on an x and z axes
 	 * @param $x int
 	 * @param $z int
 	 */
 	protected function getHighestWorkableBlock($x, $z) {
-		for($y = Level::Y_MAX - 1; $y > 0; -- $y) {
+		for ($y = Level::Y_MAX - 1; $y > 0; --$y) {
 			$b = $this->level->getBlockIdAt($x, $y, $z);
 			if ($b === Block::SAND) {
 				break;
 			}
 		}
-		
+
 		return ++$y;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/structure/Bush.php b/src/Ad5001/BetterGen/structure/Bush.php
index b713a31..92cb023 100644
--- a/src/Ad5001/BetterGen/structure/Bush.php
+++ b/src/Ad5001/BetterGen/structure/Bush.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -22,27 +22,27 @@ use pocketmine\utils\Random;
 
 class Bush extends Object {
 	public $overridable = [
-			Block::AIR => true,
-			17 => true,
-			Block::SNOW_LAYER => true,
-			Block::LOG2 => true 
+		Block::AIR => true,
+		17 => true,
+		Block::SNOW_LAYER => true,
+		Block::LOG2 => true
 	];
 	protected $leaf;
 	protected $height;
-	
-	/*
+
+	/**
 	 * Constructs the class
 	 * @param $leafId int
 	 * @param $leafData int
 	 */
 	public function __construct($leafId = Block::LEAVES, $leafData = 0) {
-		$this->leaf = [ 
-				$leafId,
-				$leafData 
+		$this->leaf = [
+			$leafId,
+			$leafData
 		];
 	}
-	
-	/*
+
+	/**
 	 * Places a bush
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -54,8 +54,8 @@ class Bush extends Object {
 		$number = $random->nextBoundedInt(6);
 		$pos = new Vector3($x, $y, $z);
 		$this->placeLeaf($pos->x, $pos->y, $pos->z, $level);
-		for($i = 0; $i < $number; $i ++) {
-			$transfer = $random->nextBoolean ();
+		for ($i = 0; $i < $number; $i++) {
+			$transfer = $random->nextBoolean();
 			$direction = $random->nextBoundedInt(6);
 			$newPos = $pos->getSide($direction);
 			if ($transfer)
@@ -63,8 +63,8 @@ class Bush extends Object {
 			$this->placeLeaf($newPos->x, $newPos->y, $newPos->z, $level);
 		}
 	}
-	
-	/*
+
+	/**
 	 * Places a leaf
 	 * @param $x int
 	 * @param $y int
@@ -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 aff98e0..dc49607 100644
--- a/src/Ad5001/BetterGen/structure/Cactus.php
+++ b/src/Ad5001/BetterGen/structure/Cactus.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -20,8 +20,8 @@ use pocketmine\level\generator\object\Object;
 use pocketmine\utils\Random;
 
 class Cactus extends Object {
-	
-	/*
+
+	/**
 	 * Checks if a cactus is placeable
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -34,15 +34,15 @@ class Cactus 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);
-		for($yy = $y; $yy <= $y + $this->totalHeight; $yy ++) {
+		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)) {
 				return false;
 			}
 		}
 		return true;
 	}
-	
-	/*
+
+	/**
 	 * Places a cactus
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -50,7 +50,7 @@ class Cactus extends Object {
 	 * @param $z int
 	 */
 	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++) {
 			if ($level->getBlockIdAt($x, $y + $yy, $z) != Block::AIR) {
 				return;
 			}
diff --git a/src/Ad5001/BetterGen/structure/FallenTree.php b/src/Ad5001/BetterGen/structure/FallenTree.php
index f8bf99b..6ab0282 100644
--- a/src/Ad5001/BetterGen/structure/FallenTree.php
+++ b/src/Ad5001/BetterGen/structure/FallenTree.php
@@ -24,33 +24,33 @@ use pocketmine\utils\Random;
 
 
 class FallenTree extends Object {
-	public static $overridable = [ 
-			Block::AIR => true,
-			6 => true,
-			17 => true,
-			18 => true,
-			Block::DANDELION => true,
-			Block::POPPY => true,
-			Block::SNOW_LAYER => true,
-			Block::LOG2 => true,
-			Block::LEAVES2 => true,
-			Block::CACTUS => true 
+	public static $overridable = [
+		Block::AIR => true,
+		6 => true,
+		17 => true,
+		18 => true,
+		Block::DANDELION => true,
+		Block::POPPY => true,
+		Block::SNOW_LAYER => true,
+		Block::LOG2 => true,
+		Block::LEAVES2 => true,
+		Block::CACTUS => true
 	];
 	protected $tree;
 	protected $direction;
 	protected $random;
 	private $length = 0;
 
-	/*
+	/**
 	 * Constructs the class
-	 * @param 	$tree 	ObjectTree
-	 * @throws 	Exeption
+	 * @param    $tree    ObjectTree
+	 * @throws    Exeption
 	 */
 	public function __construct(ObjectTree $tree) {
 		$this->tree = $tree;
 	}
 
-	/*
+	/**
 	 * Places a fallen tree
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -67,43 +67,43 @@ class FallenTree extends Object {
 		switch ($this->direction) {
 			case 0:
 			case 1:// Z+
-			$return = array_merge(BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + $this->length), function($v3, $level) {
-				if(!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
-					echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
+				$return = array_merge(BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + $this->length), function ($v3, $level) {
+					if (!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
+						echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
+						return false;
+					}
+				}, $level), BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z), new Vector3($x, $y - 1, $z + $this->length), function ($v3, $level) {
+					if (isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
+						echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
+						return false;
+					}
+				}, $level));
+				if (in_array(false, $return, true)) {
 					return false;
 				}
-			}, $level), BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z), new Vector3($x, $y - 1, $z + $this->length), function($v3, $level) {
-				if(isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
-					echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
-					return false;
-				}
-			}, $level));
-			if(in_array(false, $return, true)) {
-				return false;
-			}
-			break;
+				break;
 			case 2:
 			case 3: // X+
-			$return = array_merge(BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + $this->length, $y, $z), function($v3, $level) {
-				if(!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
-					echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
+				$return = array_merge(BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + $this->length, $y, $z), function ($v3, $level) {
+					if (!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
+						echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
+						return false;
+					}
+				}, $level), BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z), new Vector3($x + $this->length, $y - 1, $z), function ($v3, $level) {
+					if (isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
+						echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
+						return false;
+					}
+				}, $level));
+				if (in_array(false, $return, true)) {
 					return false;
 				}
-			}, $level), BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z), new Vector3($x + $this->length, $y - 1, $z), function($v3, $level) {
-				if(isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
-					echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
-					return false;
-				}
-			}, $level));
-			if(in_array(false, $return, true)) {
-				return false;
-			}
-			break;
+				break;
 		}
 		return true;
 	}
 
-	/*
+	/**
 	 * Places a fallen tree
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -147,7 +147,7 @@ class FallenTree extends Object {
 		}
 	}
 
-	/*
+	/**
 	 * Places a Block
 	 * @param $x int
 	 * @param $y int
@@ -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 c9e5354..dd00abf 100644
--- a/src/Ad5001/BetterGen/structure/Igloo.php
+++ b/src/Ad5001/BetterGen/structure/Igloo.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -20,64 +20,20 @@ use pocketmine\level\generator\object\Object;
 use pocketmine\utils\Random;
 
 class Igloo extends Object {
-	public $overridable = [ 
-			Block::AIR => true,
-			6 => true,
-			17 => true,
-			18 => true,
-			Block::DANDELION => true,
-			Block::POPPY => true,
-			Block::SNOW_LAYER => true,
-			Block::LOG2 => true,
-			Block::LEAVES2 => true 
+	public $overridable = [
+		Block::AIR => true,
+		6 => true,
+		17 => true,
+		18 => true,
+		Block::DANDELION => true,
+		Block::POPPY => true,
+		Block::SNOW_LAYER => true,
+		Block::LOG2 => true,
+		Block::LEAVES2 => true
 	];
 	protected $direction;
-	
-	/*
-	 * Checks if an igloo is placeable
-	 * @param $level pocketmine\level\ChunkManager
-	 * @param $x int
-	 * @param $y int
-	 * @param $z int
-	 * @param $random pocketmine\utils\Random
-	 * @return bool
-	 */
-	public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
-		$this->direction = $random->nextBoundedInt(4);
-		switch ($this->direction) {
-			case 0 : // Entrance is x+
-				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)]))
-								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)]))
-								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)]))
-								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)]))
-								return false;
-				break;
-		}
-		return true;
-	}
-	
-	/*
+
+	/**
 	 * Places an igloo
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -87,17 +43,17 @@ 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)]))
+				// 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)]))
 							$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 				// Entrance
-				for($i = 0; $i < 2; $i ++) {
+				for ($i = 0; $i < 2; $i++) {
 					$level->setBlockIdAt($x + 3 + $i, $y, $z, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 3 + $i, $y + 3, $z, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 3 + $i, $y + 1, $z + 1, Block::SNOW_BLOCK);
@@ -105,15 +61,15 @@ class Igloo extends Object {
 					$level->setBlockIdAt($x + 3 + $i, $y + 2, $z + 1, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 3 + $i, $y + 2, $z - 1, Block::SNOW_BLOCK);
 				}
-				
+
 				// Back
-				for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 					$level->setBlockIdAt($x - 3, $y + 1, $zz, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 3, $y + 2, $zz, Block::SNOW_BLOCK);
 				}
-				
+
 				// Sides
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++) {
 					$level->setBlockIdAt($xx, $y + 1, $z - 3, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($xx, $y + 2, $z - 3, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($xx, $y + 1, $z + 3, Block::SNOW_BLOCK);
@@ -121,36 +77,36 @@ class Igloo extends Object {
 				}
 				$level->setBlockIdAt($x, $y + 1, $z + 3, Block::ICE);
 				$level->setBlockIdAt($x, $y + 1, $z - 3, Block::ICE);
-				
+
 				// Diags
-				for($i = 1; $i <= 2; $i ++) {
+				for ($i = 1; $i <= 2; $i++) {
 					$level->setBlockIdAt($x + 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 				}
-				
+
 				// 2nd layer
-				for($i = 0; $i < 3; $i ++) {
+				for ($i = 0; $i < 3; $i++) {
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 				}
-				
+
 				// Top
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++)
-					for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++)
+					for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 						$level->setBlockIdAt($xx, $y + 4, $zz, Block::SNOW_BLOCK);
 						$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 					}
-				
+
 				// Carpets
-				for($xx = $x - 2; $xx <= $x + 1; $xx ++)
-					for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($xx = $x - 2; $xx <= $x + 1; $xx++)
+					for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 						$level->setBlockIdAt($xx, $y + 1, $zz, Block::CARPET);
 					}
-				
+
 				// Other furniture
 				// Bed
 				$level->setBlockIdAt($x - 1, $y + 1, $z + 2, Block::BED_BLOCK);
@@ -161,18 +117,18 @@ class Igloo extends Object {
 				$level->setBlockIdAt($x - 1, $y + 1, $z - 2, Block::CRAFTING_TABLE);
 				$level->setBlockIdAt($x, $y + 1, $z - 2, Block::REDSTONE_TORCH);
 				$level->setBlockIdAt($x + 1, $y + 1, $z - 2, Block::FURNACE);
-				
+
 				break;
-			
+
 			// Second direction
 			case 1 : // Entrance is x-
-			        // 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)]))
+				// 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)]))
 							$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 				// Entrance
-				for($i = 0; $i < 2; $i ++) {
+				for ($i = 0; $i < 2; $i++) {
 					$level->setBlockIdAt($x - 3 - $i, $y, $z, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 3 - $i, $y + 3, $z, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 3 - $i, $y + 1, $z + 1, Block::SNOW_BLOCK);
@@ -180,15 +136,15 @@ class Igloo extends Object {
 					$level->setBlockIdAt($x - 3 - $i, $y + 2, $z + 1, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 3 - $i, $y + 2, $z - 1, Block::SNOW_BLOCK);
 				}
-				
+
 				// Back
-				for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 					$level->setBlockIdAt($x + 3, $y + 1, $zz, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 3, $y + 2, $zz, Block::SNOW_BLOCK);
 				}
-				
+
 				// Sides
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++) {
 					$level->setBlockIdAt($xx, $y + 1, $z - 3, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($xx, $y + 2, $z - 3, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($xx, $y + 1, $z + 3, Block::SNOW_BLOCK);
@@ -196,36 +152,36 @@ class Igloo extends Object {
 				}
 				$level->setBlockIdAt($x, $y + 1, $z + 3, Block::ICE);
 				$level->setBlockIdAt($x, $y + 1, $z - 3, Block::ICE);
-				
+
 				// Diags
-				for($i = 1; $i <= 2; $i ++) {
+				for ($i = 1; $i <= 2; $i++) {
 					$level->setBlockIdAt($x + 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 				}
-				
+
 				// 2nd layer
-				for($i = 0; $i < 3; $i ++) {
+				for ($i = 0; $i < 3; $i++) {
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 				}
-				
+
 				// Top
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++)
-					for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++)
+					for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 						$level->setBlockIdAt($xx, $y + 4, $zz, Block::SNOW_BLOCK);
 						$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 					}
-				
+
 				// Carpets
-				for($xx = $x - 1; $xx <= $x + 2; $xx ++)
-					for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($xx = $x - 1; $xx <= $x + 2; $xx++)
+					for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 						$level->setBlockIdAt($xx, $y + 1, $zz, Block::CARPET);
 					}
-				
+
 				// Other furniture
 				// Bed
 				$level->setBlockIdAt($x + 1, $y + 1, $z + 2, Block::BED_BLOCK);
@@ -237,16 +193,16 @@ class Igloo extends Object {
 				$level->setBlockIdAt($x, $y + 1, $z - 2, Block::REDSTONE_TORCH);
 				$level->setBlockIdAt($x - 1, $y + 1, $z - 2, Block::FURNACE);
 				break;
-			
+
 			// Third direction
 			case 2 : // Entrance is z+
-			        // 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)]))
+				// 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)]))
 							$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 				// Entrance
-				for($i = 0; $i < 2; $i ++) {
+				for ($i = 0; $i < 2; $i++) {
 					$level->setBlockIdAt($x, $y, $z + 3 + $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x, $y + 3, $z + 3 + $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 1, $y + 1, $z + 3 + $i, Block::SNOW_BLOCK);
@@ -254,15 +210,15 @@ class Igloo extends Object {
 					$level->setBlockIdAt($x + 1, $y + 2, $z + 3 + $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 1, $y + 2, $z + 3 + $i, Block::SNOW_BLOCK);
 				}
-				
+
 				// Back
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++) {
 					$level->setBlockIdAt($xx, $y + 1, $z - 3, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($xx, $y + 2, $z - 3, Block::SNOW_BLOCK);
 				}
-				
+
 				// Sides
-				for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 					$level->setBlockIdAt($x - 3, $y + 1, $zz, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 3, $y + 2, $zz, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 3, $y + 1, $zz, Block::SNOW_BLOCK);
@@ -270,36 +226,36 @@ class Igloo extends Object {
 				}
 				$level->setBlockIdAt($x + 3, $y + 1, $z, Block::ICE);
 				$level->setBlockIdAt($x - 3, $y + 1, $z, Block::ICE);
-				
+
 				// Diags
-				for($i = 1; $i <= 2; $i ++) {
+				for ($i = 1; $i <= 2; $i++) {
 					$level->setBlockIdAt($x + 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 				}
-				
+
 				// 2nd layer
-				for($i = 0; $i < 3; $i ++) {
+				for ($i = 0; $i < 3; $i++) {
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 				}
-				
+
 				// Top
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++)
-					for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++)
+					for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 						$level->setBlockIdAt($xx, $y + 4, $zz, Block::SNOW_BLOCK);
 						$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 					}
-				
+
 				// Carpets
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++)
-					for($zz = $z - 2; $zz <= $z + 1; $zz ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++)
+					for ($zz = $z - 2; $zz <= $z + 1; $zz++) {
 						$level->setBlockIdAt($xx, $y + 1, $zz, Block::CARPET);
 					}
-				
+
 				// Other furniture
 				// Bed
 				$level->setBlockIdAt($x + 2, $y + 1, $z - 1, Block::BED_BLOCK);
@@ -311,16 +267,16 @@ class Igloo extends Object {
 				$level->setBlockIdAt($x - 2, $y + 1, $z, Block::REDSTONE_TORCH);
 				$level->setBlockIdAt($x - 2, $y + 1, $z - 1, Block::FURNACE);
 				break;
-			
+
 			// Fourth direction
 			case 3 : // Entrance is z-
-			        // 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)]))
+				// 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)]))
 							$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 				// Entrance
-				for($i = 0; $i < 2; $i ++) {
+				for ($i = 0; $i < 2; $i++) {
 					$level->setBlockIdAt($x, $y, $z - 3 - $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x, $y + 3, $z - 3 - $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 1, $y + 1, $z - 3 - $i, Block::SNOW_BLOCK);
@@ -328,15 +284,15 @@ class Igloo extends Object {
 					$level->setBlockIdAt($x + 1, $y + 2, $z - 3 - $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 1, $y + 2, $z - 3 - $i, Block::SNOW_BLOCK);
 				}
-				
+
 				// Back
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++) {
 					$level->setBlockIdAt($xx, $y + 1, $z + 3, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($xx, $y + 2, $z + 3, Block::SNOW_BLOCK);
 				}
-				
+
 				// Sides
-				for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 					$level->setBlockIdAt($x - 3, $y + 1, $zz, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 3, $y + 2, $zz, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 3, $y + 1, $zz, Block::SNOW_BLOCK);
@@ -344,36 +300,36 @@ class Igloo extends Object {
 				}
 				$level->setBlockIdAt($x + 3, $y + 1, $z, Block::ICE);
 				$level->setBlockIdAt($x - 3, $y + 1, $z, Block::ICE);
-				
+
 				// Diags
-				for($i = 1; $i <= 2; $i ++) {
+				for ($i = 1; $i <= 2; $i++) {
 					$level->setBlockIdAt($x + 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + $i, $z - 2, Block::SNOW_BLOCK);
 				}
-				
+
 				// 2nd layer
-				for($i = 0; $i < 3; $i ++) {
+				for ($i = 0; $i < 3; $i++) {
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z + 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 1 + $i, $y + 3, $z - 2, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x + 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 					$level->setBlockIdAt($x - 2, $y + 3, $z - 1 + $i, Block::SNOW_BLOCK);
 				}
-				
+
 				// Top
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++)
-					for($zz = $z - 1; $zz <= $z + 1; $zz ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++)
+					for ($zz = $z - 1; $zz <= $z + 1; $zz++) {
 						$level->setBlockIdAt($xx, $y + 4, $zz, Block::SNOW_BLOCK);
 						$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
 					}
-				
+
 				// Carpets
-				for($xx = $x - 1; $xx <= $x + 1; $xx ++)
-					for($zz = $z - 1; $zz <= $z + 2; $zz ++) {
+				for ($xx = $x - 1; $xx <= $x + 1; $xx++)
+					for ($zz = $z - 1; $zz <= $z + 2; $zz++) {
 						$level->setBlockIdAt($xx, $y + 1, $zz, Block::CARPET);
 					}
-				
+
 				// Other furniture
 				// Bed
 				$level->setBlockIdAt($x + 2, $y + 1, $z + 1, Block::BED_BLOCK);
@@ -388,4 +344,48 @@ class Igloo extends Object {
 		}
 		return true;
 	}
+
+	/**
+	 * Checks if an igloo is placeable
+	 * @param $level pocketmine\level\ChunkManager
+	 * @param $x int
+	 * @param $y int
+	 * @param $z int
+	 * @param $random pocketmine\utils\Random
+	 * @return bool
+	 */
+	public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
+		$this->direction = $random->nextBoundedInt(4);
+		switch ($this->direction) {
+			case 0 : // Entrance is x+
+				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)]))
+								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)]))
+								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)]))
+								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)]))
+								return false;
+				break;
+		}
+		return true;
+	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/structure/SakuraTree.php b/src/Ad5001/BetterGen/structure/SakuraTree.php
index 5e32046..e58392d 100644
--- a/src/Ad5001/BetterGen/structure/SakuraTree.php
+++ b/src/Ad5001/BetterGen/structure/SakuraTree.php
@@ -445,7 +445,7 @@ class SakuraTree extends Tree {
 	public $leafType;
 	public $leaf2Type;
 
-	/*
+	/**
 	 * Constructs the class
 	 */
 	public function __construct() {
@@ -457,7 +457,7 @@ class SakuraTree extends Tree {
 		$this->type = Wood::OAK;
 	}
 
-	/*
+	/**
 	 * Builds the tree.
 	 * @param $level \pocketmine\level\ChunkManager
 	 * @param $x int
@@ -656,7 +656,7 @@ class SakuraTree extends Tree {
 		}
 	}
 
-	/*
+	/**
 	 * Fills a log at.
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -668,7 +668,7 @@ class SakuraTree extends Tree {
 		$level->setBlockDataAt($x, $y, $z, $this->type);
 	}
 
-	/*
+	/**
 	 * Fills a leave at.
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
diff --git a/src/Ad5001/BetterGen/structure/SugarCane.php b/src/Ad5001/BetterGen/structure/SugarCane.php
index 8720639..0e7c897 100644
--- a/src/Ad5001/BetterGen/structure/SugarCane.php
+++ b/src/Ad5001/BetterGen/structure/SugarCane.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -21,8 +21,8 @@ use pocketmine\level\generator\object\Object;
 use pocketmine\utils\Random;
 
 class SugarCane extends Object {
-	
-	/*
+
+	/**
 	 * Checks if a cactus is placeable
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -40,8 +40,8 @@ class SugarCane extends Object {
 		}
 		return false;
 	}
-	
-	/*
+
+	/**
 	 * Places a cactus
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -49,7 +49,7 @@ class SugarCane extends Object {
 	 * @param $z int
 	 */
 	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++) {
 			if ($level->getBlockIdAt($x, $y + $yy, $z) != Block::AIR) {
 				return;
 			}
diff --git a/src/Ad5001/BetterGen/structure/Temple.php b/src/Ad5001/BetterGen/structure/Temple.php
index d439bb5..18859bc 100644
--- a/src/Ad5001/BetterGen/structure/Temple.php
+++ b/src/Ad5001/BetterGen/structure/Temple.php
@@ -111,7 +111,7 @@ class Temple extends Object {
 	private $level;
 	private $direction = 0;
 
-	/*
+	/**
 	 * Checks if a temple is placeable
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
@@ -132,7 +132,7 @@ class Temple extends Object {
 		return true;
 	}
 
-	/*
+	/**
 	 * Places a temple
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $x int
diff --git a/src/Ad5001/BetterGen/structure/Well.php b/src/Ad5001/BetterGen/structure/Well.php
index db28fc3..2dd7ce8 100644
--- a/src/Ad5001/BetterGen/structure/Well.php
+++ b/src/Ad5001/BetterGen/structure/Well.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -22,40 +22,40 @@ use pocketmine\utils\Random;
 
 
 class Well extends Object {
+	public $overridable = [
+		Block::AIR => true,
+		6 => true,
+		17 => true,
+		18 => true,
+		Block::DANDELION => true,
+		Block::POPPY => true,
+		Block::SNOW_LAYER => true,
+		Block::LOG2 => true,
+		Block::LEAVES2 => true,
+		Block::CACTUS => true
+	];
 	/** @var ChunkManager */
 	protected $level;
-	public $overridable = [ 
-			Block::AIR => true,
-			6 => true,
-			17 => true,
-			18 => true,
-			Block::DANDELION => true,
-			Block::POPPY => true,
-			Block::SNOW_LAYER => true,
-			Block::LOG2 => true,
-			Block::LEAVES2 => true,
-			Block::CACTUS => true 
-	];
-	protected $directions = [ 
-			[ 
-					1,
-					1 
-			],
-			[ 
-					1,
-					- 1 
-			],
-			[ 
-					- 1,
-					- 1 
-			],
-			[ 
-					- 1,
-					1 
-			] 
+	protected $directions = [
+		[
+			1,
+			1
+		],
+		[
+			1,
+			-1
+		],
+		[
+			-1,
+			-1
+		],
+		[
+			-1,
+			1
+		]
 	];
 
-	/*
+	/**
 	 * Checks if a well is placeable
 	 * @param $level ChunkManager
 	 * @param $x int
@@ -66,15 +66,15 @@ class Well extends Object {
 	 */
 	public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
 		$this->level = $level;
-		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)]))
+		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)]))
 						return false;
 		return true;
 	}
-	
-	/*
+
+	/**
 	 * Places a well
 	 * @param $level ChunkManager
 	 * @param $x int
@@ -84,34 +84,34 @@ 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 ++)
+			for ($yy = $y; $yy < $y + 3; $yy++)
 				$this->placeBlock($x + $direction [0], $yy, $z + $direction [1], Block::SANDSTONE);
-			
+
 			// Building corners
 			$this->placeBlock($x + ($direction [0] * 2), $y, $z + $direction [1], Block::SANDSTONE);
 			$this->placeBlock($x + $direction [0], $y, $z + ($direction [1] * 2), Block::SANDSTONE);
 			$this->placeBlock($x + ($direction [0] * 2), $y, $z + ($direction [1] * 2), Block::SANDSTONE);
-			
+
 			// Building slabs on the sides. Places two times due to all directions.
 			$this->placeBlock($x + ($direction [0] * 2), $y, $z, 44, 1);
 			$this->placeBlock($x, $y, $z + ($direction [1] * 2), 44, 1);
-			
+
 			// Placing water.Places two times due to all directions.
 			$this->placeBlock($x + $direction [0], $y, $z, Block::WATER);
 			$this->placeBlock($x, $y, $z + $direction [1], Block::WATER);
 		}
-		
+
 		// Final things
-		for($xx = $x - 1; $xx <= $x + 1; $xx ++)
-			for($zz = $z - 1; $zz <= $z + 1; $zz ++)
+		for ($xx = $x - 1; $xx <= $x + 1; $xx++)
+			for ($zz = $z - 1; $zz <= $z + 1; $zz++)
 				$this->placeBlock($xx, $y + 3, $zz);
 		$this->placeBlock($x, $y + 3, $z, Block::SANDSTONE, 1);
 		$this->placeBlock($x, $y, $z, Block::WATER);
 	}
-	
-	/*
+
+	/**
 	 * Places a slab
 	 * @param $x int
 	 * @param $y int
diff --git a/src/Ad5001/BetterGen/utils/BuildingUtils.php b/src/Ad5001/BetterGen/utils/BuildingUtils.php
index b80db85..7de7d7f 100644
--- a/src/Ad5001/BetterGen/utils/BuildingUtils.php
+++ b/src/Ad5001/BetterGen/utils/BuildingUtils.php
@@ -1,16 +1,16 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
  * @author Ad5001
  * @link https://github.com/Ad5001/BetterGen
-*/
+ */
 
 namespace Ad5001\BetterGen\utils;
 
@@ -20,17 +20,17 @@ use pocketmine\math\Vector3;
 use pocketmine\utils\Random;
 
 class BuildingUtils {
-	const TO_NOT_OVERWRITE = [ 
-			Block::WATER,
-			Block::STILL_WATER,
-			Block::STILL_LAVA,
-			Block::LAVA,
-			Block::BEDROCK,
-			Block::CACTUS,
-			Block::PLANK 
+	const TO_NOT_OVERWRITE = [
+		Block::WATER,
+		Block::STILL_WATER,
+		Block::STILL_LAVA,
+		Block::LAVA,
+		Block::BEDROCK,
+		Block::CACTUS,
+		Block::PLANK
 	];
-	
-	/*
+
+	/**
 	 * Fills an area
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $pos1 pocketmine\math\Vector3
@@ -41,33 +41,47 @@ 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);
-		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 ());
-				}
+		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());
+		}
 	}
-	
-	
-	/*
+
+	/**
+	 * Returns 2 vector3, one with minimal values, one with max values of the provided ones.
+	 * @param $pos1 pocketmine\math\Vector3
+	 * @param $pos2 pocketmine\math\Vector3
+	 * @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));
+		return [
+			$v1,
+			$v2
+		];
+	}
+
+	/**
 	 * Fills an area randomly
-	 * @param 		$level		pocketmine\level\ChunkManager
-	 * @param 		$pos1 		pocketmine\math\Vector3
-	 * @param 		$pos2 		pocketmine\math\Vector3
-	 * @param 		$block		pocketmine\block\Block
-	 * @param 		$random		pocketmine\utils
-	 * @param 		$randMax	pocketmine\utils
+	 * @param        $level        pocketmine\level\ChunkManager
+	 * @param        $pos1        pocketmine\math\Vector3
+	 * @param        $pos2        pocketmine\math\Vector3
+	 * @param        $block        pocketmine\block\Block
+	 * @param        $random        pocketmine\utils
+	 * @param        $randMax    pocketmine\utils
 	 * @return void
 	 */
 	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);
-		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 ());
-				}
+		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());
+		}
 	}
-	
-	/*
+
+	/**
 	 * Fills an area by custom filling
 	 * @param $pos1 pocketmine\math\Vector3
 	 * @param $pos2 pocketmine\math\Vector3
@@ -75,16 +89,16 @@ class BuildingUtils {
 	 * @param $params 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 {
 		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);
-				}
+		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 $return;
 	}
-	
-	/*
+
+	/**
 	 * Creates walls
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $pos1 pocketmine\math\Vector3
@@ -94,23 +108,23 @@ class BuildingUtils {
 	 */
 	public static function walls(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
 		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 ());
-				$level->setBlockDataAt($x, $y, $pos1->z, $block->getDamage ());
-				$level->setBlockIdAt($x, $y, $pos2->z, $block->getId ());
-				$level->setBlockDataAt($x, $y, $pos2->z, $block->getDamage ());
+		for ($y = $pos1->y; $y >= $pos2->y; $y--) {
+			for ($x = $pos1->x; $x >= $pos2->x; $x--) {
+				$level->setBlockIdAt($x, $y, $pos1->z, $block->getId());
+				$level->setBlockDataAt($x, $y, $pos1->z, $block->getDamage());
+				$level->setBlockIdAt($x, $y, $pos2->z, $block->getId());
+				$level->setBlockDataAt($x, $y, $pos2->z, $block->getDamage());
 			}
-			for($z = $pos1->z; $z >= $pos2->z; $z --) {
-				$level->setBlockIdAt($pos1->x, $y, $z, $block->getId ());
-				$level->setBlockDataAt($pos1->x, $y, $z, $block->getDamage ());
-				$level->setBlockIdAt($pos2->x, $y, $z, $block->getId ());
-				$level->setBlockDataAt($pos2->x, $y, $z, $block->getDamage ());
+			for ($z = $pos1->z; $z >= $pos2->z; $z--) {
+				$level->setBlockIdAt($pos1->x, $y, $z, $block->getId());
+				$level->setBlockDataAt($pos1->x, $y, $z, $block->getDamage());
+				$level->setBlockIdAt($pos2->x, $y, $z, $block->getId());
+				$level->setBlockDataAt($pos2->x, $y, $z, $block->getDamage());
 			}
 		}
 	}
-	
-	/*
+
+	/**
 	 * Creates the top of a structure
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $pos1 pocketmine\math\Vector3
@@ -120,14 +134,14 @@ class BuildingUtils {
 	 */
 	public static function top(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
 		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 ());
-				$level->setBlockDataAt($x, $pos1->y, $z, $block->getDamage ());
+		for ($x = $pos1->x; $x >= $pos2->x; $x--)
+			for ($z = $pos1->z; $z >= $pos2->z; $z--) {
+				$level->setBlockIdAt($x, $pos1->y, $z, $block->getId());
+				$level->setBlockDataAt($x, $pos1->y, $z, $block->getDamage());
 			}
 	}
-	
-	/*
+
+	/**
 	 * Creates all corners from positions. Used for Mineshaft.
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $pos1 pocketmine\math\Vector3
@@ -137,19 +151,19 @@ class BuildingUtils {
 	 */
 	public static function corners(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
 		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 ());
-			$level->setBlockIdAt($pos2->x, $y, $pos1->z, $block->getId ());
-			$level->setBlockDataAt($pos2->x, $y, $pos1->z, $block->getDamage ());
-			$level->setBlockIdAt($pos1->x, $y, $pos2->z, $block->getId ());
-			$level->setBlockDataAt($pos1->x, $y, $pos2->z, $block->getDamage ());
-			$level->setBlockIdAt($pos2->x, $y, $pos2->z, $block->getId ());
-			$level->setBlockDataAt($pos2->x, $y, $pos2->z, $block->getDamage ());
+		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());
+			$level->setBlockIdAt($pos2->x, $y, $pos1->z, $block->getId());
+			$level->setBlockDataAt($pos2->x, $y, $pos1->z, $block->getDamage());
+			$level->setBlockIdAt($pos1->x, $y, $pos2->z, $block->getId());
+			$level->setBlockDataAt($pos1->x, $y, $pos2->z, $block->getDamage());
+			$level->setBlockIdAt($pos2->x, $y, $pos2->z, $block->getId());
+			$level->setBlockDataAt($pos2->x, $y, $pos2->z, $block->getDamage());
 		}
 	}
-	
-	/*
+
+	/**
 	 * Creates the bottom of a structure
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $pos1 pocketmine\math\Vector3
@@ -159,14 +173,14 @@ class BuildingUtils {
 	 */
 	public static function bottom(ChunkManager $level, Vector3 $pos1, Vector3 $pos2, Block $block) {
 		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 ());
-				$level->setBlockDataAt($x, $pos2->y, $z, $block->getDamage ());
+		for ($x = $pos1->x; $x >= $pos2->x; $x--)
+			for ($z = $pos1->z; $z >= $pos2->z; $z--) {
+				$level->setBlockIdAt($x, $pos2->y, $z, $block->getId());
+				$level->setBlockDataAt($x, $pos2->y, $z, $block->getDamage());
 			}
 	}
-	
-	/*
+
+	/**
 	 * Builds a random structure depending of length, height, depth and random
 	 * @param $level pocketmine\level\ChunkManager
 	 * @param $pos pocketmine\math\Vector3
@@ -179,32 +193,17 @@ class BuildingUtils {
 		$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 ++) {
+		$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)) {
-						$level->setBlockIdAt($x, $y, $z, $block->getId ());
-						$level->setBlockDataAt($x, $y, $z, $block->getDamage ());
+					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());
 					}
 				}
 			}
 		}
 	}
-	
-	/*
-	 * Returns 2 vector3, one with minimal values, one with max values of the provided ones.
-	 * @param $pos1 pocketmine\math\Vector3
-	 * @param $pos2 pocketmine\math\Vector3
-	 * @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));
-		return [ 
-				$v1,
-				$v2 
-		];
-	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/utils/CommonUtils.php b/src/Ad5001/BetterGen/utils/CommonUtils.php
index 13af710..aab42a0 100644
--- a/src/Ad5001/BetterGen/utils/CommonUtils.php
+++ b/src/Ad5001/BetterGen/utils/CommonUtils.php
@@ -1,10 +1,10 @@
 <?php
 /**
- *  ____             __     __                    ____                       
- * /\  _`\          /\ \__ /\ \__                /\  _`\                     
- * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___    
- *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\  
- *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \ 
+ *  ____             __     __                    ____
+ * /\  _`\          /\ \__ /\ \__                /\  _`\
+ * \ \ \L\ \     __ \ \ ,_\\ \ ,_\     __   _ __ \ \ \L\_\     __     ___
+ *  \ \  _ <'  /'__`\\ \ \/ \ \ \/   /'__`\/\`'__\\ \ \L_L   /'__`\ /' _ `\
+ *   \ \ \L\ \/\  __/ \ \ \_ \ \ \_ /\  __/\ \ \/  \ \ \/, \/\  __/ /\ \/\ \
  *    \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\   \ \____/\ \____\\ \_\ \_\
  *     \/___/  \/____/  \/__/  \/__/ \/____/ \/_/    \/___/  \/____/ \/_/\/_/
  * Tomorrow's pocketmine generator.
@@ -13,17 +13,17 @@
  */
 
 namespace Ad5001\BetterGen\utils;
- # Common utils under no namespace made for a specific usage
+# Common utils under no namespace made for a specific usage
 
 class CommonUtils {
-    /**
-     * Searches case insensitively array $haystack for $needle.
-     * src: http://php.net/manual/en/function.in-array.php#89256
-     * @param		mixed		$needle
-     * @param		array		$haystack
-     * @return		bool
-     */
-    static function in_arrayi($needle, array $haystack) :bool {
-        return in_array(strtolower($needle), array_map('strtolower', $haystack));
-    }
+	/**
+	 * Searches case insensitively array $haystack for $needle.
+	 * src: http://php.net/manual/en/function.in-array.php#89256
+	 * @param        mixed $needle
+	 * @param        array $haystack
+	 * @return        bool
+	 */
+	static function in_arrayi($needle, array $haystack): bool {
+		return in_array(strtolower($needle), array_map('strtolower', $haystack));
+	}
 }
\ No newline at end of file

From 1f10807c7b378f4f02756532d75c31316e3d2596 Mon Sep 17 00:00:00 2001
From: thebigsmileXD <thebigsmilexd@gmail.com>
Date: Sun, 14 May 2017 11:32:58 +0200
Subject: [PATCH 2/3] Finish loottable generation & chest generation

---
 src/Ad5001/BetterGen/Main.php             |  88 ++++++++---
 src/Ad5001/BetterGen/loot/LootTable.php   | 179 +++++++++++-----------
 src/Ad5001/BetterGen/structure/Igloo.php  |  20 +--
 src/Ad5001/BetterGen/structure/Temple.php |  41 ++---
 4 files changed, 188 insertions(+), 140 deletions(-)

diff --git a/src/Ad5001/BetterGen/Main.php b/src/Ad5001/BetterGen/Main.php
index e3ed7ff..92d0e68 100644
--- a/src/Ad5001/BetterGen/Main.php
+++ b/src/Ad5001/BetterGen/Main.php
@@ -23,23 +23,23 @@ use Ad5001\BetterGen\structure\SakuraTree;
 use Ad5001\BetterGen\structure\Temple;
 use Ad5001\BetterGen\structure\Well;
 use pocketmine\block\Block;
+use pocketmine\block\Chest;
 use pocketmine\command\Command;
 use pocketmine\command\CommandSender;
 use pocketmine\event\block\BlockBreakEvent;
 use pocketmine\event\Listener;
 use pocketmine\event\player\PlayerInteractEvent;
+use pocketmine\item\Item;
 use pocketmine\level\generator\biome\Biome;
 use pocketmine\level\generator\Generator;
 use pocketmine\level\generator\object\OakTree;
 use pocketmine\level\Position;
 use pocketmine\nbt\tag\CompoundTag;
 use pocketmine\nbt\tag\IntTag;
-use pocketmine\nbt\tag\ListTag;
 use pocketmine\nbt\tag\StringTag;
 use pocketmine\Player;
 use pocketmine\plugin\PluginBase;
 use pocketmine\tile\Chest as TileChest;
-use pocketmine\block\Chest;
 use pocketmine\tile\Tile;
 use pocketmine\utils\Config;
 use pocketmine\utils\Random;
@@ -48,6 +48,7 @@ use pocketmine\utils\TextFormat;
 class Main extends PluginBase implements Listener {
 	const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f ";
 	const SAKURA_FOREST = 100; // Letting some place for future biomes.
+	private static $instance;
 
 
 	/**
@@ -60,21 +61,39 @@ class Main extends PluginBase implements Listener {
 		BetterNormal::registerBiome($biome);
 	}
 
+	/**
+	 * Places a looting chest block and creates the corresponding tile
+	 * @param Block $block
+	 * @param $lootfile
+	 */
+	static public function placeLootChest(Block $block, $lootfile) {
+		$block->getLevel()->setBlock($block, $block, true);
+		$nbt = new CompoundTag("", [
+			new StringTag("id", Tile::CHEST),
+			new IntTag("x", (int)$block->x),
+			new IntTag("y", (int)$block->y),
+			new IntTag("z", (int)$block->z),
+			new StringTag("generateLoot", $lootfile)
+		]);
+		$tile = new TileChest($block->getLevel(), $nbt);
+		$tile->spawnToAll();
+	}
+
 	/**
 	 * Called when the plugin enables
 	 */
 	public function onEnable() {
+		self::$instance = $this;
 		$this->getServer()->getPluginManager()->registerEvents($this, $this);
 		Generator::addGenerator(BetterNormal::class, "betternormal");
 		if ($this->isOtherNS()) $this->getLogger()->warning("Tesseract detected. Note that Tesseract is not up to date with the generation structure and some generation features may be limited or not working");
 		@mkdir($this->getDataFolder());
-		if (!file_exists(LootTable::getPluginFolder() . "processingLoots.json"))
-			file_put_contents(LootTable::getPluginFolder() . "processingLoots.json", "{}");
+		if (!in_array($this->getDataFolder() . 'resources\mcpe-default-addon\.', $this->getResources())) $this->getLogger()->alert('The loot files are missing! Make sure you got all files / did git clone --recursive');
 	}
 
 	/**
 	 * Check if it's a Tesseract like namespace
-	 * @return 	bool
+	 * @return    bool
 	 */
 	public static function isOtherNS() {
 		try {
@@ -84,14 +103,12 @@ class Main extends PluginBase implements Listener {
 		}
 	}
 
-
 	/**
 	 * Called when the plugin disables
 	 */
 	public function onDisable() {
 	}
 
-
 	/**
 	 * Called when one of the defined commands of the plugin has been called
 	 * @param $sender \pocketmine\command\CommandSender
@@ -261,8 +278,9 @@ class Main extends PluginBase implements Listener {
 	 * Registers a forest type.
 	 * @param $name string
 	 * @param $treeClass string
-	 * @params $infos Array(temperature, rainfall)
+	 * @param array $infos
 	 * @return bool
+	 * @params $infos Array(temperature, rainfall)
 	 */
 	public function registerForest(string $name, string $treeClass, array $infos): bool {
 		if (!@class_exists($treeClass))
@@ -274,16 +292,54 @@ class Main extends PluginBase implements Listener {
 		return BetterForest::registerForest($name, $treeClass, $infos);
 	}
 
-
 	/**
 	 * Checks when a player attempts to open a loot chest which is not created yet
 	 * @param PlayerInteractEvent $event
 	 */
 	public function onInteract(PlayerInteractEvent $event) {
-		if (($block = $event->getBlock())->getId() !== Block::CHEST) return;
+		if (($block = $event->getBlock())->getId() !== Block::CHEST || $event->getAction() !== PlayerInteractEvent::RIGHT_CLICK_BLOCK) return;
 		$this->generateLootChest($block);
 	}
 
+	/**
+	 * Fills a chest with loot
+	 * @param Block $block
+	 * @param Random|null $random
+	 */
+	static public function generateLootChest(Block $block, Random $random = null) {
+		if (!$block instanceof Chest) return;
+		$tile = $block->getLevel()->getTile($block);
+		if (is_null($tile)) {
+			//TODO new tile, but no loot, because we don't know which type of loot chest this is
+			$nbt = new CompoundTag("", [
+				new StringTag("id", Tile::CHEST),
+				new IntTag("x", (int)$block->x),
+				new IntTag("y", (int)$block->y),
+				new IntTag("z", (int)$block->z)
+			]);
+			$tile = new TileChest($block->getLevel(), $nbt);
+			$tile->spawnToAll();
+			return;
+		}
+		if (!$tile instanceof TileChest) return;
+		//Check if lootchest (or already generated loot)
+		if (!isset($tile->namedtag->generateLoot)) return;
+		$table = new LootTable($config = new Config(self::getInstance()->getDataFolder() . '\\resources\\mcpe-default-addon\\' . $tile->namedtag->generateLoot . '.json'));
+		$size = $tile->getInventory()->getSize();
+		$loot = $table->getRandomLoot($random);
+		$items = array_pad($loot, $size, Item::get(0));
+		shuffle($items);
+		$tile->getInventory()->setContents($items);
+		unset($tile->namedtag->generateLoot);
+	}
+
+	/**
+	 * @return Main
+	 */
+	static public function getInstance() {
+		return self::$instance;
+	}
+
 	/**
 	 * Checks when a player breaks a loot chest which is not created yet
 	 * @param BlockBreakEvent $event
@@ -292,16 +348,4 @@ class Main extends PluginBase implements Listener {
 		if (($block = $event->getBlock())->getId() !== Block::CHEST) return;
 		$this->generateLootChest($block);
 	}
-
-	private function generateLootChest(Block $block) {
-		//TODO
-		if (!$block instanceof Chest) return;
-		if (is_null($block->getLevel()->getTile($block))) {
-			//TODO new tile, but no loot, because we don't know which type of loot it is
-			return;
-		}
-		if (!($tile = $block->getLevel()->getTile($block)) instanceof TileChest) return;
-		/** TileChest $tile */
-		$tile->getInventory()->setContents([]);//TODO
-	}
 }
diff --git a/src/Ad5001/BetterGen/loot/LootTable.php b/src/Ad5001/BetterGen/loot/LootTable.php
index c613ebd..51bcfbd 100644
--- a/src/Ad5001/BetterGen/loot/LootTable.php
+++ b/src/Ad5001/BetterGen/loot/LootTable.php
@@ -14,9 +14,9 @@
 
 namespace Ad5001\BetterGen\loot;
 
+use Ad5001\BetterGen\Main;
 use pocketmine\item\Item;
 use pocketmine\item\Tool;
-use pocketmine\Server;
 use pocketmine\utils\Config;
 use pocketmine\utils\Random;
 
@@ -36,114 +36,105 @@ class LootTable {
 	}
 
 	/**
-	 * Public function to generate loot. A {@link: \pocketmine\utils\Random} can be passed.
-	 * @param Random|null $random
-	 * @return Item[]
-	 */
-	public function createLoot(Random $random = null) {
-		return self::getRandomLoot($random);
-	}
-
-	/**
-	 * Internal function. Serves as actual file reader + sub-table loader
+	 * Public function to generate loot. A {@link: \pocketmine\utils\Random} can be passed. Serves as file reader + sub-table loader
 	 * Do _NOT_ use this in the source, use LootTable::createLoot instead
 	 * @param Random|null $random
 	 * @return Item[]
 	 */
-	private function getRandomLoot(Random $random = null) {
-		if (is_null($random)) $random = new Random(microtime());
-		$array = [];
+	public function getRandomLoot(Random $random = null) {
+		if (is_null($random)) $random = new Random();
 		$items = [];
 		foreach ($this->lootFile->get("pools") as $rolls) {
-			$maxrolls = $rolls["rolls"];//TODO: $rolls["conditions"]
+			if (isset($rolls["rolls"]["min"]) && isset($rolls["rolls"]["max"])) $maxrolls = $random->nextRange($rolls["rolls"]["min"], $rolls["rolls"]["max"]);
+			else $maxrolls = $rolls["rolls"];//TODO: $rolls["conditions"] //Example: looting swords
 			while ($maxrolls > 0) {
+				$array = [];
 				$maxrolls--;
 				foreach ($rolls["entries"] as $index => $entries) {
 					$array[] = $entries["weight"]??1;
 				}
-			}
-			$val = $rolls["entries"][$this->getRandomWeightedElement($array)];
-			//typecheck
-			if ($val["type"] == "loot_table") {
-				$loottable = new self(new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/" . $val["name"] . ".json", Config::JSON, []));
-				$items = array_merge($items, $loottable->getRandomLoot());
-				unset($loottable);
-			} elseif ($val["type"] == "item") {
-				print $val["name"] . PHP_EOL;
-				//name fix
-				$val["name"] = self::fixItemName($val["name"]);
-				$item = Item::fromString($val["name"]);
-				if (isset($val["functions"])) {
-					foreach ($val["functions"] as $function) {
-						switch ($functionname = $function["function"]) {
-							case "set_damage": {
-								if ($item instanceof Tool) $item->setDamage(mt_rand($function["damage"]["min"] * $item->getMaxDurability(), $function["damage"]["max"] * $item->getMaxDurability()));
-								else $item->setDamage($random->nextRange($function["damage"]["min"], $function["damage"]["max"]));
-							}
-								break;
-							case "set_data": {
-								//fish fix, blame mojang
-								if ($item->getId() == Item::RAW_FISH) {
-									switch ($function["data"]) {
-										case 1:
-											$item = Item::get(Item::RAW_SALMON, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
-											break;
-										case 2:
-											$item = Item::get(Item::CLOWN_FISH, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
-											break;
-										case 3:
-											$item = Item::get(Item::PUFFER_FISH, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
-											break;
-										default:
-											break;
+				$val = $rolls["entries"][$this->getRandomWeightedElement($array)];
+				//typecheck
+				if ($val["type"] == "loot_table") {
+					$loottable = new LootTable(new Config(Main::getInstance()->getDataFolder() . '\\resources\\mcpe-default-addon\\' . $val["name"] . ".json"));
+					$items = array_merge($items, $loottable->getRandomLoot($random));
+					unset($loottable);
+				} elseif ($val["type"] == "item") {
+					//name fix
+					$val["name"] = self::fixItemName($val["name"]);
+					$item = Item::fromString($val["name"]);
+					if (isset($val["functions"])) {
+						foreach ($val["functions"] as $function) {
+							switch ($functionname = $function["function"]) {
+								case "set_damage": {
+									if ($item instanceof Tool) $item->setDamage($random->nextRange($function["damage"]["min"] * $item->getMaxDurability(), $function["damage"]["max"] * $item->getMaxDurability()));
+									else $item->setDamage($random->nextRange($function["damage"]["min"], $function["damage"]["max"]));
+								}
+									break;
+								case "set_data": {
+									//fish fix, blame mojang
+									if ($item->getId() == Item::RAW_FISH) {
+										switch ($function["data"]) {
+											case 1:
+												$item = Item::get(Item::RAW_SALMON, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
+												break;
+											case 2:
+												$item = Item::get(Item::CLOWN_FISH, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
+												break;
+											case 3:
+												$item = Item::get(Item::PUFFER_FISH, $item->getDamage(), $item->getCount(), $item->getCompoundTag());
+												break;
+											default:
+												break;
+										}
+									} else $item->setDamage($function["data"]);
+								}
+									break;
+								case "set_count": {
+									$item->setCount($random->nextRange($function["count"]["min"], $function["count"]["max"]));
+								}
+									break;
+								case "furnace_smelt": {
+									/* TODO
+									Mostly bound to conditions (burning)
+								"conditions": [
+									{
+										"condition": "entity_properties",
+										"entity": "this",
+										"properties": {
+											"on_fire": true
+										}
 									}
-								} else $item->setDamage($function["data"]);
+								]
+									*/
+								}
+									break;
+								case "enchant_randomly": {
+									//TODO
+								}
+									break;
+								case "enchant_with_levels": {
+									//TODO
+								}
+									break;
+								case "looting_enchant": {
+									//TODO
+								}
+									break;
+								default:
+									assert("Unknown looting table function $functionname, skipping");
 							}
-								break;
-							case "set_count": {
-								$item->setCount($random->nextRange($function["count"]["min"], $function["count"]["max"]));
-							}
-								break;
-							case "furnace_smelt": {
-								/* TODO
-								Mostly bound to conditions (burning)
-                            "conditions": [
-                                {
-                                    "condition": "entity_properties",
-                                    "entity": "this",
-                                    "properties": {
-                                        "on_fire": true
-                                    }
-                                }
-                            ]
-								*/
-							}
-								break;
-							case "enchant_randomly": {
-								//TODO
-							}
-								break;
-							case "enchant_with_levels": {
-								//TODO
-							}
-								break;
-							case "looting_enchant": {
-								//TODO
-							}
-								break;
-							default:
-								assert("Unknown looting table function $functionname, skipping");
 						}
 					}
+					$items[] = $item;
 				}
-				$items[] = $item;
 			}
 		}
 		return $items;
 	}
 
 	/**
-	 * TODO: Make random actually useful here.
+	 * TODO: Make Random::class actually useful here.
 	 * @param array $weightedValues
 	 * @return mixed
 	 */
@@ -161,7 +152,19 @@ class LootTable {
 	 * @return mixed
 	 */
 	private static function fixItemName($name) {
-		//TODO add a switch-case here
+		switch ($name) {
+			case 'minecraft:horsearmoriron':
+				$name = 'minecraft:iron_horse_armor';
+				break;
+			case 'minecraft:horsearmorgold':
+				$name = 'minecraft:gold_horse_armor';
+				break;
+			case 'minecraft:horsearmordiamond':
+				$name = 'minecraft:diamond_horse_armor';
+				break;
+			default: {
+			}
+		}
 		return $name;
 	}
 }
\ No newline at end of file
diff --git a/src/Ad5001/BetterGen/structure/Igloo.php b/src/Ad5001/BetterGen/structure/Igloo.php
index dd00abf..268cbde 100644
--- a/src/Ad5001/BetterGen/structure/Igloo.php
+++ b/src/Ad5001/BetterGen/structure/Igloo.php
@@ -35,11 +35,11 @@ class Igloo extends Object {
 
 	/**
 	 * Places an igloo
-	 * @param $level pocketmine\level\ChunkManager
-	 * @param $x int
-	 * @param $y int
-	 * @param $z int
-	 * @param $random pocketmine\utils\Random
+	 * @param ChunkManager $level
+	 * @param $x
+	 * @param $y
+	 * @param $z
+	 * @param Random $random
 	 * @return bool placed
 	 */
 	public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
@@ -347,11 +347,11 @@ class Igloo extends Object {
 
 	/**
 	 * Checks if an igloo is placeable
-	 * @param $level pocketmine\level\ChunkManager
-	 * @param $x int
-	 * @param $y int
-	 * @param $z int
-	 * @param $random pocketmine\utils\Random
+	 * @param ChunkManager $level
+	 * @param $x
+	 * @param $y
+	 * @param $z
+	 * @param Random $random
 	 * @return bool
 	 */
 	public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
diff --git a/src/Ad5001/BetterGen/structure/Temple.php b/src/Ad5001/BetterGen/structure/Temple.php
index 18859bc..79ea60f 100644
--- a/src/Ad5001/BetterGen/structure/Temple.php
+++ b/src/Ad5001/BetterGen/structure/Temple.php
@@ -14,10 +14,12 @@
 
 namespace Ad5001\BetterGen\structure;
 
+use Ad5001\BetterGen\Main;
 use Ad5001\BetterGen\utils\BuildingUtils;
 use pocketmine\block\Block;
 use pocketmine\level\ChunkManager;
 use pocketmine\level\generator\object\Object;
+use pocketmine\level\Position;
 use pocketmine\math\Vector3;
 use pocketmine\utils\Random;
 
@@ -113,14 +115,13 @@ class Temple extends Object {
 
 	/**
 	 * 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
+	 * @param ChunkManager $level
+	 * @param $x
+	 * @param $y
+	 * @param $z
+	 * @param Random $random
 	 * @return bool
 	 */
-
 	public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
 		$this->level = $level;
 		$this->direction = $random->nextBoundedInt(4);
@@ -134,11 +135,11 @@ class Temple extends Object {
 
 	/**
 	 * Places a temple
-	 * @param $level pocketmine\level\ChunkManager
-	 * @param $x int
-	 * @param $y int
-	 * @param $z int
-	 * @param $random pocketmine\utils\Random
+	 * @param ChunkManager $level
+	 * @param $x
+	 * @param $y
+	 * @param $z
+	 * @param Random $random
 	 */
 	public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
 		// Clearing space...
@@ -216,20 +217,19 @@ class Temple extends Object {
 				$this->placeBlock($xx, $y - 13, $zz, Block::TNT);
 		$this->placeBlock($x, $y - 11, $z, Block::STONE_PRESSURE_PLATE);
 
-		//TODO TILES
-		$this->placeBlock($x, $y - 11, $z + 2, Block::CHEST, 4);
-		$this->placeBlock($x, $y - 11, $z - 2, Block::CHEST, 2);
-		$this->placeBlock($x + 2, $y - 11, $z, Block::CHEST, 5);
-		$this->placeBlock($x - 2, $y - 11, $z, Block::CHEST, 3);
 		$this->placeBlock($x, $y - 10, $z + 2, Block::AIR);
 		$this->placeBlock($x, $y - 10, $z - 2, Block::AIR);
 		$this->placeBlock($x + 2, $y - 10, $z, Block::AIR);
 		$this->placeBlock($x - 2, $y - 10, $z, Block::AIR);
 		// Chests
-		/*LootTable::buildLootTable(new Vector3($x, $y - 11, $z + 2), LootTable::LOOT_DESERT_TEMPLE, $random);//TODO: Improve using addon
-		LootTable::buildLootTable(new Vector3($x, $y - 11, $z - 2), LootTable::LOOT_DESERT_TEMPLE, $random);
-		LootTable::buildLootTable(new Vector3($x + 2, $y - 11, $z), LootTable::LOOT_DESERT_TEMPLE, $random);
-		LootTable::buildLootTable(new Vector3($x - 2, $y - 11, $z), LootTable::LOOT_DESERT_TEMPLE, $random);*/
+		#$this->placeBlock($x, $y - 11, $z + 2, Block::CHEST, 4);
+		#$this->placeBlock($x, $y - 11, $z - 2, Block::CHEST, 2);
+		#$this->placeBlock($x + 2, $y - 11, $z, Block::CHEST, 5);
+		#$this->placeBlock($x - 2, $y - 11, $z, Block::CHEST, 3);
+		Main::placeLootChest(Block::get(Block::CHEST, 2, new Position($x, $y - 11, $z + 2, $this->level)), 'loot_tables\\chests\\desert_pyramid');
+		Main::placeLootChest(Block::get(Block::CHEST, 3, new Position($x, $y - 11, $z - 2, $this->level)), 'loot_tables\\chests\\desert_pyramid');
+		Main::placeLootChest(Block::get(Block::CHEST, 4, new Position($x + 2, $y - 11, $z, $this->level)), 'loot_tables\\chests\\desert_pyramid');
+		Main::placeLootChest(Block::get(Block::CHEST, 5, new Position($x - 2, $y - 11, $z, $this->level)), 'loot_tables\\chests\\desert_pyramid');
 
 		// Entrance is a rectangular parallelepiped
 		switch ($this->direction) {
@@ -896,6 +896,7 @@ class Temple extends Object {
 	 * @param $z int
 	 * @param $id int
 	 * @param $meta int
+	 * @param bool $top
 	 * @return void
 	 */
 	protected function placeSlab($x, $y, $z, $id = 44, $meta = 1, $top = false) {

From 27671134216b6ec67dd499e21d14dfec33155079 Mon Sep 17 00:00:00 2001
From: thebigsmileXD <thebigsmilexd@gmail.com>
Date: Tue, 16 May 2017 12:02:29 +0200
Subject: [PATCH 3/3] Fix legal issues

---
 .gitmodules                             |   3 ---
 README.md                               |  10 ++++++++++
 imgs/addon_setup.png                    | Bin 0 -> 6942 bytes
 processingLoots.json                    |   1 -
 resources/mcpe-default-addon            |   1 -
 src/Ad5001/BetterGen/Main.php           |   5 +++--
 src/Ad5001/BetterGen/loot/LootTable.php |   2 +-
 7 files changed, 14 insertions(+), 8 deletions(-)
 delete mode 100644 .gitmodules
 create mode 100644 imgs/addon_setup.png
 delete mode 100644 processingLoots.json
 delete mode 160000 resources/mcpe-default-addon

diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 6fcdd61..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "resources/mcpe-default-addon"]
-	path = resources/mcpe-default-addon
-	url = https://github.com/dktapps/mcpe-default-addon.git
diff --git a/README.md b/README.md
index 3bf6db7..eb4d4d5 100644
--- a/README.md
+++ b/README.md
@@ -46,4 +46,14 @@ Welcome user to the home of a new PocketMine World Generator which features 9 ne
 ### These two biomes now are a bit better by the additions of bushes.   
 <img src="https://raw.githubusercontent.com/Ad5001/BetterGen/master/imgs/bushes.png" style="width: 500px"></img>
 
+-----
+
+# Notice:
+
+### To generate loot like in vanilla MCPE, you have to put the default behaviour pack contents of the game into the "addon" folder.
+### Due to legal issues we are not able to include these directly into the repository.
+### You can get them here: https://aka.ms/behaviorpacktemplate or here https://github.com/dktapps/mcpe-default-addon for an optimised version
+### The folder has to look like this:
+<img src="https://raw.githubusercontent.com/Ad5001/BetterGen/master/imgs/addon_setup.png" style="width: 500px"></img>
+
 All content here is copyrighted (C) Ad5001 2017. Infos about this copyright can be found in the license file.
\ No newline at end of file
diff --git a/imgs/addon_setup.png b/imgs/addon_setup.png
new file mode 100644
index 0000000000000000000000000000000000000000..9073c6c1dee311a2a9cda6b2dc8d2ca51866dca7
GIT binary patch
literal 6942
zcmc(E^;=Y5^zMKI%z(hqB7&53cSsB!0z)G(q;w1^-5^LvcT0CS2oe&~f^<j>g1{h1
zO5E{t?|q){fAIZbpZz@VyY|{^pS{*zd!6$hrml#O`xF-d0N^Vt$!VecO>`RqVWOY?
zTz35E4(y`z+8qEO82r~TQrQWp&>)V7vYI^34=e~Si2tl=uHZjN-oOLu>0yg-160(G
zE1@AJ4>Tla<!<R_=i*_9a0cM|+nT$*u|&A|`1A4b3Ul)aa`Ot&^74uCh=>XD;6mRx
z**V*}d$^f<Alz{EmDM?6Fc=@Nwvv`QkMe@m;uKmZ?mwNfXbo<5HntvsYQk|bG)nLv
z>SksBZyH(;J0~lE;3Xj#&4B+g+6Ze8FLO650Nmx_pE%xshS|AWI+~+J-2iQU&GBd$
z^bgiIcXPILwgL1}AtTWk&i@_n>1JsKIDZKH_5a0W5l&84&K`h^@w8qvhW$@W$Iipi
z3Q&GL%M1We)+ozCb-Xc-;CL>ix}C?F;V;1<2?-~lXvQi9ny;PgboK1f1~1=4#C+60
z!It0D`(YBMKW2zUD(_Y0AF*uJQ_qr$S(n8guZ8i;gp5=P-1Rd22^b6uVFZ$le0^oY
zzjld|<j<Y_lX>|k=QuBjPjLS1(&zT!GU$40Kkw|a!DCTObiQi$Pc8hR8#-v$8|eL+
z8%K3GoxoXKbf++462Vz^;ZINYRQw_hZzAa#uD{O=oL)b%ik(pD`fu7Af2rwTx9!zM
zN{uzYrm|XAo4@Q8d`CCuzhol`bl(rq|J*n)soVHld999_-X&_rp3_5nu^ee);Bm4T
zmG;i>P{*gAP>U7AgT|;FcwQx|PuH*=)5dX|t{gsuF(2n|jtq?M9xYZ3drCtkU=ke^
z)hzy;4_iD;h@8DqhW0U0O6tKPLV(sR4x3>{VVgb}C|Ha7D08;h+1XjnLmDT*gh>vC
z#8!yfQ<H%<A<xO2g=!O(VB0rbYyyg*3K7|H4vfTe?Vn<BClU)Ze^_rnrR*{vz}~ix
z&&sC3=$?4vOF^|F{cJ1lNa~wIJW#MFCeDeLcy95Yzvn^;_N{Ai5t|<RANl+-l+I`K
zVg(`Pj*NZyDg9%nND)V8=;2Gn3+N~jgMxu^UBKT9&6o&!pu3i~wld-6x*x)Z`9&9d
z%7tu&>N%0_6BTZva;nGBFqlJsI5?f#^xYKg0X7_K@$Bw$W5A8`%Kx}yuTSEjG({3`
zB&cr^hsJyJ<j26YWOwPSOpB(axuYURIUv2<G^8b^s;#Z9tfT~Md3hv}p-|<C{wJAw
z4mLL5%QdgvppFF-KTeL(kDn=@u+U<&AtFqZx^FY&LdPa^#YYV;&}(3KIwK9-X+RB8
zm@+0~bTEo~-<>avjwn3^1`R-z86}6ekVs^8b#*Z9{c#uS^z00r`DV=w6Q-*x7<hZ-
zzBj3sBjUQ=?Q{B@MB^pK5xZ*WvfSAV)imiL%i$039$&I$ohoR}u612!n$}itNC7iO
z982}w>wVVOFDfC1v>Dp)ZTP%WPQdkU`Y5gZouj?|Q%V0TiObbT+Z2yemX?-I!2K)E
zU1~l6&s3T6)9bzbu#=j$^``>12}WchT^{>dB6wDtPuTh~5@DV&+?C~J5KCre<~kn9
zgtGZ;jF$4OcsX;`(OW%MoO2~*TO5J{MuR__VT71WE{}<S4o$qW`fKmkV|&~i;>IAE
zSk@^^&bIb6q0*!pw9WcUmAhx>?g3z7<Lc^aVL>lfK*?`y+~GFl=kr7v)%lAnDhgIz
zUk}-eGxD)@IX{@E4F>^-VKm;oewWT|Cx<=h4hyyTG=~gCrg>q3zlSK2nbbn1F$3lo
z7G%4_>oNF8nrx<g4<ZbSpLU}@{Z&dG8&l!i_rF-O385c+rO~o_cs^I5bsQf8x$aB&
z^T&e+_dqN0k`ZV$0xIyRS{A%7ue76djk;`l^d!o`-u{;38H~5DyrqS#a%3QG>fjL$
z0nqS@LjiXOy@fkF2|=7@#5#-*TPtmd%h}NMBon3<6MLV1)qt_Gkdp^&{XjFk+x$LA
zne*po#J}lB#T7%uOarf9kcLrauMD!YvVyU(w!Aa;5+5vG)_-pg_uk()lxt~e$%Nkr
zV-<qlsYbn$#0xt!G&HoZybCx0+M2-O_^wYq9=S`i=fl0Z!3(lq)4B5n9mvO5Qq+9v
zcAK<2f~BxA4*`<xfNF7{Q^vUxdXzFqB=~CqIV5*{=1!mc<BJ{*ijiCE-&;d+%zRBA
z+4+guJQhjsSu+EPe&BI;ZweXdeou`re63}Y$KgARYZez1)3kDwhs$DPJ^j=!?G<E{
zHN)+*K0Pyu=~Z~$fn{5g%7n6Z<1#FFTn&0$lGcgULUvEZf}@@Ro5&F*x%p=S%P-b2
zS<g7b0g$RcM_U+(*J-&qUg}<?-6-Q^<9dW4{+Xy7BS)JVsOp5j5;A=u`BNO#E&Hyp
zyq`1<p8@k;eft(gTw8*i%=J6jgqC9-hO=9>KiUlP<aiHaAv)n5WH5*V7y+B9x0aUQ
z^<)Du7|X#qw$>yG1=bg}V8?-GOA?Wpai&fAq|6=%%oUd?;SiDuM@-_m@pZuvCneZ_
zEG=~65KglA4k-9P$t{aS^kIx;Kl*3?n=+Xa6G1aqnj-L4v9BXbnJGs~5M0>R*-1=H
ztaKVC)l&ah7KoH;2}HH(KVgG-EQk!^;OCmNVTwcbPwk$Rz@zD*_<N0gq<W{bQP1Q<
zv5^SNR6Twz&Y2GRAEugh?qNkL5@D0#sgnJmr@FC%c@66zmApvvm)S5&61vUAg7DmB
zm*$UG73XIUCWXO7jM-jrL84k)l?+G$Ny-Uv(z`+mCy^}C()*$<ZF4@%Y+i0m(onXg
z3Tnl&yFi7BvW-oXb7YC0H%F1_5Q#|=&89&zZI<U{5ySW14sKL#2c?Skhr58g{13{Z
zqw&Y^ykS?Ko9E*ug2yAsIxg4MKe}}<jeC9O^Bi0P$3vw=ewo}^pNswG7*@O5ZjEGO
z&mOQ0V~~Ddpz@aZ*IZJ)frQU>k?;|#XST1p$vy7sv!$-1nf+mcPIdUoZ`R9aAbmBF
zW}mz4Rr-d$N^tsxKLc;aM{oFbvwn$TReSt};5&I?M>%HDG=pt%%2#$nUEYVY=!mam
z)Oj~=?yVaoWRctIuE=fnWAf))608U@FV4UET7zWqgx^hencU+9S6gI%eMiwoFw0IK
zQ6w=~;awDgF&)9UFT4K!)_BnJKhP|5<uO1Y@7s^a3f5}zO9G8z8M-!Llr^+gQSsGa
zN<97X@}=7ux>*O=?UKV-O&9-`t*Cfr(XP2?d9Ea0*oqe;zMO77q71eWRhfa(?USy2
zBiJYV__;h%n7+h0S-OO|Z)?894q1<w<#}iCI5VdRcg<~e%+Q|?!5I{UhmSoZSW=jO
zL8%EM*VW|iVq*bkbn7FVg~!Vb!N7SM%R@RKFrk1hI8wJo5df}~__8Pq0?|Tc0fbfd
z@c?2Szu1OI2n2MVUd-c6_bimmV7?g?t}=~Ip4sG70<Un;NxSY5a{+E1k#wl<7woB@
z{{n*`Cz#D!0RTRrq<UHO2(4et1+#LKG6Yt)CDC>mXnjZUYRh97*!x$G)(wcIYvSXd
zq!CdMpf8Z4{Rq^3yXtOP*Rz+j3GwcNZ(^y}pS<*U?PKodYzQNcTusgSE&fL@g`qFH
zAhc)C!r1<Ur*xpr+4}JZs)>o3B1AS3KkbLBf%P+YcQs04fw3hpvZ+(4F>2b#!uzjO
z5`S9BS~pV~qT=S><#I|bbaRt>jeODq)ep4TVdf9LfFe*gq1zVEKA8Avc)1_F{?rzO
zY7zAn_YP5fpvA1FXBh^ooKO?^agQtbL{gW7x4U}E)HVkcrw`P$Ikkm#FTI3yqhhBi
zF~>n;c$1Fed66;2T(m4xmwlTAa~>Wshz{xcC~5=NWWK%3qW&2hw}KayJc~5-c^4oa
z1{QEapZYpM_bsJN`R30MVc0hURBdZU#$svAbM$Up6gU7gh)5OO`_&Z@UK)GyzpILj
zVhiBX(|X>+UruZAarQUg7xDYlyrfM_*xD*hm1B(CrOj+gWoI92F&Lz0bkT~?B0R?L
z3@WP%(K;eBQ-rl|*r71qF8g&kaz2oPaSP|x85)|_*1ypRAG{#^HvNd*U6n!?D$`4Q
zxF;l5mS!bScJ^X4y78khflE_cACW%n@lfmd+s{g5Dz|SPPWq_iw=YzwS?nE9j}M`7
z!7Y`QDx7h_a-B59OLnOJaAAKkCE$^rR}_k18siE&Q+(qu3XX&D>^X8)(cVyy)+I)X
z_}$~y-gd8?LrTaZl-A6gO+J4Yt*l~0)oi|2gVbAFS=r6j*D09KvNnBNUt_%wmO~au
zP=7F?LZHI2f$?5hdLr9Ki!#O!*h4XFh2iYsK^T0ICsz1*3%D3>WxLnZEtu=IV+&5)
zl)SPIbGv)+2=wx8OGpIvD7M>cY7-@%wR_t_3=DORA!Y&uk&=t=FfpuwsmJ49#BarX
zyJ!vFFjo=88*)9ROjH3;k=Itbyv!!|O5E{u1lWGp^vbOnTpkEWZE3N-^Gtio>>8_o
zgG}G-_wR4F2HzJvr$P3v*RQH~WbL0;NDU5_JW>qFJ#n_{o?c@uE_*S|ES60wQUwuy
z>v*4i?-lZ5A`(zFL~m@owb)wvjR1%6SH?&ZAWzlB1-vE`>g~!1a(zGWE;h$pa&YEj
zFvLt@x_TvgwhPfLnAffu)O=o+-19wKagEnTM;&UcWi5?uX70`a`3k?HaxDKmII?)v
z+^os}W1`sWa1H`8=)g;T2O~|5RR>nD-nkcjb8B9Pfcl>O3H%^VL<#3baPf&`SEP@?
z8O^`sWO|eE8qq7lgp+yfxGW@vJQN#NAMWF*o?cgZzslklaH21JY0Sub%}SVzq~EiY
zy#)3S4agIJrC^$9kTbmu;5XtRmYL0=uTygOuL#hL$f_dFrRHHMzfg8piS#W@N!OlH
z1_!*Jh%LwvDC4I8sY_)I#AmfrS7_qyP;20tga1rp-y?sW+Tm&8mU~uWY;CwZK2yXP
z(r&ZR5wuXXfnSu~Qdk)BzR}`?VuG@J<EMl}q>6JD8<!UoQAI?a+in5%rS=Kj_sDdn
z&APYRmO&qr&o$M<{Gm+BtTh+8+JL@#*{_3Z!ZwqUJKqQ2w2_@DPg+m%JLoH2yX(-Y
zVRVjD%FtDh)rD>m+v)bK%1dDt%l|#0-}lRKQj8SzW^JOAY%cED#J|uZ`LZXPlkx#)
zROuj;{!*8Fyj2@YtcSrL+HVOBdzF=Zl%BM9p`zg&%*^e$$|kQ}Iju2L$u@?2I*3u?
zYigHiTvqLopEAUO3&+UL8FUnv3c)XY!XNrBL4Y}%-Fhl@if-TOgazj`9J@0iO<HkT
zvv_90Wc$?@_Ub1K6i~b`x>47|7T9a|pCYA|Qg!$JYGXLYTk%4Y?<x(=UW$ACgaMO~
zs{&t&J6t-ZSC4pN3K9esX8cFL>uoqWv|he_G*(;O@p;YPKHV|_;uV9f>>hBLSlsuE
z*Jf$eL^#27JZ*(nC5r^b;KZ8{^wC7u8i=*SYsYo4zefeImhDE&*8}MR8n0-*>>#*u
z()l2R-AJ1QZK*l7F`_;?$uV$&*I6dorDk*1D+&qk42VdRk$-*!tvP(Qj~Xr(UDK9*
zj@w9Yn}3e>145>sI(Tn^aXaen^jEd346YO6R(9R$cO>WbybQJ=W%t68j`Jfiit|Zf
zOu#rOTG?Hp0LPCylStravFJIu8@qo0C-=#_onk?iXkC?B#@34L$*#V%NA(`lh#;{F
zB~vny$YhK!&#V-u&61HiMkA@Idr<Z4_7sEE)9>lh`u(YFv$1cc*DlH)bxg6vQj<Ha
zH8I#ui%)cPm7C2NFKm~rYOT}0A8EnJ&G?NpA^KExQFaE8n8l55mX+?-G&M5na^F)w
zx+!Qqq_dmEU6}xPw--^&eMIcYI}wD}rnD_>X%?1gu?Ul6PMRj+;<CJs&EsHY|MivS
zOy^74s_d*W#|T*5ysU#_+b93%582QB(^inWw3g9QjxfQ?M+3bXI>W9*lG%74qo;%#
zq(LAasx4WitfFIb9DbPR*vcX22@spLsy4w$j%sUu1WQwX4W!clE;vH~XWOrU$YV6=
z1so0sgTYXCi{N6>4AvdJ>LL7&unSiawnjq^i{M<O*|)34Pz#|cI5^T_Vg{Q(lusq=
zY+sPqkz90d@njCNs`8!LVwv1b0mh@6uI#?WT{vYMBic#>z#QjF!ki|GQQ*Z?nr3<X
ziRhJL=+n=tn$--%0@1k$;I}1XMyJJkjJ`|}*R4!`n=kRtgDwtVpMv{`VkqLN#lM58
zrzpx8=a)M-NN+e1LYVdCmfjFESy<!%h7|sImLR*Rs1I^H6J0zp=ASSe;5_%QH~Wma
z$-d}?JZbna_bTSd&D(KE?{O3$n~nyAdw5&twZWNjvoaBM=Ww4=apJRwIK}8|aacHB
zYQnLotf{&@X=&g7_T2EB_gZk@$FU#KV0@^Li7{5A|L)jMak#FAR4yOSdw=3=km7cH
z8DZ6i_f+%mf!S~Umh7z-(!fOsDLsps?!w%ytXj{lq^TFao@X~(4>DHD5>=1i)qW{;
zAMjqUoULhZL}s=ieaezPPfvYoaU7})q?T}G*?2gxIqLK@tC+VS`V=R1Uc=zLBT}Wy
zkN-E2U##A3Qt#^Zx1;NI8Xg=j#CVn1GD;YBdp-KdpfE<zy;py}7{n$Z&}NGG`x?%3
zxwq#-weg*074B~sphpE>dI`;LZJ38Z%=iaofe}`Lyx)%p!_((c7-}UpA4Cj?Ia&=Y
zY)h3#opExydZCRu>|blR2PQIaX3`}TC*m2F+)wsb9VbQmzfOoght%G#>$g9A8&K9R
zsP?mpkgkR5zO!Z-GZV4G41EIS?BC6|7jsNrU1#{E-Yj@VebnEk&nNK<xqPQ)7;ntt
z1jOkYNG0om(s)&l<%OlqUAq=vf0{rRo3H#ux*m&v>u><6{`sOz#hJ(<DUVCz*t4^Y
zHx<KoeDuRh2>8N%`rziEiZ`ES<H%KUd--e7?PTKF3DctDXp^6DSMTR7-^o+~W}5W;
z^i~14qmHGZfp)>!CRpmw9CcK-XGFbE&WgG_O<Rxli(eIj(D&g0s!$nVL{-t)@))*X
z+i8H!(E}W@=_E5-UZIi9erL7{9H?%?-}V=x>_@t8%_qV7-~VO%flV(Na#4mJ8|@BL
z7xCIP_VFvbRd3i!H@!N#*8UK*dio^i{3*02OJRd&(t+&yjal~asP<G~+#^+Uc6r{6
z$i}1Gpqs2uq*S3vKS8p$`(oL*$KBJN&MWb*B;?08KS*!?(D(yO-b`Ji6!Wu(eUz3M
zB-(2yjm0N4+j`DSDLKIDY#d3*G%k4O(VbHf4b{xza`{^s1$%|HNPG>64#&S2M+Z%v
zDFEKf$;&f^N-q5A8m;l;Fqz=$zo@F<7_9r7-fBJGTAb%l2EvPw9wWTd?{c3uSbiqr
zLopVa(<S$*O=PrDR*U(b$VD<zeWwsVohw{%Oh-^B`fE|WQGY4)Hc{Jh6&=HNj-)~e
z8uW!9`MZRb6B?Q|TZ81q1>4h@X3Y{amb0$e(-i$b(%e0JziCPm4>aL(hQ!jL!OO<R
z5CURd-R>C|I10rfrXkY7l+Z$yT5mRA`)`@p+^!#+*BA}5sD}VI<cN6_Q(1AbRdKAn
zV_lPHtNQhBz>hPMTZ>v1X02APdk&q>5zY-3|20chC~coLfy(!s4UvGXrlk&y+}}Oa
zA3Dj8?~;z2td<54V`F1a1sGZR-4}xwfm(c^fzXQ3>}jm9tX5BS5PuJgjyWKSxOhdk
z_xkHdP}5+kp%Jzr)z_(1#2t^IWKZq6g-U<I_*{0*ixw;lqXlmCTft>d4fYxR-4KS@
zkISD+7J@7FFr;ZjH#D~le|YYB+I4wUL%sLaOW#BcIHdD6tJtc)wpdg&eXWI5yCV&r
z+K==I*GX&Kfp-92>$YiZ+T2j-YA8potX$tc|NO3ik*oA^qqWN;HmTUEWisK9{N`qe
z>XMd)S<NqSb~~w?y+31n;@qeU2o$dDt~+F``Gbj-P&t)lFGrJ2YZ1g&8w)|$og8!q
zh)-iB-7Cx_r+tcCS@B`yK)W9(YjCL4RAr<hx_7&b(XZwOf1vbgN+Rn<dTHBSY=eI?
z`9?sbOAa~o^Ar8qoc0jo*Yc@v^7z9$iFYe6Q`2e;s(ior+ZB3K@5JRyr*t|e>>~su
zT>Zr39gB0&Nn!IRzN)n>H=?d(xehnC-c7WO|G{*H-?_!4+-~DM4hFYt@_H-FI}fQ7
zkY)UE<rX22v6bB>F>2-)j!99(>SD{}wqNlY$J!}_5=ti^RQ$MOb_lLME-B3R&?u`k
z>K1!k^U%;}v-a>f(9?7)J6}}H(D$X>bmMHmY&%y(=XHX5wR+0eOmw>brNDQ4=~HK>
zIXZK<`s}%exz++c?VXxvqVB%(Zen{+E`Le>VU!{#S*{HFoZ<g!%8`@X;W&}77vp?4
zwfpEa^36kO3<_yz$f-6V(K?y8<E`rda?hN=kf&DW)lrMI+j5{?dnx1CXSJfc?P#|l
zi@Ulg+GHn9yV`}^)_Kn`)gbMCWgALogyJw(v11Z)-47+<t>UyBaXPp2=S!=h$>vJX
z)sCJyLe<DkpW<Qnz53^|4RN|s<|BPCi3_@yTpmk}R=9Yyay~s9$1{tde2|L9@6*R^
zZNJV)vrUtfjK`^yaiSkn3BA%`zFc^AxmTEE;l&cQLl?@X0t^BHwIqE9QF|*`8%3xr
z^lGUT&|cdX_!hN(v;tpFgCJfx&9vf48Bq){p-se!nSf~MVnsv+KgAHDP_~zVg@Rz{
za$n0FT4(~14m}tmDaRqhU}Pa9Cq2MIm;WX&Lwx^N1VSEg-Uv~$Pu~bcqkrW9l;zds
JYGuqq{|~t*7L@=1

literal 0
HcmV?d00001

diff --git a/processingLoots.json b/processingLoots.json
deleted file mode 100644
index 0637a08..0000000
--- a/processingLoots.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
\ No newline at end of file
diff --git a/resources/mcpe-default-addon b/resources/mcpe-default-addon
deleted file mode 160000
index f74c058..0000000
--- a/resources/mcpe-default-addon
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit f74c0588519ea390f5a09270d9c5d28d53e2de57
diff --git a/src/Ad5001/BetterGen/Main.php b/src/Ad5001/BetterGen/Main.php
index 92d0e68..aae520b 100644
--- a/src/Ad5001/BetterGen/Main.php
+++ b/src/Ad5001/BetterGen/Main.php
@@ -88,7 +88,8 @@ class Main extends PluginBase implements Listener {
 		Generator::addGenerator(BetterNormal::class, "betternormal");
 		if ($this->isOtherNS()) $this->getLogger()->warning("Tesseract detected. Note that Tesseract is not up to date with the generation structure and some generation features may be limited or not working");
 		@mkdir($this->getDataFolder());
-		if (!in_array($this->getDataFolder() . 'resources\mcpe-default-addon\.', $this->getResources())) $this->getLogger()->alert('The loot files are missing! Make sure you got all files / did git clone --recursive');
+		@mkdir($this->getDataFolder() . 'addon');
+		if ((($files = @scandir($this->getDataFolder() . 'addon')) && count($files) <= 2)) $this->getLogger()->alert('The loot files are missing, this means no loot will generate! You can get them here: https://aka.ms/behaviorpacktemplate or here https://github.com/dktapps/mcpe-default-addon for an optimised version');
 	}
 
 	/**
@@ -324,7 +325,7 @@ class Main extends PluginBase implements Listener {
 		if (!$tile instanceof TileChest) return;
 		//Check if lootchest (or already generated loot)
 		if (!isset($tile->namedtag->generateLoot)) return;
-		$table = new LootTable($config = new Config(self::getInstance()->getDataFolder() . '\\resources\\mcpe-default-addon\\' . $tile->namedtag->generateLoot . '.json'));
+		$table = new LootTable($config = new Config(self::getInstance()->getDataFolder() . 'addon\\' . $tile->namedtag->generateLoot . '.json', Config::DETECT, []));
 		$size = $tile->getInventory()->getSize();
 		$loot = $table->getRandomLoot($random);
 		$items = array_pad($loot, $size, Item::get(0));
diff --git a/src/Ad5001/BetterGen/loot/LootTable.php b/src/Ad5001/BetterGen/loot/LootTable.php
index 51bcfbd..c7d94f7 100644
--- a/src/Ad5001/BetterGen/loot/LootTable.php
+++ b/src/Ad5001/BetterGen/loot/LootTable.php
@@ -56,7 +56,7 @@ class LootTable {
 				$val = $rolls["entries"][$this->getRandomWeightedElement($array)];
 				//typecheck
 				if ($val["type"] == "loot_table") {
-					$loottable = new LootTable(new Config(Main::getInstance()->getDataFolder() . '\\resources\\mcpe-default-addon\\' . $val["name"] . ".json"));
+					$loottable = new LootTable(new Config(Main::getInstance()->getDataFolder() . 'addon\\' . $val["name"] . ".json", Config::DETECT, []));
 					$items = array_merge($items, $loottable->getRandomLoot($random));
 					unset($loottable);
 				} elseif ($val["type"] == "item") {