clearPopulators (); $this->type = $type; $bush = new BushPopulator ( $type ); $bush->setBaseAmount ( 10 ); $this->addPopulator ( $bush ); $trees = new TreePopulator ( $type ); $trees->setBaseAmount ( (null !== @constant ( TreePopulator::$types [$type] . "::maxPerChunk" )) ? constant ( TreePopulator::$types [$type] . "::maxPerChunk" ) : 5 ); $this->addPopulator ( $trees ); $tallGrass = new TallGrass (); $tallGrass->setBaseAmount ( 3 ); $this->addPopulator ( $tallGrass ); $this->setElevation ( 63, 81 ); $this->temperature = $infos [0]; $this->rainfall = $infos [1]; } public function getName() { return self::$types [$this->type]; } /* * Returns the ID relativly. */ public function getId() { return self::$ids [$this->type]; } /* * Registers a forest type. Don't use this method directly use the one from the main class. * @param $name string * @param $treeClass string * @param * @return bool */ public static function registerForest(string $name, string $treeClass, array $infos): bool { self::$types [] = str_ireplace ( "tree", "", explode ( "\\", $treeClass ) [count ( explode ( "\\", $treeClass ) )] ) . " Forest"; TreePopulator::$types [] = $treeClass; self::$ids [] = Main::SAKURA_FOREST + (count ( self::$types ) - 2); Main::register ( Main::SAKURA_FOREST + (count ( self::$types ) - 2), new BetterForest ( count ( self::$types ) - 1, $infos ) ); } }