BiomesOPlenty/common/biomesoplenty/world/layer/BiomeLayerBiomes.java

185 lines
4.7 KiB
Java
Raw Normal View History

2013-05-08 20:00:23 +00:00
package biomesoplenty.world.layer;
2013-05-08 20:11:53 +00:00
import java.util.ArrayList;
2013-05-08 20:00:23 +00:00
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.IntCache;
import biomesoplenty.api.Biomes;
2013-09-14 10:16:39 +00:00
import biomesoplenty.configuration.configfile.BOPConfigurationBiomeGen;
2013-05-08 20:00:23 +00:00
public class BiomeLayerBiomes extends BiomeLayer
{
private int dimension = 0;
2013-05-18 15:06:30 +00:00
private BiomeGenBase[] surfaceBiomes;
private static ArrayList<BiomeGenBase> oceanBiomes = new ArrayList<BiomeGenBase>();
2013-05-18 15:06:30 +00:00
private static ArrayList<BiomeGenBase> netherBiomes = new ArrayList<BiomeGenBase>();
private static ArrayList<BiomeGenBase> promisedBiomes = new ArrayList<BiomeGenBase>();
public BiomeLayerBiomes(long par1, BiomeLayer par3GenLayer, WorldType par4WorldType, int dim)
{
super(par1);
2013-05-08 20:00:23 +00:00
parent = par3GenLayer;
2013-05-18 15:06:30 +00:00
dimension = dim;
2013-05-18 15:06:30 +00:00
//SURFACE BIOMES
surfaceBiomes = par4WorldType.getBiomesForWorldType();
//OCEAN BIOMES
oceanBiomes.add(BiomeGenBase.ocean);
2013-09-13 02:27:32 +00:00
if (Biomes.oceanAbyss.isPresent())
{
2013-09-21 13:57:55 +00:00
if (BOPConfigurationBiomeGen.oceanicAbyssGen)
{
oceanBiomes.add(Biomes.oceanAbyss.get());
}
2013-09-13 02:27:32 +00:00
}
2013-09-08 16:06:12 +00:00
if (Biomes.oceanCoral.isPresent())
{
2013-09-21 13:57:55 +00:00
if (BOPConfigurationBiomeGen.coralReefGen)
{
oceanBiomes.add(Biomes.oceanCoral.get());
}
}
if (Biomes.oceanKelp.isPresent())
{
2013-09-21 13:57:55 +00:00
if (BOPConfigurationBiomeGen.kelpForestGen)
{
oceanBiomes.add(Biomes.oceanKelp.get());
}
2013-09-08 16:06:12 +00:00
}
2013-05-18 15:06:30 +00:00
//NETHER BIOMES
if (Biomes.netherBase.isPresent())
{
netherBiomes.add(Biomes.netherBase.get());
}
2013-05-18 15:06:30 +00:00
if (Biomes.netherGarden.isPresent())
{
2013-09-21 13:57:55 +00:00
if (BOPConfigurationBiomeGen.undergardenGen)
{
netherBiomes.add(Biomes.netherGarden.get());
}
2013-05-18 15:06:30 +00:00
}
if (Biomes.netherDesert.isPresent())
{
2013-09-21 13:57:55 +00:00
if (BOPConfigurationBiomeGen.corruptedSandsGen)
{
netherBiomes.add(Biomes.netherDesert.get());
}
2013-05-18 15:06:30 +00:00
}
if (Biomes.netherLava.isPresent())
{
2013-09-21 13:57:55 +00:00
if (BOPConfigurationBiomeGen.phantasmagoricInfernoGen)
{
netherBiomes.add(Biomes.netherLava.get());
}
2013-05-18 15:06:30 +00:00
}
if (Biomes.netherBone.isPresent())
2013-05-08 20:11:53 +00:00
{
2013-09-21 13:57:55 +00:00
if (BOPConfigurationBiomeGen.boneyardGen)
{
netherBiomes.add(Biomes.netherBone.get());
}
2013-05-09 07:00:09 +00:00
}
2013-10-26 20:42:11 +00:00
if (Biomes.netherBlood.isPresent())
{
if (BOPConfigurationBiomeGen.bloodyHeapGen)
{
netherBiomes.add(Biomes.netherBlood.get());
}
}
if (Biomes.netherBiomes.size() > 0)
{
netherBiomes.addAll(Biomes.netherBiomes);
}
2013-05-18 15:06:30 +00:00
//PROMISED BIOMES
if (Biomes.promisedLandForest.isPresent())
{
promisedBiomes.add(Biomes.promisedLandForest.get());
}
2013-05-09 07:00:09 +00:00
if (Biomes.promisedLandPlains.isPresent())
{
2013-05-18 15:06:30 +00:00
promisedBiomes.add(Biomes.promisedLandPlains.get());
}
if (Biomes.promisedLandShrub.isPresent())
{
promisedBiomes.add(Biomes.promisedLandShrub.get());
2013-05-09 07:00:09 +00:00
}
if (Biomes.promisedLandSwamp.isPresent())
{
2013-05-18 15:06:30 +00:00
promisedBiomes.add(Biomes.promisedLandSwamp.get());
2013-05-09 07:00:09 +00:00
}
}
2013-05-31 10:34:02 +00:00
2013-07-01 00:31:34 +00:00
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] var5 = this.parent.getInts(par1, par2, par3, par4);
int[] var6 = IntCache.getIntCache(par3 * par4);
boolean abyss = Biomes.oceanAbyss.isPresent();
boolean coral = Biomes.oceanCoral.isPresent();
boolean kelp = Biomes.oceanKelp.isPresent();
for (int var7 = 0; var7 < par4; ++var7)
{
for (int var8 = 0; var8 < par3; ++var8)
{
this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2));
int var9 = var5[var8 + var7 * par3];
if(dimension == 0) //SURFACE BIOMES
{
if (var9 == 0)
{
var6[var8 + var7 * par3] = 0;
}
else
{
var6[var8 + var7 * par3] = surfaceBiomes[this.nextInt(surfaceBiomes.length)].biomeID;
}
2013-09-13 02:27:32 +00:00
if (abyss)
{
if(var9 == Biomes.oceanAbyss.get().biomeID)
{
var6[var8 + var7 * par3] = oceanBiomes.get(this.nextInt(oceanBiomes.size())).biomeID;
}
}
2013-09-08 16:06:12 +00:00
if (coral)
{
if(var9 == Biomes.oceanCoral.get().biomeID)
{
var6[var8 + var7 * par3] = oceanBiomes.get(this.nextInt(oceanBiomes.size())).biomeID;
}
}
if (kelp)
{
if(var9 == Biomes.oceanKelp.get().biomeID)
{
var6[var8 + var7 * par3] = oceanBiomes.get(this.nextInt(oceanBiomes.size())).biomeID;
}
2013-09-08 16:06:12 +00:00
}
}
else if(dimension == 1) //HELL BIOMES
2013-05-18 15:06:30 +00:00
{
var6[var8 + var7 * par3] = netherBiomes.get(this.nextInt(netherBiomes.size())).biomeID;
}
else if(dimension == 2) //PROMISED BIOMES
{
var6[var8 + var7 * par3] = promisedBiomes.get(this.nextInt(promisedBiomes.size())).biomeID;
}
else
{
var6[var8 + var7 * par3] = surfaceBiomes[this.nextInt(surfaceBiomes.length)].biomeID;
}
}
}
return var6;
}
2013-05-08 20:00:23 +00:00
}