2013-05-07 18:33:31 +00:00
|
|
|
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-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-08 20:00:23 +00:00
|
|
|
BiomeLayer obj2 = obj;
|
|
|
|
obj2 = new BiomeLayerZoom(1000L, (BiomeLayer)(obj2));
|
|
|
|
obj2 = new BiomeLayerBiomes(200L, ((BiomeLayer)(obj2)), worldtype);
|
|
|
|
|
|
|
|
BiomeLayerVoronoiZoom genlayervoronoizoom = new BiomeLayerVoronoiZoom(10L, ((BiomeLayer)(obj2)));
|
|
|
|
((BiomeLayer)(obj2)).initWorldGenSeed(seed);
|
|
|
|
genlayervoronoizoom.initWorldGenSeed(seed);
|
|
|
|
|
|
|
|
return (new BiomeLayer[] { obj2, genlayervoronoizoom });
|
2013-05-07 18:33:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|