Biome: Added UnknownBiome class to avoid astonishing behaviour on unknown biomes

This commit is contained in:
Dylan K. Taylor
2018-06-08 10:09:03 +01:00
parent 8c6161a4f2
commit 4e3e807741
2 changed files with 38 additions and 1 deletions

View File

@ -107,7 +107,10 @@ abstract class Biome{
* @return Biome
*/
public static function getBiome(int $id) : Biome{
return self::$biomes[$id] ?? self::$biomes[self::OCEAN];
if(self::$biomes[$id] === null){
self::register($id, new UnknownBiome());
}
return self::$biomes[$id];
}
public function clearPopulators(){