mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Add modded biomes to overworld biome list (#7360)
This commit is contained in:
1 parent
50d75a27e1
commit
0a0f3232ea
2 files changed
+36
-1
No files matched your search
@@ -34,6 +34,7 @@ import net.minecraft.world.biome.Biome;
|
||||
public class BiomeManager
|
||||
{
|
||||
private static TrackedList<BiomeEntry>[] biomes = setupBiomes();
|
||||
private static final List<RegistryKey<Biome>> additionalOverworldBiomes = new ArrayList<>();
|
||||
|
||||
private static TrackedList<BiomeEntry>[] setupBiomes()
|
||||
{
|
||||
@@ -97,11 +98,26 @@ public class BiomeManager
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add biomes that you add to the overworld without using {@link BiomeManager#addBiome(BiomeType, BiomeEntry)}
|
||||
*/
|
||||
public static void addAdditionalOverworldBiomes(RegistryKey<Biome> biome){
|
||||
if (!"minecraft".equals(biome.func_240901_a_().getNamespace()) && additionalOverworldBiomes.stream().noneMatch(entry -> entry.func_240901_a_().equals(biome.func_240901_a_())))
|
||||
{
|
||||
additionalOverworldBiomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean addBiome(BiomeType type, BiomeEntry entry)
|
||||
{
|
||||
int idx = type.ordinal();
|
||||
List<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
|
||||
return list == null ? false : list.add(entry);
|
||||
if(list != null)
|
||||
{
|
||||
additionalOverworldBiomes.add(entry.key);
|
||||
return list.add(entry);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean removeBiome(BiomeType type, BiomeEntry entry)
|
||||
@@ -111,6 +127,14 @@ public class BiomeManager
|
||||
return list == null ? false : list.remove(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list of biomes that might be generated in the overworld in addition to the vanilla biomes
|
||||
*/
|
||||
public static List<RegistryKey<Biome>> getAdditionalOverworldBiomes()
|
||||
{
|
||||
return additionalOverworldBiomes;
|
||||
}
|
||||
|
||||
public static ImmutableList<BiomeEntry> getBiomes(BiomeType type)
|
||||
{
|
||||
int idx = type.ordinal();
|
||||
|
||||
Reference in new issue
Block a user