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));
|
.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),
|
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))
|
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))
|
.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()))
|
.setPopulator(new PopulatorForest(0)).addCaveGen(new MapGenCaves(Blocks.lava.getState()), new MapGenRavine(Blocks.lava.getState()))
|
||||||
.addFeature(new FeatureDungeons(10)).enableSnow()
|
.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) {
|
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 = new Biome[5 + hot.length + medium.length + cold.length + frost.length + add.length];
|
||||||
this.biomes[GenLayer.NONE] = def.copy();
|
this.defBiome = this.biomes[GenLayerRiverMix.NONE] = def;
|
||||||
this.biomes[GenLayer.RIVER] = new Biome(0.0f, 50.0f, Scaling.SEA_SHALLOW);
|
this.biomes[GenLayerRiverMix.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[GenLayerRiverMix.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[GenLayerRiverMix.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.biomes[GenLayerRiverMix.ICE_SEA] = new Biome(-20.0f, 50.0f, Scaling.SEA_MEDIUM);
|
||||||
this.defBiome = this.biomes[GenLayer.DEFAULT] = def;
|
int n = 5;
|
||||||
int n = 6;
|
|
||||||
for(Biome biome : frost) {
|
for(Biome biome : frost) {
|
||||||
this.biomes[n++] = biome;
|
this.biomes[n++] = biome;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
package server.worldgen.layer;
|
package server.worldgen.layer;
|
||||||
|
|
||||||
public abstract class GenLayer {
|
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 worldGenSeed;
|
||||||
private long chunkSeed;
|
private long chunkSeed;
|
||||||
private long baseSeed;
|
private long baseSeed;
|
||||||
protected GenLayer parent;
|
protected GenLayer parent;
|
||||||
|
|
||||||
protected static boolean isSea(int id) {
|
|
||||||
return id == SEA || id == ICE_SEA;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenLayer(long base) {
|
public GenLayer(long base) {
|
||||||
this.baseSeed = base;
|
this.baseSeed = base;
|
||||||
this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L;
|
this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L;
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class GenLayerAddSea extends GenLayer
|
||||||
this.initChunkSeed((long)(areaX + j1), (long)(areaY + i1));
|
this.initChunkSeed((long)(areaX + j1), (long)(areaY + i1));
|
||||||
if (k2 == 0 && this.nextInt(this.rarity) == 0)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class GenLayerBiome extends GenLayer
|
||||||
{
|
{
|
||||||
data[j + i * width] = this.fixed;
|
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;
|
data[j + i * width] = id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,12 @@ package server.worldgen.layer;
|
||||||
|
|
||||||
public class GenLayerRiver extends GenLayer
|
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(seed);
|
||||||
super.parent = p_i2128_3_;
|
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)
|
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
|
||||||
{
|
{
|
||||||
int i = areaX - 1;
|
int i = areaX - 1;
|
||||||
|
@ -25,28 +21,23 @@ public class GenLayerRiver extends GenLayer
|
||||||
{
|
{
|
||||||
for (int j1 = 0; j1 < areaWidth; ++j1)
|
for (int j1 = 0; j1 < areaWidth; ++j1)
|
||||||
{
|
{
|
||||||
int k1 = this.func_151630_c(aint[j1 + 0 + (i1 + 1) * k]);
|
int k1 = aint[j1 + 0 + (i1 + 1) * k];
|
||||||
int l1 = this.func_151630_c(aint[j1 + 2 + (i1 + 1) * k]);
|
int l1 = aint[j1 + 2 + (i1 + 1) * k];
|
||||||
int i2 = this.func_151630_c(aint[j1 + 1 + (i1 + 0) * k]);
|
int i2 = aint[j1 + 1 + (i1 + 0) * k];
|
||||||
int j2 = this.func_151630_c(aint[j1 + 1 + (i1 + 2) * k]);
|
int j2 = aint[j1 + 1 + (i1 + 2) * k];
|
||||||
int k2 = this.func_151630_c(aint[j1 + 1 + (i1 + 1) * k]);
|
int k2 = aint[j1 + 1 + (i1 + 1) * k];
|
||||||
|
|
||||||
if (k2 == k1 && k2 == i2 && k2 == l1 && k2 == j2)
|
if (k2 == k1 && k2 == i2 && k2 == l1 && k2 == j2)
|
||||||
{
|
{
|
||||||
aint1[j1 + i1 * areaWidth] = -1;
|
aint1[j1 + i1 * areaWidth] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aint1[j1 + i1 * areaWidth] = RIVER;
|
aint1[j1 + i1 * areaWidth] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return aint1;
|
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,72 +5,55 @@ import java.util.Set;
|
||||||
import common.collect.Sets;
|
import common.collect.Sets;
|
||||||
import server.worldgen.Biome;
|
import server.worldgen.Biome;
|
||||||
|
|
||||||
public class GenLayerRiverMix extends GenLayer
|
public class GenLayerRiverMix extends GenLayer {
|
||||||
{
|
public static final int NONE = 0;
|
||||||
private GenLayer biomePatternGeneratorChain;
|
public static final int RIVER = 1;
|
||||||
private GenLayer riverPatternGeneratorChain;
|
public static final int SEA = 2;
|
||||||
|
public static final int ICE_RIVER = 3;
|
||||||
|
public static final int ICE_SEA = 4;
|
||||||
|
|
||||||
|
private GenLayer biomeGen;
|
||||||
|
private GenLayer riverGen;
|
||||||
private final int def;
|
private final int def;
|
||||||
private final Set<Integer> freeze = Sets.newHashSet();
|
private final Set<Integer> freeze = Sets.newHashSet();
|
||||||
|
|
||||||
public GenLayerRiverMix(long p_i2129_1_, GenLayer p_i2129_3_, GenLayer p_i2129_4_, Biome def, Biome[] freeze)
|
public GenLayerRiverMix(long seed, GenLayer biomes, GenLayer rivers, Biome def, Biome[] freeze) {
|
||||||
{
|
super(seed);
|
||||||
super(p_i2129_1_);
|
this.biomeGen = biomes;
|
||||||
this.biomePatternGeneratorChain = p_i2129_3_;
|
this.riverGen = rivers;
|
||||||
this.riverPatternGeneratorChain = p_i2129_4_;
|
|
||||||
this.def = def.id;
|
this.def = def.id;
|
||||||
for(Biome biome : freeze) {
|
for(Biome biome : freeze) {
|
||||||
this.freeze.add(biome.id);
|
this.freeze.add(biome.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void initWorldGenSeed(long seed) {
|
||||||
* Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an
|
this.biomeGen.initWorldGenSeed(seed);
|
||||||
* argument).
|
this.riverGen.initWorldGenSeed(seed);
|
||||||
*/
|
|
||||||
public void initWorldGenSeed(long seed)
|
|
||||||
{
|
|
||||||
this.biomePatternGeneratorChain.initWorldGenSeed(seed);
|
|
||||||
this.riverPatternGeneratorChain.initWorldGenSeed(seed);
|
|
||||||
super.initWorldGenSeed(seed);
|
super.initWorldGenSeed(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) {
|
||||||
* Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
|
int[] biome = this.biomeGen.getInts(areaX, areaY, areaWidth, areaHeight);
|
||||||
* amounts, or biomeList[] indices based on the particular GenLayer subclass.
|
int[] river = this.riverGen.getInts(areaX, areaY, areaWidth, areaHeight);
|
||||||
*/
|
|
||||||
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);
|
int[] out = IntCache.getIntCache(areaWidth * areaHeight);
|
||||||
|
|
||||||
for (int i = 0; i < areaWidth * areaHeight; ++i)
|
for(int i = 0; i < areaWidth * areaHeight; ++i) {
|
||||||
{
|
if(biome[i] == 0) {
|
||||||
if(biome[i] == NONE)
|
|
||||||
{
|
|
||||||
out[i] = this.def;
|
out[i] = this.def;
|
||||||
}
|
}
|
||||||
else if(biome[i] == SEA || biome[i] == ICE_SEA)
|
else if(biome[i] == 1000 || biome[i] == 1001) {
|
||||||
{
|
out[i] = biome[i] == 1000 ? SEA : ICE_SEA;
|
||||||
out[i] = biome[i];
|
|
||||||
}
|
}
|
||||||
else if (river[i] == RIVER)
|
else if(river[i] == 1) {
|
||||||
{
|
if(this.freeze.contains(biome[i])) {
|
||||||
if (this.freeze.contains(biome[i]))
|
|
||||||
{
|
|
||||||
out[i] = ICE_RIVER;
|
out[i] = ICE_RIVER;
|
||||||
}
|
}
|
||||||
else // if (biome[i] != Biome.mushroomPlains.id && biome[i] != Biome.mushroomPlainsEdge.id)
|
else {
|
||||||
{
|
|
||||||
out[i] = RIVER;
|
out[i] = RIVER;
|
||||||
}
|
}
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// out[i] = Biome.mushroomPlainsEdge.id;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
out[i] = biome[i];
|
out[i] = biome[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue