mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 10:34:49 +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
+11
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/biome/provider/OverworldBiomeProvider.java
|
||||
+++ b/net/minecraft/world/biome/provider/OverworldBiomeProvider.java
|
||||
@@ -35,7 +35,7 @@
|
||||
private final Registry<Biome> field_242636_k;
|
||||
|
||||
public OverworldBiomeProvider(long p_i241958_1_, boolean p_i241958_3_, boolean p_i241958_4_, Registry<Biome> p_i241958_5_) {
|
||||
- super(field_226847_e_.stream().map((p_242638_1_) -> {
|
||||
+ super(java.util.stream.Stream.concat(field_226847_e_.stream(), net.minecraftforge.common.BiomeManager.getAdditionalOverworldBiomes().stream()).map((p_242638_1_) -> {
|
||||
return () -> {
|
||||
return p_i241958_5_.func_243576_d(p_242638_1_);
|
||||
};
|
||||
@@ -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