Added support for river biomes

This commit is contained in:
Adubbz 2014-05-13 19:41:21 +10:00
parent 10b71ac0b3
commit b298ee00f4
3 changed files with 83 additions and 123 deletions

View File

@ -14,6 +14,7 @@ public class BOPBiomeManager
public static List<BiomeEntry>[] overworldBiomes = new ArrayList[4];
public static List<BiomeEntry>[] overworldSubBiomes = new ArrayList[BiomeGenBase.getBiomeGenArray().length];
public static BiomeGenBase[] overworldRiverBiomes = new BiomeGenBase[BiomeGenBase.getBiomeGenArray().length];
public static List<BiomeEntry> netherBiomes = new ArrayList();
public static BiomeGenBase createAndRegisterBiome(Class<? extends BiomeGenBase> biomeClass, String biomeType, String biomeName, List<BiomeEntry> biomeList, int weight)

View File

@ -1,73 +1,6 @@
package biomesoplenty.common.core;
import static biomesoplenty.api.content.BOPCBiomes.alps;
import static biomesoplenty.api.content.BOPCBiomes.arctic;
import static biomesoplenty.api.content.BOPCBiomes.bambooForest;
import static biomesoplenty.api.content.BOPCBiomes.bayou;
import static biomesoplenty.api.content.BOPCBiomes.bog;
import static biomesoplenty.api.content.BOPCBiomes.boneyard;
import static biomesoplenty.api.content.BOPCBiomes.borealForest;
import static biomesoplenty.api.content.BOPCBiomes.brushland;
import static biomesoplenty.api.content.BOPCBiomes.canyon;
import static biomesoplenty.api.content.BOPCBiomes.chaparral;
import static biomesoplenty.api.content.BOPCBiomes.cherryBlossomGrove;
import static biomesoplenty.api.content.BOPCBiomes.coniferousForest;
import static biomesoplenty.api.content.BOPCBiomes.corruptedSands;
import static biomesoplenty.api.content.BOPCBiomes.crag;
import static biomesoplenty.api.content.BOPCBiomes.deadForest;
import static biomesoplenty.api.content.BOPCBiomes.deadSwamp;
import static biomesoplenty.api.content.BOPCBiomes.deciduousForest;
import static biomesoplenty.api.content.BOPCBiomes.dunes;
import static biomesoplenty.api.content.BOPCBiomes.fen;
import static biomesoplenty.api.content.BOPCBiomes.flowerField;
import static biomesoplenty.api.content.BOPCBiomes.frostForest;
import static biomesoplenty.api.content.BOPCBiomes.fungiForest;
import static biomesoplenty.api.content.BOPCBiomes.glacier;
import static biomesoplenty.api.content.BOPCBiomes.grassland;
import static biomesoplenty.api.content.BOPCBiomes.grove;
import static biomesoplenty.api.content.BOPCBiomes.heathland;
import static biomesoplenty.api.content.BOPCBiomes.highland;
import static biomesoplenty.api.content.BOPCBiomes.jadeCliffs;
import static biomesoplenty.api.content.BOPCBiomes.lavenderFields;
import static biomesoplenty.api.content.BOPCBiomes.lushDesert;
import static biomesoplenty.api.content.BOPCBiomes.lushSwamp;
import static biomesoplenty.api.content.BOPCBiomes.mapleWoods;
import static biomesoplenty.api.content.BOPCBiomes.marsh;
import static biomesoplenty.api.content.BOPCBiomes.meadow;
import static biomesoplenty.api.content.BOPCBiomes.moor;
import static biomesoplenty.api.content.BOPCBiomes.mountain;
import static biomesoplenty.api.content.BOPCBiomes.mysticGrove;
import static biomesoplenty.api.content.BOPCBiomes.oasis;
import static biomesoplenty.api.content.BOPCBiomes.ominousWoods;
import static biomesoplenty.api.content.BOPCBiomes.originValley;
import static biomesoplenty.api.content.BOPCBiomes.outback;
import static biomesoplenty.api.content.BOPCBiomes.phantasmagoricInferno;
import static biomesoplenty.api.content.BOPCBiomes.prairie;
import static biomesoplenty.api.content.BOPCBiomes.quagmire;
import static biomesoplenty.api.content.BOPCBiomes.rainforest;
import static biomesoplenty.api.content.BOPCBiomes.redwoodForest;
import static biomesoplenty.api.content.BOPCBiomes.sacredSprings;
import static biomesoplenty.api.content.BOPCBiomes.scrubland;
import static biomesoplenty.api.content.BOPCBiomes.seasonalForest;
import static biomesoplenty.api.content.BOPCBiomes.shield;
import static biomesoplenty.api.content.BOPCBiomes.shrubland;
import static biomesoplenty.api.content.BOPCBiomes.silkglades;
import static biomesoplenty.api.content.BOPCBiomes.sludgepit;
import static biomesoplenty.api.content.BOPCBiomes.snowyConiferousForest;
import static biomesoplenty.api.content.BOPCBiomes.spruceWoods;
import static biomesoplenty.api.content.BOPCBiomes.steppe;
import static biomesoplenty.api.content.BOPCBiomes.temperateRainforest;
import static biomesoplenty.api.content.BOPCBiomes.thicket;
import static biomesoplenty.api.content.BOPCBiomes.timber;
import static biomesoplenty.api.content.BOPCBiomes.tropicalRainforest;
import static biomesoplenty.api.content.BOPCBiomes.tropics;
import static biomesoplenty.api.content.BOPCBiomes.tundra;
import static biomesoplenty.api.content.BOPCBiomes.undergarden;
import static biomesoplenty.api.content.BOPCBiomes.visceralHeap;
import static biomesoplenty.api.content.BOPCBiomes.volcano;
import static biomesoplenty.api.content.BOPCBiomes.wasteland;
import static biomesoplenty.api.content.BOPCBiomes.wetland;
import static biomesoplenty.api.content.BOPCBiomes.woodland;
import static biomesoplenty.api.content.BOPCBiomes.*;
import java.util.ArrayList;
import java.util.List;
@ -187,6 +120,7 @@ public class BOPBiomes
}
addBiomesToDictionary();
disableRivers();
addSpawnBiomes();
}
@ -238,7 +172,7 @@ public class BOPBiomes
shield = registerOverworldBiome(BiomeGenShield.class, "Shield", TemperatureType.COOL, 10);
shrubland = registerOverworldBiome(BiomeGenShrubland.class, "Shrubland", TemperatureType.COOL, 10);
silkglades = registerOverworldBiome(BiomeGenSilkglades.class, "Silkglades", TemperatureType.COOL, 5);
onlyBiome = sludgepit = registerOverworldBiome(BiomeGenSludgepit.class, "Sludgepit", TemperatureType.WARM, 10);
sludgepit = registerOverworldBiome(BiomeGenSludgepit.class, "Sludgepit", TemperatureType.WARM, 10);
spruceWoods = registerOverworldBiome(BiomeGenSpruceWoods.class, "Spruce Woods", TemperatureType.WARM, 10);
steppe = registerOverworldBiome(BiomeGenSteppe.class, "Steppe", TemperatureType.HOT, 10);
temperateRainforest = registerOverworldBiome(BiomeGenTemperateRainforest.class, "Temperate Rainforest", TemperatureType.WARM, 10);
@ -267,28 +201,6 @@ public class BOPBiomes
visceralHeap = registerNetherBiome(BiomeGenVisceralHeap.class, "Visceral Heap", 10);
undergarden = registerNetherBiome(BiomeGenUndergarden.class, "Undergarden", 10);
}
private static void addSpawnBiomes()
{
if (BOPConfigurationMisc.onlySpawnOnBeaches)
{
clearAllSpawnBiomes();
addSpawnBiome(BiomeGenBase.beach);
addSpawnBiome(BiomeGenBase.stoneBeach);
addSpawnBiome(BiomeGenBase.coldBeach);
}
else
{
for (List<BiomeEntry> biomeList : BOPBiomeManager.overworldBiomes)
{
for (BiomeEntry entry : biomeList)
{
addSpawnBiome(entry.biome);
}
}
}
}
private static void addBiomesToDictionary()
{
@ -412,6 +324,34 @@ public class BOPBiomes
BiomeDictionary.registerBiomeType(BOPCBiomes.woodland, Type.FOREST);
}
private static void disableRivers()
{
disableRiver(quagmire);
disableRiver(sludgepit);
}
private static void addSpawnBiomes()
{
if (BOPConfigurationMisc.onlySpawnOnBeaches)
{
clearAllSpawnBiomes();
addSpawnBiome(BiomeGenBase.beach);
addSpawnBiome(BiomeGenBase.stoneBeach);
addSpawnBiome(BiomeGenBase.coldBeach);
}
else
{
for (List<BiomeEntry> biomeList : BOPBiomeManager.overworldBiomes)
{
for (BiomeEntry entry : biomeList)
{
addSpawnBiome(entry.biome);
}
}
}
}
private static BiomeGenBase registerOverworldBiome(Class<? extends BiomeGenBase> biomeClass, String biomeName, int temperatureType, int weight)
{
if (BOPBiomeManager.overworldBiomes[temperatureType] == null) BOPBiomeManager.overworldBiomes[temperatureType] = new ArrayList();
@ -443,6 +383,26 @@ public class BOPBiomes
return null;
}
private static BiomeGenBase registerOverworldRiverBiome(Class<? extends BiomeGenBase> biomeClass, String biomeName, int parent)
{
BiomeGenBase biome = BOPBiomeManager.createBiome(biomeClass, biomeName);
if (biome != null)
{
if (BOPConfigurationBiomeGen.config.get("Overworld (River) Biomes To Generate", biome.biomeName, true).getBoolean(false))
{
BOPBiomeManager.overworldRiverBiomes[parent] = biome;
}
}
return null;
}
private static void disableRiver(BiomeGenBase biome)
{
BOPBiomeManager.overworldRiverBiomes[biome.biomeID] = biome;
}
private static BiomeGenBase registerNetherBiome(Class<? extends BiomeGenBase> biomeClass, String biomeName, int weight)
{
return BOPBiomeManager.createAndRegisterBiome(biomeClass, "Nether", biomeName, BOPBiomeManager.netherBiomes, weight);

View File

@ -1,74 +1,73 @@
package biomesoplenty.common.world.layer;
import biomesoplenty.api.content.BOPCBiomes;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerRiverMix;
import net.minecraft.world.gen.layer.IntCache;
import biomesoplenty.api.BOPBiomeManager;
public class GenLayerRiverMixBOP extends GenLayer
public class GenLayerRiverMixBOP extends GenLayerRiverMix
{
private GenLayer biomePatternGeneratorChain;
private GenLayer riverPatternGeneratorChain;
private static final String __OBFID = "CL_00000567";
public GenLayerRiverMixBOP(long par1, GenLayer par3GenLayer, GenLayer par4GenLayer)
public GenLayerRiverMixBOP(long seed, GenLayer biomePatternGeneratorChain, GenLayer riverPatternGeneratorChain)
{
super(par1);
this.biomePatternGeneratorChain = par3GenLayer;
this.riverPatternGeneratorChain = par4GenLayer;
super(seed, biomePatternGeneratorChain, riverPatternGeneratorChain);
this.biomePatternGeneratorChain = biomePatternGeneratorChain;
this.riverPatternGeneratorChain = riverPatternGeneratorChain;
}
public void initWorldGenSeed(long par1)
@Override
public void initWorldGenSeed(long seed)
{
this.biomePatternGeneratorChain.initWorldGenSeed(par1);
this.riverPatternGeneratorChain.initWorldGenSeed(par1);
super.initWorldGenSeed(par1);
this.biomePatternGeneratorChain.initWorldGenSeed(seed);
this.riverPatternGeneratorChain.initWorldGenSeed(seed);
super.initWorldGenSeed(seed);
}
public int[] getInts(int par1, int par2, int par3, int par4)
@Override
public int[] getInts(int x, int z, int width, int length)
{
int[] aint = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] aint1 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] aint2 = IntCache.getIntCache(par3 * par4);
int[] inputBiomeIds = this.biomePatternGeneratorChain.getInts(x, z, width, length);
int[] riverBiomeIds = this.riverPatternGeneratorChain.getInts(x, z, width, length);
int[] outputBiomeIds = IntCache.getIntCache(width * length);
for (int i1 = 0; i1 < par3 * par4; ++i1)
for (int i1 = 0; i1 < width * length; ++i1)
{
if (aint[i1] != BiomeGenBase.ocean.biomeID && aint[i1] != BiomeGenBase.deepOcean.biomeID)
if (inputBiomeIds[i1] != BiomeGenBase.ocean.biomeID && inputBiomeIds[i1] != BiomeGenBase.deepOcean.biomeID)
{
if (aint1[i1] == BiomeGenBase.river.biomeID)
if (riverBiomeIds[i1] == BiomeGenBase.river.biomeID)
{
if (aint[i1] == BiomeGenBase.icePlains.biomeID)
if (inputBiomeIds[i1] == BiomeGenBase.icePlains.biomeID)
{
aint2[i1] = BiomeGenBase.frozenRiver.biomeID;
outputBiomeIds[i1] = BiomeGenBase.frozenRiver.biomeID;
}
else if (aint[i1] == BOPCBiomes.quagmire.biomeID)
else if (BOPBiomeManager.overworldRiverBiomes[inputBiomeIds[i1]] != null)
{
aint2[i1] = BOPCBiomes.quagmire.biomeID;
outputBiomeIds[i1] = BOPBiomeManager.overworldRiverBiomes[inputBiomeIds[i1]].biomeID;
}
else if (aint[i1] == BOPCBiomes.sludgepit.biomeID)
else if (inputBiomeIds[i1] != BiomeGenBase.mushroomIsland.biomeID && inputBiomeIds[i1] != BiomeGenBase.mushroomIslandShore.biomeID)
{
aint2[i1] = BOPCBiomes.sludgepit.biomeID;
}
else if (aint[i1] != BiomeGenBase.mushroomIsland.biomeID && aint[i1] != BiomeGenBase.mushroomIslandShore.biomeID)
{
aint2[i1] = aint1[i1] & 255;
outputBiomeIds[i1] = riverBiomeIds[i1] & 255;
}
else
{
aint2[i1] = BiomeGenBase.mushroomIslandShore.biomeID;
outputBiomeIds[i1] = BiomeGenBase.mushroomIslandShore.biomeID;
}
}
else
{
aint2[i1] = aint[i1];
outputBiomeIds[i1] = inputBiomeIds[i1];
}
}
else
{
aint2[i1] = aint[i1];
outputBiomeIds[i1] = inputBiomeIds[i1];
}
}
return aint2;
return outputBiomeIds;
}
}