BiomesOPlenty/src/minecraft/biomesoplenty/world/layer/BiomeLayerBiomes.java

94 lines
2.6 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-18 15:06:30 +00:00
import com.google.common.base.Optional;
2013-05-08 20:11:53 +00:00
import biomesoplenty.api.Biomes;
2013-05-18 15:06:30 +00:00
import biomesoplenty.biomes.BiomeGenNetherAbyss;
import biomesoplenty.biomes.BiomeGenNetherDesert;
import biomesoplenty.biomes.BiomeGenNetherGarden;
import biomesoplenty.biomes.BiomeGenNetherLava;
import biomesoplenty.configuration.BOPConfiguration;
2013-05-08 20:11:53 +00:00
2013-05-08 20:00:23 +00:00
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
public class BiomeLayerBiomes extends BiomeLayer
{
2013-05-18 15:06:30 +00:00
private int dimension = 0;
private BiomeGenBase[] surfaceBiomes;
private static ArrayList<BiomeGenBase> netherBiomes = new ArrayList<BiomeGenBase>();
private static ArrayList<BiomeGenBase> promisedBiomes = new ArrayList<BiomeGenBase>();
2013-05-08 20:00:23 +00:00
2013-05-18 15:06:30 +00:00
public BiomeLayerBiomes(long par1, BiomeLayer par3GenLayer, WorldType par4WorldType, int dim)
2013-05-08 20:00:23 +00:00
{
super(par1);
parent = par3GenLayer;
2013-05-18 15:06:30 +00:00
dimension = dim;
2013-05-08 20:00:23 +00:00
2013-05-18 15:06:30 +00:00
//SURFACE BIOMES
surfaceBiomes = par4WorldType.getBiomesForWorldType();
//NETHER BIOMES
if (Biomes.netherGarden.isPresent())
{
netherBiomes.add(Biomes.netherGarden.get());
}
if (Biomes.netherDesert.isPresent())
{
2013-05-21 00:49:30 +00:00
//netherBiomes.add(Biomes.netherDesert.get());
2013-05-18 15:06:30 +00:00
}
if (Biomes.netherLava.isPresent())
{
netherBiomes.add(Biomes.netherLava.get());
}
if (Biomes.netherAbyss.isPresent())
2013-05-08 20:11:53 +00:00
{
2013-05-21 00:49:30 +00:00
//netherBiomes.add(Biomes.netherAbyss.get());
2013-05-09 07:00:09 +00:00
}
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());
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-08 20:00:23 +00:00
}
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] var5 = this.parent.getInts(par1, par2, par3, par4);
int[] var6 = LayerIntCache.getIntCache(par3 * par4);
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];
2013-05-18 15:06:30 +00:00
if(dimension == 1) //HELL BIOMES
{
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;
}
2013-05-08 20:00:23 +00:00
}
}
return var6;
}
}