Don't convert biomes already registered to a climate via our api

This commit is contained in:
Adubbz 2019-08-10 20:15:51 +10:00
parent 786d0416c3
commit 18946ec9ec
3 changed files with 29 additions and 1 deletions

View File

@ -7,6 +7,7 @@
******************************************************************************/
package biomesoplenty.api.enums;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
@ -108,6 +109,16 @@ public enum BOPClimates
return (deep ? Biomes.DEEP_OCEAN : Biomes.OCEAN);
}
public ImmutableList<WeightedBiomeEntry> getLandBiomes()
{
return ImmutableList.copyOf(this.landBiomes);
}
public ImmutableList<WeightedBiomeEntry> getIslandBiomes()
{
return ImmutableList.copyOf(this.islandBiomes);
}
static
{
// Set up vanilla biomes

View File

@ -66,7 +66,6 @@ public class BiomesOPlenty
{
ModBiomes.setup();
ModVanillaCompat.setup();
ModCompatibility.setup();
}
private void clientSetup(final FMLClientSetupEvent event)
@ -78,6 +77,7 @@ public class BiomesOPlenty
{
proxy.init();
//GenLayerVisualizer.run();
ModCompatibility.setup();
}
public void serverStarting(FMLServerStartingEvent evt)

View File

@ -68,6 +68,23 @@ public class ModCompatibility
// TODO: Make this more accurate, possibly analyze heights, temps, rainfall and/or biome dictionary tags
private static void remapBiomeToBoP(Biome biome, BiomeManager.BiomeType type, int weight)
{
/* If any of our climates already have the biome (from a mod using our api), then skip this biome */
for (BOPClimates climate : BOPClimates.values())
{
List<BOPClimates.WeightedBiomeEntry> entries = Lists.newArrayList();
entries.addAll(climate.getLandBiomes());
entries.addAll(climate.getIslandBiomes());
for (BOPClimates.WeightedBiomeEntry entry : entries)
{
if (entry.biome == biome)
{
return;
}
}
}
for (BOPClimates climate : BOPClimates.values())
{
if (climate.biomeType == type)