fix terra gen biomes + river layers
This commit is contained in:
parent
cef99a063a
commit
02c007f0c0
7 changed files with 70 additions and 108 deletions
|
@ -635,7 +635,7 @@ public abstract class UniverseRegistry extends DimensionRegistry {
|
|||
.addSpawn(EntityFox.class, 3, 2, 5));
|
||||
registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f, Blocks.rock.getState(), Blocks.water.getState(), 63),
|
||||
new GeneratorData().setGenerator(new GeneratorPerlin(true))
|
||||
.setReplacer(new ReplacerTerranian(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()))
|
||||
.setReplacer(new ReplacerAltSimple(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState()))
|
||||
.setBiomeGen(new BiomeGenerator(new Biome(8.0f, 80.0f), true, 5, 3, 3, 30))
|
||||
.setPopulator(new PopulatorForest(0)).addCaveGen(new MapGenCaves(Blocks.lava.getState()), new MapGenRavine(Blocks.lava.getState()))
|
||||
.addFeature(new FeatureDungeons(10)).enableSnow()
|
||||
|
|
|
@ -67,14 +67,13 @@ public class BiomeGenerator {
|
|||
}
|
||||
|
||||
public BiomeGenerator(Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity, Biome[] add, int addRarity, Biome[] hot, Biome[] medium, Biome[] cold, Biome[] frost) {
|
||||
this.biomes = new Biome[6 + hot.length + medium.length + cold.length + frost.length + add.length];
|
||||
this.biomes[GenLayer.NONE] = def.copy();
|
||||
this.biomes[GenLayer.RIVER] = new Biome(0.0f, 50.0f, Scaling.SEA_SHALLOW);
|
||||
this.biomes[GenLayer.SEA] = new Biome(0.0f, 50.0f, Scaling.SEA_MEDIUM);
|
||||
this.biomes[GenLayer.ICE_RIVER] = new Biome(-20.0f, 50.0f, Scaling.SEA_SHALLOW);
|
||||
this.biomes[GenLayer.ICE_SEA] = new Biome(-20.0f, 50.0f, Scaling.SEA_MEDIUM);
|
||||
this.defBiome = this.biomes[GenLayer.DEFAULT] = def;
|
||||
int n = 6;
|
||||
this.biomes = new Biome[5 + hot.length + medium.length + cold.length + frost.length + add.length];
|
||||
this.defBiome = this.biomes[GenLayerRiverMix.NONE] = def;
|
||||
this.biomes[GenLayerRiverMix.RIVER] = new Biome(0.0f, 50.0f, Scaling.SEA_SHALLOW);
|
||||
this.biomes[GenLayerRiverMix.SEA] = new Biome(0.0f, 50.0f, Scaling.SEA_MEDIUM);
|
||||
this.biomes[GenLayerRiverMix.ICE_RIVER] = new Biome(-20.0f, 50.0f, Scaling.SEA_SHALLOW);
|
||||
this.biomes[GenLayerRiverMix.ICE_SEA] = new Biome(-20.0f, 50.0f, Scaling.SEA_MEDIUM);
|
||||
int n = 5;
|
||||
for(Biome biome : frost) {
|
||||
this.biomes[n++] = biome;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
package server.worldgen.layer;
|
||||
|
||||
public abstract class GenLayer {
|
||||
public static final int NONE = 0;
|
||||
public static final int RIVER = 1;
|
||||
public static final int SEA = 2;
|
||||
public static final int ICE_RIVER = 3;
|
||||
public static final int ICE_SEA = 4;
|
||||
public static final int DEFAULT = 5;
|
||||
|
||||
private long worldGenSeed;
|
||||
private long chunkSeed;
|
||||
private long baseSeed;
|
||||
protected GenLayer parent;
|
||||
|
||||
protected static boolean isSea(int id) {
|
||||
return id == SEA || id == ICE_SEA;
|
||||
}
|
||||
|
||||
public GenLayer(long base) {
|
||||
this.baseSeed = base;
|
||||
this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L;
|
||||
|
|
|
@ -58,7 +58,7 @@ public class GenLayerAddSea extends GenLayer
|
|||
this.initChunkSeed((long)(areaX + j1), (long)(areaY + i1));
|
||||
if (k2 == 0 && this.nextInt(this.rarity) == 0)
|
||||
{
|
||||
aint1[j1 + i1 * areaWidth] = l2 > 1 ? ICE_SEA : SEA;
|
||||
aint1[j1 + i1 * areaWidth] = l2 > 1 ? 1001 : 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ public class GenLayerBiome extends GenLayer
|
|||
{
|
||||
data[j + i * width] = this.fixed;
|
||||
}
|
||||
else if (id == 0 || isSea(id))
|
||||
else if (id == 0 || id == 1000 || id == 1001)
|
||||
{
|
||||
data[j + i * width] = id;
|
||||
}
|
||||
|
|
|
@ -2,16 +2,12 @@ package server.worldgen.layer;
|
|||
|
||||
public class GenLayerRiver extends GenLayer
|
||||
{
|
||||
public GenLayerRiver(long p_i2128_1_, GenLayer p_i2128_3_)
|
||||
public GenLayerRiver(long seed, GenLayer parent)
|
||||
{
|
||||
super(p_i2128_1_);
|
||||
super.parent = p_i2128_3_;
|
||||
super(seed);
|
||||
super.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 areaX, int areaY, int areaWidth, int areaHeight)
|
||||
{
|
||||
int i = areaX - 1;
|
||||
|
@ -25,28 +21,23 @@ public class GenLayerRiver extends GenLayer
|
|||
{
|
||||
for (int j1 = 0; j1 < areaWidth; ++j1)
|
||||
{
|
||||
int k1 = this.func_151630_c(aint[j1 + 0 + (i1 + 1) * k]);
|
||||
int l1 = this.func_151630_c(aint[j1 + 2 + (i1 + 1) * k]);
|
||||
int i2 = this.func_151630_c(aint[j1 + 1 + (i1 + 0) * k]);
|
||||
int j2 = this.func_151630_c(aint[j1 + 1 + (i1 + 2) * k]);
|
||||
int k2 = this.func_151630_c(aint[j1 + 1 + (i1 + 1) * k]);
|
||||
int k1 = aint[j1 + 0 + (i1 + 1) * k];
|
||||
int l1 = aint[j1 + 2 + (i1 + 1) * k];
|
||||
int i2 = aint[j1 + 1 + (i1 + 0) * k];
|
||||
int j2 = aint[j1 + 1 + (i1 + 2) * k];
|
||||
int k2 = aint[j1 + 1 + (i1 + 1) * k];
|
||||
|
||||
if (k2 == k1 && k2 == i2 && k2 == l1 && k2 == j2)
|
||||
{
|
||||
aint1[j1 + i1 * areaWidth] = -1;
|
||||
aint1[j1 + i1 * areaWidth] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
aint1[j1 + i1 * areaWidth] = RIVER;
|
||||
aint1[j1 + i1 * areaWidth] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aint1;
|
||||
}
|
||||
|
||||
private int func_151630_c(int p_151630_1_)
|
||||
{
|
||||
return p_151630_1_ >= 2 ? 2 + (p_151630_1_ & 1) : p_151630_1_;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,76 +5,59 @@ import java.util.Set;
|
|||
import common.collect.Sets;
|
||||
import server.worldgen.Biome;
|
||||
|
||||
public class GenLayerRiverMix extends GenLayer
|
||||
{
|
||||
private GenLayer biomePatternGeneratorChain;
|
||||
private GenLayer riverPatternGeneratorChain;
|
||||
private final int def;
|
||||
private final Set<Integer> freeze = Sets.newHashSet();
|
||||
public class GenLayerRiverMix extends GenLayer {
|
||||
public static final int NONE = 0;
|
||||
public static final int RIVER = 1;
|
||||
public static final int SEA = 2;
|
||||
public static final int ICE_RIVER = 3;
|
||||
public static final int ICE_SEA = 4;
|
||||
|
||||
public GenLayerRiverMix(long p_i2129_1_, GenLayer p_i2129_3_, GenLayer p_i2129_4_, Biome def, Biome[] freeze)
|
||||
{
|
||||
super(p_i2129_1_);
|
||||
this.biomePatternGeneratorChain = p_i2129_3_;
|
||||
this.riverPatternGeneratorChain = p_i2129_4_;
|
||||
this.def = def.id;
|
||||
for(Biome biome : freeze) {
|
||||
this.freeze.add(biome.id);
|
||||
}
|
||||
}
|
||||
private GenLayer biomeGen;
|
||||
private GenLayer riverGen;
|
||||
private final int def;
|
||||
private final Set<Integer> freeze = Sets.newHashSet();
|
||||
|
||||
/**
|
||||
* Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an
|
||||
* argument).
|
||||
*/
|
||||
public void initWorldGenSeed(long seed)
|
||||
{
|
||||
this.biomePatternGeneratorChain.initWorldGenSeed(seed);
|
||||
this.riverPatternGeneratorChain.initWorldGenSeed(seed);
|
||||
super.initWorldGenSeed(seed);
|
||||
}
|
||||
public GenLayerRiverMix(long seed, GenLayer biomes, GenLayer rivers, Biome def, Biome[] freeze) {
|
||||
super(seed);
|
||||
this.biomeGen = biomes;
|
||||
this.riverGen = rivers;
|
||||
this.def = def.id;
|
||||
for(Biome biome : freeze) {
|
||||
this.freeze.add(biome.id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 areaX, int areaY, int areaWidth, int areaHeight)
|
||||
{
|
||||
int[] biome = this.biomePatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
|
||||
int[] river = this.riverPatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
|
||||
int[] out = IntCache.getIntCache(areaWidth * areaHeight);
|
||||
public void initWorldGenSeed(long seed) {
|
||||
this.biomeGen.initWorldGenSeed(seed);
|
||||
this.riverGen.initWorldGenSeed(seed);
|
||||
super.initWorldGenSeed(seed);
|
||||
}
|
||||
|
||||
for (int i = 0; i < areaWidth * areaHeight; ++i)
|
||||
{
|
||||
if(biome[i] == NONE)
|
||||
{
|
||||
out[i] = this.def;
|
||||
}
|
||||
else if(biome[i] == SEA || biome[i] == ICE_SEA)
|
||||
{
|
||||
out[i] = biome[i];
|
||||
}
|
||||
else if (river[i] == RIVER)
|
||||
{
|
||||
if (this.freeze.contains(biome[i]))
|
||||
{
|
||||
out[i] = ICE_RIVER;
|
||||
}
|
||||
else // if (biome[i] != Biome.mushroomPlains.id && biome[i] != Biome.mushroomPlainsEdge.id)
|
||||
{
|
||||
out[i] = RIVER;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// out[i] = Biome.mushroomPlainsEdge.id;
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
out[i] = biome[i];
|
||||
}
|
||||
}
|
||||
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) {
|
||||
int[] biome = this.biomeGen.getInts(areaX, areaY, areaWidth, areaHeight);
|
||||
int[] river = this.riverGen.getInts(areaX, areaY, areaWidth, areaHeight);
|
||||
int[] out = IntCache.getIntCache(areaWidth * areaHeight);
|
||||
|
||||
return out;
|
||||
}
|
||||
for(int i = 0; i < areaWidth * areaHeight; ++i) {
|
||||
if(biome[i] == 0) {
|
||||
out[i] = this.def;
|
||||
}
|
||||
else if(biome[i] == 1000 || biome[i] == 1001) {
|
||||
out[i] = biome[i] == 1000 ? SEA : ICE_SEA;
|
||||
}
|
||||
else if(river[i] == 1) {
|
||||
if(this.freeze.contains(biome[i])) {
|
||||
out[i] = ICE_RIVER;
|
||||
}
|
||||
else {
|
||||
out[i] = RIVER;
|
||||
}
|
||||
}
|
||||
else {
|
||||
out[i] = biome[i];
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue