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

108 lines
2.7 KiB
Java
Raw Normal View History

package biomesoplenty.world.layer;
import java.util.ArrayList;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.IntCache;
2013-07-01 00:31:34 +00:00
import biomesoplenty.api.Biomes;
2013-07-11 08:20:25 +00:00
import biomesoplenty.configuration.BOPConfiguration;
public class BiomeLayerShore extends BiomeLayer
{
private static ArrayList<BiomeGenBase> beachBiomes = new ArrayList<BiomeGenBase>();
private static ArrayList<BiomeGenBase> oceanBiomes = new ArrayList<BiomeGenBase>();
2013-05-31 10:34:02 +00:00
public BiomeLayerShore(long par1, BiomeLayer par3GenLayer)
{
super(par1);
parent = par3GenLayer;
//BEACH BIOMES
beachBiomes.add(BiomeGenBase.beach);
if (Biomes.beachGravel.isPresent())
{
2013-08-03 00:07:43 +00:00
if (BOPConfiguration.BiomeGen.gravelBeachGen == true)
2013-07-11 08:20:25 +00:00
{
beachBiomes.add(Biomes.beachGravel.get());
}
}
if (Biomes.beachOvergrown.isPresent())
{
2013-08-03 00:07:43 +00:00
if (BOPConfiguration.BiomeGen.overgrownBeachGen == true)
2013-07-11 08:20:25 +00:00
{
beachBiomes.add(Biomes.beachOvergrown.get());
}
}
//OCEAN BIOMES
oceanBiomes.add(BiomeGenBase.ocean);
2013-09-08 16:06:12 +00:00
if (Biomes.oceanCoral.isPresent())
{
oceanBiomes.add(Biomes.oceanCoral.get());
}
if (Biomes.oceanKelp.isPresent())
{
oceanBiomes.add(Biomes.oceanKelp.get());
2013-09-08 16:06:12 +00:00
}
}
private boolean isOceanBiome(int id)
{
for(int i = 0; i < oceanBiomes.size(); i++)
{
if(oceanBiomes.get(i).biomeID == id)
{
return true;
}
}
return false;
2013-05-31 10:34:02 +00:00
}
2013-05-31 10:34:02 +00:00
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] var5 = parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
int[] var6 = IntCache.getIntCache(par3 * par4);
2013-05-31 10:34:02 +00:00
for (int var7 = 0; var7 < par4; ++var7)
{
for (int var8 = 0; var8 < par3; ++var8)
{
this.initChunkSeed(var8 + par1, var7 + par2);
int var9 = var5[var8 + 1 + (var7 + 1) * (par3 + 2)];
int var10;
int var11;
int var12;
int var13;
var6[var8 + var7 * par3] = var9;
if(!isOceanBiome(var9))
{
var10 = var5[var8 + 1 + (var7 + 1 - 1) * (par3 + 2)];
var11 = var5[var8 + 1 + 1 + (var7 + 1) * (par3 + 2)];
var12 = var5[var8 + 1 - 1 + (var7 + 1) * (par3 + 2)];
var13 = var5[var8 + 1 + (var7 + 1 + 1) * (par3 + 2)];
if (isOceanBiome(var10))
{
var6[var8 + var7 * par3] = beachBiomes.get(this.nextInt(beachBiomes.size())).biomeID;
}
else if (isOceanBiome(var11))
{
var6[var8 + var7 * par3] = beachBiomes.get(this.nextInt(beachBiomes.size())).biomeID;
}
else if (isOceanBiome(var12))
{
var6[var8 + var7 * par3] = beachBiomes.get(this.nextInt(beachBiomes.size())).biomeID;
}
else if (isOceanBiome(var13))
{
var6[var8 + var7 * par3] = beachBiomes.get(this.nextInt(beachBiomes.size())).biomeID;
}
}
2013-05-31 10:34:02 +00:00
}
}
return var6;
}
}