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

100 lines
3.4 KiB
Java
Raw Normal View History

package biomesoplenty.world.layer;
import net.minecraft.world.WorldType;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.WorldTypeEvent;
public abstract class BiomeLayer
{
private long worldGenSeed;
protected BiomeLayer parent;
private long chunkSeed;
private long baseSeed;
public static BiomeLayer[] initializeAllBiomeGenerators(long seed, WorldType worldtype)
{
BiomeLayer obj = new BiomeLayerCreate(1L);
2013-05-09 08:48:24 +00:00
obj = new BiomeLayerFuzzyZoom(2000L, (BiomeLayer)(obj));
2013-05-08 20:00:23 +00:00
for(int i = 0; i < 3; i++)
2013-05-07 19:33:36 +00:00
{
obj = new BiomeLayerZoom(2000L + i, (BiomeLayer)(obj));
}
2013-05-09 08:48:24 +00:00
obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 0);
obj = new BiomeLayerBiomes(200L, ((BiomeLayer)(obj)), worldtype);
obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 2);
2013-05-08 20:00:23 +00:00
2013-05-09 08:48:24 +00:00
BiomeLayerVoronoiZoom genlayervoronoizoom = new BiomeLayerVoronoiZoom(10L, ((BiomeLayer)(obj)));
((BiomeLayer)(obj)).initWorldGenSeed(seed);
2013-05-08 20:00:23 +00:00
genlayervoronoizoom.initWorldGenSeed(seed);
2013-05-09 08:48:24 +00:00
return (new BiomeLayer[] { obj, genlayervoronoizoom }); //genlayervoronoizoom
}
public BiomeLayer(long seed)
{
this.baseSeed = seed;
this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L;
this.baseSeed += seed;
this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L;
this.baseSeed += seed;
this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L;
this.baseSeed += seed;
}
public void initWorldGenSeed(long seed)
{
this.worldGenSeed = seed;
if (this.parent != null)
{
this.parent.initWorldGenSeed(seed);
}
this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L;
this.worldGenSeed += this.baseSeed;
this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L;
this.worldGenSeed += this.baseSeed;
this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L;
this.worldGenSeed += this.baseSeed;
}
public void initChunkSeed(long par1, long par3)
{
this.chunkSeed = this.worldGenSeed;
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L;
this.chunkSeed += par1;
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L;
this.chunkSeed += par3;
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L;
this.chunkSeed += par1;
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L;
this.chunkSeed += par3;
}
protected int nextInt(int par1)
{
int j = (int)((this.chunkSeed >> 24) % (long)par1);
if (j < 0)
{
j += par1;
}
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L;
this.chunkSeed += this.worldGenSeed;
return j;
}
public abstract int[] getInts(int i, int j, int k, int l);
public static byte getModdedBiomeSize(WorldType worldType, byte original)
{
WorldTypeEvent.BiomeSize event = new WorldTypeEvent.BiomeSize(worldType, original);
MinecraftForge.TERRAIN_GEN_BUS.post(event);
return event.newSize;
}
}