Added an option to disable river generation in biomes

This commit is contained in:
Adubbz 2016-01-19 12:19:35 +11:00
parent c49e6537cb
commit 601c509a68
2 changed files with 18 additions and 1 deletions

View file

@ -47,6 +47,7 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
public boolean canSpawnInBiome = true; public boolean canSpawnInBiome = true;
public boolean canGenerateVillages = true; public boolean canGenerateVillages = true;
public boolean canGenerateRivers = true;
public TerrainSettings terrainSettings = new TerrainSettings(); public TerrainSettings terrainSettings = new TerrainSettings();
public boolean noNeighborTerrainInfuence = false; public boolean noNeighborTerrainInfuence = false;
@ -94,8 +95,10 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
this.enableSnow = conf.getBool("enableSnow", this.enableSnow); this.enableSnow = conf.getBool("enableSnow", this.enableSnow);
this.skyColor = conf.getInt("skyColor", this.skyColor); this.skyColor = conf.getInt("skyColor", this.skyColor);
this.hasBiomeEssence = conf.getBool("hasBiomeEssence", this.hasBiomeEssence); this.hasBiomeEssence = conf.getBool("hasBiomeEssence", this.hasBiomeEssence);
this.canSpawnInBiome = conf.getBool("canSpawnInBiome", this.canSpawnInBiome); this.canSpawnInBiome = conf.getBool("canSpawnInBiome", this.canSpawnInBiome);
this.canGenerateVillages = conf.getBool("canGenerateVillages", this.canGenerateVillages); this.canGenerateVillages = conf.getBool("canGenerateVillages", this.canGenerateVillages);
this.canGenerateRivers = conf.getBool("canGenerateRivers", this.canGenerateVillages);
// Allow weights to be overridden // Allow weights to be overridden
IConfigObj confWeights = conf.getObject("weights"); IConfigObj confWeights = conf.getObject("weights");

View file

@ -8,6 +8,7 @@
package biomesoplenty.common.world.layer; package biomesoplenty.common.world.layer;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.BOPBiomes; import biomesoplenty.api.biome.BOPBiomes;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayer;
@ -42,7 +43,7 @@ public class GenLayerRiverMixBOP extends BOPGenLayer
for (int i = 0; i < areaWidth * areaHeight; ++i) for (int i = 0; i < areaWidth * areaHeight; ++i)
{ {
if (biomeIds[i] != BiomeGenBase.frozenOcean.biomeID && biomeIds[i] != BiomeGenBase.ocean.biomeID && biomeIds[i] != BiomeGenBase.deepOcean.biomeID) if (biomeIds[i] != BiomeGenBase.frozenOcean.biomeID && biomeIds[i] != BiomeGenBase.ocean.biomeID && biomeIds[i] != BiomeGenBase.deepOcean.biomeID && biomeSupportsRivers(i))
{ {
if (riverValues[i] == BiomeGenBase.river.biomeID) if (riverValues[i] == BiomeGenBase.river.biomeID)
{ {
@ -72,4 +73,17 @@ public class GenLayerRiverMixBOP extends BOPGenLayer
return out; return out;
} }
private boolean biomeSupportsRivers(int biomeId)
{
BiomeGenBase biome = BiomeGenBase.getBiome(biomeId);
if (biome != null && biome instanceof BOPBiome)
{
BOPBiome bopBiome = (BOPBiome)biome;
return bopBiome.canGenerateRivers;
}
return true;
}
} }