This commit is contained in:
Matt Caughey 2013-05-25 17:31:51 -04:00
commit 03c1bb5713
10 changed files with 456 additions and 24 deletions

View File

@ -14,15 +14,16 @@ import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
import biomesoplenty.api.Biomes;
import biomesoplenty.world.layer.BiomeLayer;
import com.google.common.base.Optional;
public class WorldChunkManagerBOP extends WorldChunkManager
{
private GenLayer genBiomes;
private BiomeLayer genBiomes;
/** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
private GenLayer biomeIndexLayer;
private BiomeLayer biomeIndexLayer;
/** The BiomeCache object for this world. */
private BiomeCache biomeCache;
@ -103,9 +104,9 @@ public class WorldChunkManagerBOP extends WorldChunkManager
public WorldChunkManagerBOP(long par1, WorldType par3WorldType)
{
this();
GenLayer[] var4 = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType);
this.genBiomes = (GenLayer) var4[0];
this.biomeIndexLayer = (GenLayer) var4[1];
BiomeLayer[] var4 = BiomeLayer.initializeAllBiomeGenerators(par1, par3WorldType, 0);
this.genBiomes = (BiomeLayer) var4[0];
this.biomeIndexLayer = (BiomeLayer) var4[1];
}
public WorldChunkManagerBOP(World par1World)

View File

@ -15,24 +15,71 @@ public abstract class BiomeLayer
//dim: 0 = surface, 1 = hell, 2 = promised
public static BiomeLayer[] initializeAllBiomeGenerators(long seed, WorldType worldtype, int dim)
{
int biomesize = 3;
if(dim == 1)
if(dim == 0)
{
biomesize = 2;
BiomeLayer obj = new BiomeLayerCreate(1L, true);
obj = new BiomeLayerFuzzyZoom(2000L, (BiomeLayer)(obj));
obj = new BiomeLayerIsland(1L, (BiomeLayer)(obj));
obj = new BiomeLayerZoom(2001L, (BiomeLayer)(obj));
obj = new BiomeLayerIsland(2L, (BiomeLayer)(obj));
obj = new BiomeLayerZoom(2002L, (BiomeLayer)(obj));
obj = new BiomeLayerIsland(3L, (BiomeLayer)(obj));
obj = new BiomeLayerZoom(2003L, (BiomeLayer)(obj));
obj = new BiomeLayerIsland(4L, (BiomeLayer)(obj));
byte size = 4;
BiomeLayer obj1 = obj;
obj1 = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj1)), 0);
obj1 = new BiomeLayerRiverInit(100L, ((BiomeLayer)(obj1)));
obj1 = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj1)), size + 2);
obj1 = new BiomeLayerRiver(1L, ((BiomeLayer)(obj1)));
obj1 = new BiomeLayerSmooth(1000L, ((BiomeLayer)(obj1)));
BiomeLayer obj2 = obj;
obj2 = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj2)), 0);
obj2 = new BiomeLayerBiomes(200L, ((BiomeLayer)(obj2)), worldtype, 0);
obj2 = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj2)), 2);
//obj2 = new BWG4LayerHills(1000L, ((BiomeLayer)(obj2)), generatorSettings);
obj2 = new BiomeLayerZoom(1000, ((BiomeLayer)(obj2)));
obj2 = new BiomeLayerShore(1000L, ((BiomeLayer)(obj2)));
for (int i = 0 + 1; i < size; i++)
{
obj2 = new BiomeLayerZoom(1000 + i, ((BiomeLayer)(obj2)));
}
obj2 = new BiomeLayerSmooth(1000L, ((BiomeLayer)(obj2)));
obj2 = new BiomeLayerRiverMix(100L, ((BiomeLayer)(obj2)), ((BiomeLayer)(obj1)));
BiomeLayerRiverMix bwg4layerrivermix = ((BiomeLayerRiverMix)(obj2));
BiomeLayerVoronoiZoom genlayervoronoizoom = new BiomeLayerVoronoiZoom(10L, ((BiomeLayer)(obj2)));
((BiomeLayer)(obj2)).initWorldGenSeed(seed);
genlayervoronoizoom.initWorldGenSeed(seed);
return (new BiomeLayer[]
{
obj2, genlayervoronoizoom, bwg4layerrivermix
});
}
else
{
int biomesize = 3;
if(dim == 1)
{
biomesize = 2;
}
//Hell and promised biome gen
BiomeLayer obj = new BiomeLayerCreate(1L, false);
obj = new BiomeLayerFuzzyZoom(2000L, (BiomeLayer)(obj));
for(int i = 1; i < 3; i++) { obj = new BiomeLayerZoom(2000L + i, (BiomeLayer)(obj)); }
obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 0);
obj = new BiomeLayerBiomes(200L, ((BiomeLayer)(obj)), worldtype, dim);
obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 2);
for(int j = 0; j < biomesize; j++) { obj = new BiomeLayerZoom(1000L + j, (BiomeLayer)(obj)); }
BiomeLayerVoronoiZoom genlayervoronoizoom = new BiomeLayerVoronoiZoom(10L, ((BiomeLayer)(obj)));
((BiomeLayer)(obj)).initWorldGenSeed(seed);
genlayervoronoizoom.initWorldGenSeed(seed);
return (new BiomeLayer[] { obj, genlayervoronoizoom });
}
//Hell and promised biome gen
BiomeLayer obj = new BiomeLayerCreate(1L);
obj = new BiomeLayerFuzzyZoom(2000L, (BiomeLayer)(obj));
for(int i = 1; i < 3; i++) { obj = new BiomeLayerZoom(2000L + i, (BiomeLayer)(obj)); }
obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 0);
obj = new BiomeLayerBiomes(200L, ((BiomeLayer)(obj)), worldtype, dim);
obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 2);
for(int j = 0; j < biomesize; j++) { obj = new BiomeLayerZoom(1000L + j, (BiomeLayer)(obj)); }
BiomeLayerVoronoiZoom genlayervoronoizoom = new BiomeLayerVoronoiZoom(10L, ((BiomeLayer)(obj)));
((BiomeLayer)(obj)).initWorldGenSeed(seed);
genlayervoronoizoom.initWorldGenSeed(seed);
return (new BiomeLayer[] { obj, genlayervoronoizoom });
}
public BiomeLayer(long seed)

View File

@ -19,6 +19,7 @@ public class BiomeLayerBiomes extends BiomeLayer
private int dimension = 0;
private BiomeGenBase[] surfaceBiomes;
private static ArrayList<BiomeGenBase> oceanBiomes = new ArrayList<BiomeGenBase>();
private static ArrayList<BiomeGenBase> netherBiomes = new ArrayList<BiomeGenBase>();
private static ArrayList<BiomeGenBase> promisedBiomes = new ArrayList<BiomeGenBase>();
@ -30,6 +31,17 @@ public class BiomeLayerBiomes extends BiomeLayer
//SURFACE BIOMES
surfaceBiomes = par4WorldType.getBiomesForWorldType();
//OCEAN BIOMES
oceanBiomes.add(BiomeGenBase.ocean);
if (Biomes.oceanCoral.isPresent())
{
oceanBiomes.add(Biomes.oceanCoral.get());
}
if (Biomes.oceanKelp.isPresent())
{
oceanBiomes.add(Biomes.oceanKelp.get());
}
//NETHER BIOMES
if (Biomes.netherBase.isPresent())
@ -79,6 +91,17 @@ public class BiomeLayerBiomes extends BiomeLayer
{
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] = oceanBiomes.get(this.nextInt(oceanBiomes.size())).biomeID;
}
else
{
var6[var8 + var7 * par3] = surfaceBiomes[this.nextInt(surfaceBiomes.length)].biomeID;
}
}
if(dimension == 1) //HELL BIOMES
{
var6[var8 + var7 * par3] = netherBiomes.get(this.nextInt(netherBiomes.size())).biomeID;
@ -89,7 +112,14 @@ public class BiomeLayerBiomes extends BiomeLayer
}
else
{
var6[var8 + var7 * par3] = surfaceBiomes[this.nextInt(surfaceBiomes.length)].biomeID;
if (var9 == 0)
{
var6[var8 + var7 * par3] = oceanBiomes.get(this.nextInt(oceanBiomes.size())).biomeID;
}
else
{
var6[var8 + var7 * par3] = surfaceBiomes[this.nextInt(surfaceBiomes.length)].biomeID;
}
}
}
}

View File

@ -2,9 +2,12 @@ package biomesoplenty.world.layer;
public class BiomeLayerCreate extends BiomeLayer
{
public BiomeLayerCreate(long par1)
private boolean ocean;
public BiomeLayerCreate(long par1, boolean o)
{
super(par1);
ocean = o;
}
public int[] getInts(int par1, int par2, int par3, int par4)
@ -16,9 +19,25 @@ public class BiomeLayerCreate extends BiomeLayer
for (int var7 = 0; var7 < par3; ++var7)
{
this.initChunkSeed((long)(par1 + var7), (long)(par2 + var6));
var5[var7 + var6 * par3] = 1;
if(ocean)
{
var5[var7 + var6 * par3] = this.nextInt(10) == 0 ? 1 : 0;
}
else
{
var5[var7 + var6 * par3] = 1;
}
}
}
if(ocean)
{
if (par1 > -par3 && par1 <= 0 && par2 > -par4 && par2 <= 0)
{
var5[-par1 + -par2 * par3] = 1;
}
}
return var5;
}
}

View File

@ -0,0 +1,102 @@
package biomesoplenty.world.layer;
import net.minecraft.world.biome.BiomeGenBase;
public class BiomeLayerIsland extends BiomeLayer
{
public BiomeLayerIsland(long par1, BiomeLayer par3GenLayer)
{
super(par1);
this.parent = par3GenLayer;
}
/**
* Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
* amounts, or biomeList[] indices based on the particular GenLayer subclass.
*/
public int[] getInts(int par1, int par2, int par3, int par4)
{
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] aint = this.parent.getInts(i1, j1, k1, l1);
int[] aint1 = LayerIntCache.getIntCache(par3 * par4);
for (int i2 = 0; i2 < par4; ++i2)
{
for (int j2 = 0; j2 < par3; ++j2)
{
int k2 = aint[j2 + 0 + (i2 + 0) * k1];
int l2 = aint[j2 + 2 + (i2 + 0) * k1];
int i3 = aint[j2 + 0 + (i2 + 2) * k1];
int j3 = aint[j2 + 2 + (i2 + 2) * k1];
int k3 = aint[j2 + 1 + (i2 + 1) * k1];
this.initChunkSeed((long)(j2 + par1), (long)(i2 + par2));
if (k3 == 0 && (k2 != 0 || l2 != 0 || i3 != 0 || j3 != 0))
{
int l3 = 1;
int i4 = 1;
if (k2 != 0 && this.nextInt(l3++) == 0)
{
i4 = k2;
}
if (l2 != 0 && this.nextInt(l3++) == 0)
{
i4 = l2;
}
if (i3 != 0 && this.nextInt(l3++) == 0)
{
i4 = i3;
}
if (j3 != 0 && this.nextInt(l3++) == 0)
{
i4 = j3;
}
if (this.nextInt(3) == 0)
{
aint1[j2 + i2 * par3] = i4;
}
else if (i4 == BiomeGenBase.icePlains.biomeID)
{
aint1[j2 + i2 * par3] = BiomeGenBase.frozenOcean.biomeID;
}
else
{
aint1[j2 + i2 * par3] = 0;
}
}
else if (k3 > 0 && (k2 == 0 || l2 == 0 || i3 == 0 || j3 == 0))
{
if (this.nextInt(5) == 0)
{
if (k3 == BiomeGenBase.icePlains.biomeID)
{
aint1[j2 + i2 * par3] = BiomeGenBase.frozenOcean.biomeID;
}
else
{
aint1[j2 + i2 * par3] = 0;
}
}
else
{
aint1[j2 + i2 * par3] = k3;
}
}
else
{
aint1[j2 + i2 * par3] = k3;
}
}
}
return aint1;
}
}

View File

@ -0,0 +1,45 @@
package biomesoplenty.world.layer;
import net.minecraft.world.biome.BiomeGenBase;
public class BiomeLayerRiver extends BiomeLayer
{
public BiomeLayerRiver(long par1, BiomeLayer par3GenLayer)
{
super(par1);
super.parent = par3GenLayer;
}
public int[] getInts(int par1, int par2, int par3, int par4)
{
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] aint = this.parent.getInts(i1, j1, k1, l1);
int[] aint1 = LayerIntCache.getIntCache(par3 * par4);
for (int i2 = 0; i2 < par4; ++i2)
{
for (int j2 = 0; j2 < par3; ++j2)
{
int k2 = aint[j2 + 0 + (i2 + 1) * k1];
int l2 = aint[j2 + 2 + (i2 + 1) * k1];
int i3 = aint[j2 + 1 + (i2 + 0) * k1];
int j3 = aint[j2 + 1 + (i2 + 2) * k1];
int k3 = aint[j2 + 1 + (i2 + 1) * k1];
if (k3 != 0 && k2 != 0 && l2 != 0 && i3 != 0 && j3 != 0 && k3 == k2 && k3 == i3 && k3 == l2 && k3 == j3)
{
aint1[j2 + i2 * par3] = -1;
}
else
{
aint1[j2 + i2 * par3] = BiomeGenBase.river.biomeID;
}
}
}
return aint1;
}
}

View File

@ -0,0 +1,27 @@
package biomesoplenty.world.layer;
public class BiomeLayerRiverInit extends BiomeLayer
{
public BiomeLayerRiverInit(long par1, BiomeLayer par3GenLayer)
{
super(par1);
this.parent = par3GenLayer;
}
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] aint = this.parent.getInts(par1, par2, par3, par4);
int[] aint1 = LayerIntCache.getIntCache(par3 * par4);
for (int i1 = 0; i1 < par4; ++i1)
{
for (int j1 = 0; j1 < par3; ++j1)
{
this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2));
aint1[j1 + i1 * par3] = aint[j1 + i1 * par3] > 0 ? this.nextInt(2) + 2 : 0;
}
}
return aint1;
}
}

View File

@ -0,0 +1,58 @@
package biomesoplenty.world.layer;
import net.minecraft.world.biome.BiomeGenBase;
public class BiomeLayerRiverMix extends BiomeLayer
{
private BiomeLayer biomePatternGeneratorChain;
private BiomeLayer riverPatternGeneratorChain;
public BiomeLayerRiverMix(long par1, BiomeLayer par3GenLayer, BiomeLayer par4GenLayer)
{
super(par1);
this.biomePatternGeneratorChain = par3GenLayer;
this.riverPatternGeneratorChain = par4GenLayer;
}
public void initWorldGenSeed(long par1)
{
this.biomePatternGeneratorChain.initWorldGenSeed(par1);
this.riverPatternGeneratorChain.initWorldGenSeed(par1);
super.initWorldGenSeed(par1);
}
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] var5 = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] var6 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] var7 = LayerIntCache.getIntCache(par3 * par4);
for (int var8 = 0; var8 < par3 * par4; ++var8)
{
if (var5[var8] == BiomeGenBase.ocean.biomeID)
{
var7[var8] = var5[var8];
}
else if (var6[var8] >= 0)
{
if (var5[var8] == BiomeGenBase.icePlains.biomeID)
{
var7[var8] = BiomeGenBase.frozenRiver.biomeID;
}
else if (var5[var8] != BiomeGenBase.mushroomIsland.biomeID && var5[var8] != BiomeGenBase.mushroomIslandShore.biomeID)
{
var7[var8] = var6[var8];
}
else
{
var7[var8] = BiomeGenBase.mushroomIslandShore.biomeID;
}
}
else
{
var7[var8] = var5[var8];
}
}
return var7;
}
}

View File

@ -0,0 +1,37 @@
package biomesoplenty.world.layer;
import biomesoplenty.api.Biomes;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
public class BiomeLayerShore extends BiomeLayer
{
public BiomeLayerShore(long par1, BiomeLayer par3GenLayer)
{
super(par1);
this.parent = par3GenLayer;
}
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] var5 = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
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 + 1 + (var7 + 1) * (par3 + 2)];
int var10;
int var11;
int var12;
int var13;
var6[var8 + var7 * par3] = var9;
}
}
return var6;
}
}

View File

@ -0,0 +1,66 @@
package biomesoplenty.world.layer;
public class BiomeLayerSmooth extends BiomeLayer
{
public BiomeLayerSmooth(long par1, BiomeLayer par3GenLayer)
{
super(par1);
super.parent = par3GenLayer;
}
/**
* Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
* amounts, or biomeList[] indices based on the particular GenLayer subclass.
*/
public int[] getInts(int par1, int par2, int par3, int par4)
{
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] aint = this.parent.getInts(i1, j1, k1, l1);
int[] aint1 = LayerIntCache.getIntCache(par3 * par4);
for (int i2 = 0; i2 < par4; ++i2)
{
for (int j2 = 0; j2 < par3; ++j2)
{
int k2 = aint[j2 + 0 + (i2 + 1) * k1];
int l2 = aint[j2 + 2 + (i2 + 1) * k1];
int i3 = aint[j2 + 1 + (i2 + 0) * k1];
int j3 = aint[j2 + 1 + (i2 + 2) * k1];
int k3 = aint[j2 + 1 + (i2 + 1) * k1];
if (k2 == l2 && i3 == j3)
{
this.initChunkSeed((long)(j2 + par1), (long)(i2 + par2));
if (this.nextInt(2) == 0)
{
k3 = k2;
}
else
{
k3 = i3;
}
}
else
{
if (k2 == l2)
{
k3 = k2;
}
if (i3 == j3)
{
k3 = i3;
}
}
aint1[j2 + i2 * par3] = k3;
}
}
return aint1;
}
}