2016-06-22 23:49:47 -04:00
/*
* Minecraft Forge
2021-03-10 23:05:53 +01:00
* Copyright (c) 2016-2021.
2016-06-22 23:49:47 -04:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
2020-08-25 03:11:28 +02:00
2013-04-04 17:55:35 -07:00
package net.minecraftforge.common ;
import java.util.* ;
2017-06-27 14:04:51 -07:00
import java.util.stream.Collectors ;
2020-10-15 12:43:18 -07:00
import java.util.stream.StreamSupport ;
2013-09-05 10:08:02 -04:00
2016-12-01 00:48:44 +01:00
import javax.annotation.Nonnull ;
2018-09-11 18:25:25 -07:00
import javax.annotation.Nullable ;
import org.apache.logging.log4j.LogManager ;
import org.apache.logging.log4j.Logger ;
2016-04-09 18:03:46 -05:00
2021-07-17 00:08:49 -05:00
import net.minecraft.world.level.biome.Biomes ;
import net.minecraft.resources.ResourceKey ;
import net.minecraft.core.Registry ;
2013-04-04 17:55:35 -07:00
import static net.minecraftforge.common.BiomeDictionary.Type.* ;
2018-09-06 04:39:01 -07:00
import net.minecraftforge.registries.ForgeRegistries ;
2016-12-01 00:48:44 +01:00
import com.google.common.collect.ImmutableList ;
2013-04-04 17:55:35 -07:00
2021-07-17 00:08:49 -05:00
import net.minecraft.world.level.biome.Biome ;
2013-04-04 17:55:35 -07:00
public class BiomeDictionary
{
2017-06-27 14:04:51 -07:00
private static final boolean DEBUG = false ;
2018-09-11 18:25:25 -07:00
private static final Logger LOGGER = LogManager . getLogger ();
2017-06-27 14:04:51 -07:00
2016-12-01 00:48:44 +01:00
public static final class Type
2013-04-04 17:55:35 -07:00
{
2020-10-15 12:43:18 -07:00
private static final Map < String , Type > byName = new TreeMap <> ();
2018-04-01 03:03:27 -05:00
private static Collection < Type > allTypes = Collections . unmodifiableCollection ( byName . values ());
2016-12-01 00:48:44 +01:00
2020-10-15 12:43:18 -07:00
/*Temperature-based tags. Specifying neither implies a biome is temperate*/
2016-12-01 00:48:44 +01:00
public static final Type HOT = new Type ( "HOT" );
public static final Type COLD = new Type ( "COLD" );
2020-10-15 12:43:18 -07:00
//Tags specifying the amount of vegetation a biome has. Specifying neither implies a biome to have moderate amounts*/
2016-12-01 00:48:44 +01:00
public static final Type SPARSE = new Type ( "SPARSE" );
public static final Type DENSE = new Type ( "DENSE" );
2020-10-15 12:43:18 -07:00
//Tags specifying how moist a biome is. Specifying neither implies the biome as having moderate humidity*/
2016-12-01 00:48:44 +01:00
public static final Type WET = new Type ( "WET" );
public static final Type DRY = new Type ( "DRY" );
2014-07-01 12:46:00 +10:00
/*Tree-based tags, SAVANNA refers to dry, desert-like trees (Such as Acacia), CONIFEROUS refers to snowy trees (Such as Spruce) and JUNGLE refers to jungle trees.
2020-10-15 12:43:18 -07:00
* Specifying no tag implies a biome has temperate trees (Such as Oak)*/
2016-12-01 00:48:44 +01:00
public static final Type SAVANNA = new Type ( "SAVANNA" );
public static final Type CONIFEROUS = new Type ( "CONIFEROUS" );
public static final Type JUNGLE = new Type ( "JUNGLE" );
2014-07-07 21:29:37 -07:00
2020-10-15 12:43:18 -07:00
/*Tags specifying the nature of a biome*/
2016-12-01 00:48:44 +01:00
public static final Type SPOOKY = new Type ( "SPOOKY" );
public static final Type DEAD = new Type ( "DEAD" );
public static final Type LUSH = new Type ( "LUSH" );
public static final Type MUSHROOM = new Type ( "MUSHROOM" );
public static final Type MAGICAL = new Type ( "MAGICAL" );
2016-12-03 10:46:36 -08:00
public static final Type RARE = new Type ( "RARE" );
2019-11-01 12:26:08 -06:00
public static final Type PLATEAU = new Type ( "PLATEAU" );
public static final Type MODIFIED = new Type ( "MODIFIED" );
2016-12-01 00:48:44 +01:00
public static final Type OCEAN = new Type ( "OCEAN" );
public static final Type RIVER = new Type ( "RIVER" );
/**
* A general tag for all water-based biomes. Shown as present if OCEAN or RIVER are.
2020-10-15 12:43:18 -07:00
**/
2016-12-01 00:48:44 +01:00
public static final Type WATER = new Type ( "WATER" , OCEAN , RIVER );
2014-07-07 21:29:37 -07:00
2020-10-15 12:43:18 -07:00
/*Generic types which a biome can be*/
2016-12-01 00:48:44 +01:00
public static final Type MESA = new Type ( "MESA" );
public static final Type FOREST = new Type ( "FOREST" );
public static final Type PLAINS = new Type ( "PLAINS" );
public static final Type MOUNTAIN = new Type ( "MOUNTAIN" );
public static final Type HILLS = new Type ( "HILLS" );
public static final Type SWAMP = new Type ( "SWAMP" );
public static final Type SANDY = new Type ( "SANDY" );
public static final Type SNOWY = new Type ( "SNOWY" );
public static final Type WASTELAND = new Type ( "WASTELAND" );
public static final Type BEACH = new Type ( "BEACH" );
2016-12-03 10:46:36 -08:00
public static final Type VOID = new Type ( "VOID" );
2016-12-01 00:48:44 +01:00
2020-10-15 12:43:18 -07:00
/*Tags specifying the dimension a biome generates in. Specifying none implies a biome that generates in a modded dimension*/
2019-11-01 12:26:08 -06:00
public static final Type OVERWORLD = new Type ( "OVERWORLD" );
public static final Type NETHER = new Type ( "NETHER" );
public static final Type END = new Type ( "END" );
2016-12-01 00:48:44 +01:00
private final String name ;
private final List < Type > subTypes ;
2021-07-17 00:08:49 -05:00
private final Set < ResourceKey < Biome >> biomes = new HashSet <> ();
private final Set < ResourceKey < Biome >> biomesUn = Collections . unmodifiableSet ( biomes );
2016-12-01 00:48:44 +01:00
private Type ( String name , Type ... subTypes )
{
this . name = name ;
this . subTypes = ImmutableList . copyOf ( subTypes );
byName . put ( name , this );
}
/**
* Gets the name for this type.
2020-10-15 12:43:18 -07:00
*/
2016-12-01 00:48:44 +01:00
public String getName ()
2014-07-01 12:46:00 +10:00
{
2016-12-01 00:48:44 +01:00
return name ;
2014-07-01 12:46:00 +10:00
}
2014-07-07 21:29:37 -07:00
2016-12-01 00:48:44 +01:00
public String toString ()
2014-07-01 12:46:00 +10:00
{
2016-12-01 00:48:44 +01:00
return name ;
2014-07-01 12:46:00 +10:00
}
2014-07-07 21:29:37 -07:00
/**
2016-12-01 00:48:44 +01:00
* Retrieves a Type instance by name,
2014-07-07 21:29:37 -07:00
* if one does not exist already it creates one.
2016-03-23 17:34:48 +03:00
* This can be used as intermediate measure for modders to
2016-12-01 00:48:44 +01:00
* add their own Biome types.
* <p>
* There are <i>no</i> naming conventions besides:
* <ul><li><b>Must</b> be all upper case (enforced by name.toUpper())</li>
* <li><b>No</b> Special characters. {Unenforced, just don't be a pain, if it becomes a issue I WILL
* make this RTE with no worry about backwards compatibility}</li></ul>
* <p>
2014-07-07 21:29:37 -07:00
* Note: For performance sake, the return value of this function SHOULD be cached.
* Two calls with the same name SHOULD return the same value.
*
* @param name The name of this Type
* @return An instance of Type for this name.
2020-10-15 12:43:18 -07:00
*/
2014-07-07 21:29:37 -07:00
public static Type getType ( String name , Type ... subTypes )
{
name = name . toUpperCase ();
2016-12-01 00:48:44 +01:00
Type t = byName . get ( name );
if ( t == null )
2015-06-12 17:08:19 -07:00
{
2016-12-01 00:48:44 +01:00
t = new Type ( name , subTypes );
2014-08-14 20:33:23 -07:00
}
2016-12-01 00:48:44 +01:00
return t ;
2014-07-07 21:29:37 -07:00
}
2018-09-11 18:25:25 -07:00
2018-04-01 03:03:27 -05:00
/**
* @return An unmodifiable collection of all current biome types.
2020-10-15 12:43:18 -07:00
*/
2018-04-01 03:03:27 -05:00
public static Collection < Type > getAll ()
{
return allTypes ;
}
2018-09-11 18:25:25 -07:00
@Nullable
2021-07-17 00:08:49 -05:00
public static Type fromVanilla ( Biome . BiomeCategory category )
2018-09-11 18:25:25 -07:00
{
2021-07-17 00:08:49 -05:00
if ( category == Biome . BiomeCategory . NONE )
2018-09-11 18:25:25 -07:00
return null ;
2021-07-17 00:08:49 -05:00
if ( category == Biome . BiomeCategory . THEEND )
2018-09-11 18:25:25 -07:00
return VOID ;
return getType ( category . name ());
}
2013-04-04 17:55:35 -07:00
}
2021-07-17 00:08:49 -05:00
private static final Map < ResourceKey < Biome > , BiomeInfo > biomeInfoMap = new HashMap <> ();
2013-04-04 17:55:35 -07:00
private static class BiomeInfo
{
2016-12-01 00:48:44 +01:00
private final Set < Type > types = new HashSet < Type > ();
private final Set < Type > typesUn = Collections . unmodifiableSet ( this . types );
2013-04-04 17:55:35 -07:00
}
2020-10-15 12:43:18 -07:00
public static void init () {}
2013-04-04 17:55:35 -07:00
static
{
registerVanillaBiomes ();
}
/**
2016-12-01 00:48:44 +01:00
* Adds the given types to the biome.
2014-07-07 21:29:37 -07:00
*
2020-10-15 12:43:18 -07:00
*/
2021-07-17 00:08:49 -05:00
public static void addTypes ( ResourceKey < Biome > biome , Type ... types )
2014-07-07 21:29:37 -07:00
{
2017-02-04 18:29:42 +01:00
Collection < Type > supertypes = listSupertypes ( types );
2017-06-27 14:04:51 -07:00
Collections . addAll ( supertypes , types );
2013-04-04 17:55:35 -07:00
2017-02-04 18:29:42 +01:00
for ( Type type : supertypes )
2016-12-01 00:48:44 +01:00
{
type . biomes . add ( biome );
2013-04-04 17:55:35 -07:00
}
2017-02-05 18:47:07 +01:00
BiomeInfo biomeInfo = getBiomeInfo ( biome );
Collections . addAll ( biomeInfo . types , types );
biomeInfo . types . addAll ( supertypes );
2013-04-04 17:55:35 -07:00
}
/**
2016-12-01 00:48:44 +01:00
* Gets the set of biomes that have the given type.
2014-07-07 21:29:37 -07:00
*
2020-10-15 12:43:18 -07:00
*/
2016-12-01 00:48:44 +01:00
@Nonnull
2021-07-17 00:08:49 -05:00
public static Set < ResourceKey < Biome >> getBiomes ( Type type )
2013-04-04 17:55:35 -07:00
{
2016-12-01 00:48:44 +01:00
return type . biomesUn ;
2013-04-04 17:55:35 -07:00
}
/**
2016-12-01 00:48:44 +01:00
* Gets the set of types that have been added to the given biome.
2014-07-07 21:29:37 -07:00
*
2020-10-15 12:43:18 -07:00
*/
2016-12-01 00:48:44 +01:00
@Nonnull
2021-07-17 00:08:49 -05:00
public static Set < Type > getTypes ( ResourceKey < Biome > biome )
2013-04-04 17:55:35 -07:00
{
2016-12-01 00:48:44 +01:00
return getBiomeInfo ( biome ). typesUn ;
2013-04-04 17:55:35 -07:00
}
/**
2016-12-01 00:48:44 +01:00
* Checks if the two given biomes have types in common.
2014-07-07 21:29:37 -07:00
*
2013-04-04 17:55:35 -07:00
* @return returns true if a common type is found, false otherwise
2020-10-15 12:43:18 -07:00
*/
2021-07-17 00:08:49 -05:00
public static boolean areSimilar ( ResourceKey < Biome > biomeA , ResourceKey < Biome > biomeB )
2013-04-04 17:55:35 -07:00
{
2020-10-15 12:43:18 -07:00
Set < Type > typesA = getTypes ( biomeA );
Set < Type > typesB = getTypes ( biomeB );
return typesA . stream (). anyMatch ( typesB :: contains );
2013-04-04 17:55:35 -07:00
}
/**
2016-12-01 00:48:44 +01:00
* Checks if the given type has been added to the given biome.
2014-07-07 21:29:37 -07:00
*
2020-10-15 12:43:18 -07:00
*/
2021-07-17 00:08:49 -05:00
public static boolean hasType ( ResourceKey < Biome > biome , Type type )
2014-07-07 21:29:37 -07:00
{
2016-12-01 00:48:44 +01:00
return getTypes ( biome ). contains ( type );
2013-04-04 17:55:35 -07:00
}
/**
2016-12-01 00:48:44 +01:00
* Checks if any type has been added to the given biome.
2014-07-07 21:29:37 -07:00
*
2020-10-15 12:43:18 -07:00
*/
2021-07-17 00:08:49 -05:00
public static boolean hasAnyType ( ResourceKey < Biome > biome )
2013-04-04 17:55:35 -07:00
{
2016-12-01 00:48:44 +01:00
return ! getBiomeInfo ( biome ). types . isEmpty ();
2013-04-04 17:55:35 -07:00
}
2014-07-07 21:29:37 -07:00
//Internal implementation
2021-07-17 00:08:49 -05:00
private static BiomeInfo getBiomeInfo ( ResourceKey < Biome > biome )
2013-04-04 17:55:35 -07:00
{
2020-10-15 12:43:18 -07:00
return biomeInfoMap . computeIfAbsent ( biome , k -> new BiomeInfo ());
2013-04-04 17:55:35 -07:00
}
2017-02-04 18:29:42 +01:00
private static Collection < Type > listSupertypes ( Type ... types )
2013-04-04 17:55:35 -07:00
{
2017-02-04 18:29:42 +01:00
Set < Type > supertypes = new HashSet < Type > ();
Deque < Type > next = new ArrayDeque < Type > ();
Collections . addAll ( next , types );
2014-07-07 21:29:37 -07:00
2017-02-04 18:29:42 +01:00
while ( ! next . isEmpty ())
2014-07-01 12:46:00 +10:00
{
2017-02-04 18:29:42 +01:00
Type type = next . remove ();
for ( Type sType : Type . byName . values ())
2016-12-01 00:48:44 +01:00
{
2017-06-27 14:04:51 -07:00
if ( sType . subTypes . contains ( type ) && supertypes . add ( sType ))
2017-02-04 18:29:42 +01:00
next . add ( sType );
2016-12-01 00:48:44 +01:00
}
2014-07-01 12:46:00 +10:00
}
2014-07-07 21:29:37 -07:00
2017-02-04 18:29:42 +01:00
return supertypes ;
2014-07-01 12:46:00 +10:00
}
2013-04-04 17:55:35 -07:00
private static void registerVanillaBiomes ()
{
2020-08-13 00:13:48 -07:00
addTypes ( Biomes . OCEAN , OCEAN , OVERWORLD );
addTypes ( Biomes . PLAINS , PLAINS , OVERWORLD );
addTypes ( Biomes . DESERT , HOT , DRY , SANDY , OVERWORLD );
addTypes ( Biomes . MOUNTAINS , MOUNTAIN , HILLS , OVERWORLD );
addTypes ( Biomes . FOREST , FOREST , OVERWORLD );
addTypes ( Biomes . TAIGA , COLD , CONIFEROUS , FOREST , OVERWORLD );
addTypes ( Biomes . SWAMP , WET , SWAMP , OVERWORLD );
addTypes ( Biomes . RIVER , RIVER , OVERWORLD );
2020-10-29 01:11:57 +01:00
addTypes ( Biomes . NETHER_WASTES , HOT , DRY , NETHER );
2020-08-13 00:13:48 -07:00
addTypes ( Biomes . THE_END , COLD , DRY , END );
addTypes ( Biomes . FROZEN_OCEAN , COLD , OCEAN , SNOWY , OVERWORLD );
addTypes ( Biomes . FROZEN_RIVER , COLD , RIVER , SNOWY , OVERWORLD );
addTypes ( Biomes . SNOWY_TUNDRA , COLD , SNOWY , WASTELAND , OVERWORLD );
addTypes ( Biomes . SNOWY_MOUNTAINS , COLD , SNOWY , MOUNTAIN , OVERWORLD );
addTypes ( Biomes . MUSHROOM_FIELDS , MUSHROOM , RARE , OVERWORLD );
addTypes ( Biomes . MUSHROOM_FIELD_SHORE , MUSHROOM , BEACH , RARE , OVERWORLD );
addTypes ( Biomes . BEACH , BEACH , OVERWORLD );
addTypes ( Biomes . DESERT_HILLS , HOT , DRY , SANDY , HILLS , OVERWORLD );
addTypes ( Biomes . WOODED_HILLS , FOREST , HILLS , OVERWORLD );
addTypes ( Biomes . TAIGA_HILLS , COLD , CONIFEROUS , FOREST , HILLS , OVERWORLD );
addTypes ( Biomes . MOUNTAIN_EDGE , MOUNTAIN , OVERWORLD );
addTypes ( Biomes . JUNGLE , HOT , WET , DENSE , JUNGLE , OVERWORLD );
addTypes ( Biomes . JUNGLE_HILLS , HOT , WET , DENSE , JUNGLE , HILLS , OVERWORLD );
addTypes ( Biomes . JUNGLE_EDGE , HOT , WET , JUNGLE , FOREST , RARE , OVERWORLD );
addTypes ( Biomes . DEEP_OCEAN , OCEAN , OVERWORLD );
addTypes ( Biomes . STONE_SHORE , BEACH , OVERWORLD );
addTypes ( Biomes . SNOWY_BEACH , COLD , BEACH , SNOWY , OVERWORLD );
addTypes ( Biomes . BIRCH_FOREST , FOREST , OVERWORLD );
addTypes ( Biomes . BIRCH_FOREST_HILLS , FOREST , HILLS , OVERWORLD );
addTypes ( Biomes . DARK_FOREST , SPOOKY , DENSE , FOREST , OVERWORLD );
addTypes ( Biomes . SNOWY_TAIGA , COLD , CONIFEROUS , FOREST , SNOWY , OVERWORLD );
addTypes ( Biomes . SNOWY_TAIGA_HILLS , COLD , CONIFEROUS , FOREST , SNOWY , HILLS , OVERWORLD );
addTypes ( Biomes . GIANT_TREE_TAIGA , COLD , CONIFEROUS , FOREST , OVERWORLD );
addTypes ( Biomes . GIANT_TREE_TAIGA_HILLS , COLD , CONIFEROUS , FOREST , HILLS , OVERWORLD );
addTypes ( Biomes . WOODED_MOUNTAINS , MOUNTAIN , FOREST , SPARSE , OVERWORLD );
addTypes ( Biomes . SAVANNA , HOT , SAVANNA , PLAINS , SPARSE , OVERWORLD );
addTypes ( Biomes . SAVANNA_PLATEAU , HOT , SAVANNA , PLAINS , SPARSE , RARE , OVERWORLD , PLATEAU );
addTypes ( Biomes . BADLANDS , MESA , SANDY , DRY , OVERWORLD );
addTypes ( Biomes . WOODED_BADLANDS_PLATEAU , MESA , SANDY , DRY , SPARSE , OVERWORLD , PLATEAU );
addTypes ( Biomes . BADLANDS_PLATEAU , MESA , SANDY , DRY , OVERWORLD , PLATEAU );
addTypes ( Biomes . SMALL_END_ISLANDS , END );
addTypes ( Biomes . END_MIDLANDS , END );
addTypes ( Biomes . END_HIGHLANDS , END );
addTypes ( Biomes . END_BARRENS , END );
addTypes ( Biomes . WARM_OCEAN , OCEAN , HOT , OVERWORLD );
addTypes ( Biomes . LUKEWARM_OCEAN , OCEAN , OVERWORLD );
addTypes ( Biomes . COLD_OCEAN , OCEAN , COLD , OVERWORLD );
addTypes ( Biomes . DEEP_WARM_OCEAN , OCEAN , HOT , OVERWORLD );
addTypes ( Biomes . DEEP_LUKEWARM_OCEAN , OCEAN , OVERWORLD );
addTypes ( Biomes . DEEP_COLD_OCEAN , OCEAN , COLD , OVERWORLD );
addTypes ( Biomes . DEEP_FROZEN_OCEAN , OCEAN , COLD , OVERWORLD );
addTypes ( Biomes . THE_VOID , VOID );
addTypes ( Biomes . SUNFLOWER_PLAINS , PLAINS , RARE , OVERWORLD );
addTypes ( Biomes . DESERT_LAKES , HOT , DRY , SANDY , RARE , OVERWORLD );
addTypes ( Biomes . GRAVELLY_MOUNTAINS , MOUNTAIN , SPARSE , RARE , OVERWORLD );
addTypes ( Biomes . FLOWER_FOREST , FOREST , HILLS , RARE , OVERWORLD );
addTypes ( Biomes . TAIGA_MOUNTAINS , COLD , CONIFEROUS , FOREST , MOUNTAIN , RARE , OVERWORLD );
addTypes ( Biomes . SWAMP_HILLS , WET , SWAMP , HILLS , RARE , OVERWORLD );
addTypes ( Biomes . ICE_SPIKES , COLD , SNOWY , HILLS , RARE , OVERWORLD );
addTypes ( Biomes . MODIFIED_JUNGLE , HOT , WET , DENSE , JUNGLE , MOUNTAIN , RARE , OVERWORLD , MODIFIED );
addTypes ( Biomes . MODIFIED_JUNGLE_EDGE , HOT , SPARSE , JUNGLE , HILLS , RARE , OVERWORLD , MODIFIED );
addTypes ( Biomes . TALL_BIRCH_FOREST , FOREST , DENSE , HILLS , RARE , OVERWORLD );
addTypes ( Biomes . TALL_BIRCH_HILLS , FOREST , DENSE , MOUNTAIN , RARE , OVERWORLD );
addTypes ( Biomes . DARK_FOREST_HILLS , SPOOKY , DENSE , FOREST , MOUNTAIN , RARE , OVERWORLD );
addTypes ( Biomes . SNOWY_TAIGA_MOUNTAINS , COLD , CONIFEROUS , FOREST , SNOWY , MOUNTAIN , RARE , OVERWORLD );
addTypes ( Biomes . GIANT_SPRUCE_TAIGA , DENSE , FOREST , RARE , OVERWORLD );
addTypes ( Biomes . GIANT_SPRUCE_TAIGA_HILLS , DENSE , FOREST , HILLS , RARE , OVERWORLD );
addTypes ( Biomes . MODIFIED_GRAVELLY_MOUNTAINS , MOUNTAIN , SPARSE , RARE , OVERWORLD , MODIFIED );
addTypes ( Biomes . SHATTERED_SAVANNA , HOT , DRY , SPARSE , SAVANNA , MOUNTAIN , RARE , OVERWORLD );
addTypes ( Biomes . SHATTERED_SAVANNA_PLATEAU , HOT , DRY , SPARSE , SAVANNA , HILLS , RARE , OVERWORLD , PLATEAU );
addTypes ( Biomes . ERODED_BADLANDS , HOT , DRY , SPARSE , MOUNTAIN , RARE , OVERWORLD );
addTypes ( Biomes . MODIFIED_WOODED_BADLANDS_PLATEAU , HOT , DRY , SPARSE , HILLS , RARE , OVERWORLD , PLATEAU , MODIFIED );
addTypes ( Biomes . MODIFIED_BADLANDS_PLATEAU , HOT , DRY , SPARSE , MOUNTAIN , RARE , OVERWORLD , PLATEAU , MODIFIED );
2020-10-15 12:43:18 -07:00
addTypes ( Biomes . BAMBOO_JUNGLE , HOT , WET , RARE , JUNGLE , OVERWORLD );
addTypes ( Biomes . BAMBOO_JUNGLE_HILLS , HOT , WET , RARE , JUNGLE , HILLS , OVERWORLD );
2020-10-29 01:11:57 +01:00
addTypes ( Biomes . SOUL_SAND_VALLEY , HOT , DRY , NETHER );
addTypes ( Biomes . CRIMSON_FOREST , HOT , DRY , NETHER , FOREST );
addTypes ( Biomes . WARPED_FOREST , HOT , DRY , NETHER , FOREST );
addTypes ( Biomes . BASALT_DELTAS , HOT , DRY , NETHER );
2017-06-27 14:04:51 -07:00
if ( DEBUG )
{
2018-09-11 18:25:25 -07:00
StringBuilder buf = new StringBuilder ();
buf . append ( "BiomeDictionary:\n" );
2020-10-15 12:43:18 -07:00
Type . byName . forEach (( name , type ) ->
buf . append ( " " ). append ( type . name ). append ( ": " )
. append ( type . biomes . stream ()
2021-07-17 00:08:49 -05:00
. map ( ResourceKey :: location )
2020-10-15 12:43:18 -07:00
. sorted (( a , b ) -> a . compareNamespaced ( b ))
. map ( Object :: toString )
. collect ( Collectors . joining ( ", " ))
)
. append ( '\n' )
);
boolean missing = false ;
2021-07-17 00:08:49 -05:00
List < ResourceKey < Biome >> all = StreamSupport . stream ( ForgeRegistries . BIOMES . spliterator (), false )
. map ( b -> ResourceKey . create ( Registry . BIOME_REGISTRY , b . getRegistryName ()))
2020-10-15 12:43:18 -07:00
. sorted (). collect ( Collectors . toList ());
2021-07-17 00:08:49 -05:00
for ( ResourceKey < Biome > key : all ) {
2020-10-15 12:43:18 -07:00
if ( ! biomeInfoMap . containsKey ( key )) {
if ( ! missing ) {
buf . append ( "Missing:\n" );
missing = true ;
}
2021-03-09 13:37:23 -08:00
buf . append ( " " ). append ( key . location ()). append ( '\n' );
2020-10-15 12:43:18 -07:00
}
}
2018-09-11 18:25:25 -07:00
LOGGER . debug ( buf . toString ());
2017-06-27 14:04:51 -07:00
}
2013-04-04 17:55:35 -07:00
}
2013-04-19 14:08:53 +03:00
}