diff --git a/src/main/java/biomesoplenty/api/enums/BOPClimates.java b/src/main/java/biomesoplenty/api/enums/BOPClimates.java index 94ea94a92..11ecaa4f7 100644 --- a/src/main/java/biomesoplenty/api/enums/BOPClimates.java +++ b/src/main/java/biomesoplenty/api/enums/BOPClimates.java @@ -8,7 +8,9 @@ package biomesoplenty.api.enums; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; import net.minecraft.world.gen.INoiseRandom; @@ -16,6 +18,8 @@ import net.minecraftforge.common.BiomeManager.BiomeType; import java.util.ArrayList; import java.util.Iterator; +import java.util.Set; +import java.util.stream.Collectors; public enum BOPClimates { @@ -172,6 +176,24 @@ public enum BOPClimates return out; } + public static ImmutableSet getOverworldBiomes() + { + Set set = Sets.newHashSet(); + + for (BOPClimates climate : BOPClimates.values()) + { + if (climate == BOPClimates.NETHER) + { + continue; + } + + set.addAll(climate.getLandBiomes().stream().map(weightedBiomeEntry -> weightedBiomeEntry.biome).collect(Collectors.toSet())); + set.addAll(climate.getIslandBiomes().stream().map(weightedBiomeEntry -> weightedBiomeEntry.biome).collect(Collectors.toSet())); + } + + return ImmutableSet.copyOf(set); + } + public static class WeightedBiomeEntry { public final int weight; diff --git a/src/main/java/biomesoplenty/common/world/BOPBiomeProvider.java b/src/main/java/biomesoplenty/common/world/BOPBiomeProvider.java index a47f85cfc..8a6735bcf 100644 --- a/src/main/java/biomesoplenty/common/world/BOPBiomeProvider.java +++ b/src/main/java/biomesoplenty/common/world/BOPBiomeProvider.java @@ -7,6 +7,7 @@ ******************************************************************************/ package biomesoplenty.common.world; +import biomesoplenty.api.enums.BOPClimates; import com.google.common.collect.Sets; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; @@ -26,21 +27,21 @@ import java.util.Collections; import java.util.List; import java.util.Random; import java.util.Set; +import java.util.stream.Collectors; -public class BOPBiomeProvider extends OverworldBiomeProvider +public class BOPBiomeProvider extends BiomeProvider { - private final Layer genBiomes; + private final Layer noiseBiomeLayer; public BOPBiomeProvider(OverworldBiomeProviderSettings settingsProvider) { - super(settingsProvider); - - this.genBiomes = BOPLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0]; + super(BOPClimates.getOverworldBiomes()); + this.noiseBiomeLayer = BOPLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0]; } @Override public Biome getNoiseBiome(int x, int y, int z) { - return this.genBiomes.get(x, z); + return this.noiseBiomeLayer.get(x, z); } -} +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/NetherBiomeProvider.java b/src/main/java/biomesoplenty/common/world/NetherBiomeProvider.java index 676c48b23..490583ef4 100644 --- a/src/main/java/biomesoplenty/common/world/NetherBiomeProvider.java +++ b/src/main/java/biomesoplenty/common/world/NetherBiomeProvider.java @@ -7,17 +7,21 @@ ******************************************************************************/ package biomesoplenty.common.world; +import biomesoplenty.api.enums.BOPClimates; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.provider.BiomeProvider; import net.minecraft.world.biome.provider.OverworldBiomeProvider; import net.minecraft.world.biome.provider.OverworldBiomeProviderSettings; import net.minecraft.world.gen.OverworldGenSettings; import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.gen.layer.Layer; +import net.minecraft.world.gen.layer.LayerUtil; import net.minecraft.world.storage.WorldInfo; import javax.annotation.Nullable; @@ -25,22 +29,21 @@ import java.util.Collections; import java.util.List; import java.util.Random; import java.util.Set; +import java.util.stream.Collectors; -public class NetherBiomeProvider extends OverworldBiomeProvider +public class NetherBiomeProvider extends BiomeProvider { - private final Layer genBiomes; + private final Layer noiseBiomeLayer; public NetherBiomeProvider(OverworldBiomeProviderSettings settingsProvider) { - super(settingsProvider); - - this.surfaceBlocks.add(Blocks.NETHERRACK.defaultBlockState()); - this.genBiomes = BOPNetherLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0]; + super(BOPClimates.NETHER.getLandBiomes().stream().map(weightedBiomeEntry -> weightedBiomeEntry.biome).collect(Collectors.toSet())); + this.noiseBiomeLayer = BOPNetherLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0]; } @Override public Biome getNoiseBiome(int x, int y, int z) { - return this.genBiomes.get(x, z); + return this.noiseBiomeLayer.get(x, z); } }