biome rework test

This commit is contained in:
Sen 2025-07-22 23:59:00 +02:00
parent 0f128c1b1b
commit b524eeeaa3
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
28 changed files with 454 additions and 1108 deletions

View file

@ -3,7 +3,6 @@ package client.gui.ingame;
import java.util.List; import java.util.List;
import client.gui.Gui; import client.gui.Gui;
import common.biome.Biome;
import common.block.foliage.LeavesType; import common.block.foliage.LeavesType;
import common.collect.Lists; import common.collect.Lists;
import common.dimension.Dimension; import common.dimension.Dimension;
@ -12,7 +11,6 @@ import common.dimension.Dimension.ReplacerType;
import common.init.Blocks; import common.init.Blocks;
import common.init.UniverseRegistry; import common.init.UniverseRegistry;
import common.tags.TagObject; import common.tags.TagObject;
import common.world.State;
public class GuiCreateDimension extends Gui { public class GuiCreateDimension extends Gui {
public static final GuiCreateDimension INSTANCE = new GuiCreateDimension(); public static final GuiCreateDimension INSTANCE = new GuiCreateDimension();
@ -61,7 +59,7 @@ public class GuiCreateDimension extends Gui {
dtag.setInt("SeaRarity", 50); dtag.setInt("SeaRarity", 50);
dtag.setInt("AddRarity", 50); dtag.setInt("AddRarity", 50);
dtag.setInt("SeaLevel", 0); dtag.setInt("SeaLevel", 0);
dtag.setString("DefaultBiome", Biome.NONE.name.toLowerCase()); // dtag.setString("DefaultBiome", Biome.NONE.name.toLowerCase()); // TODO fix everything
dtag.setBool("SemiFixed", false); dtag.setBool("SemiFixed", false);
// dtag.setString("DefaultWeather", Weather.CLEAR.getName()); // dtag.setString("DefaultWeather", Weather.CLEAR.getName());
dtag.setString("DefaultLeaves", LeavesType.SPRING.getName()); dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
@ -84,17 +82,17 @@ public class GuiCreateDimension extends Gui {
return addPreset(display, "terra", data); return addPreset(display, "terra", data);
} }
private static Dimension addFlatPreset(String display, Biome biome, boolean populate, State main, Object ... layers) { // private static Dimension addFlatPreset(String display, Biome biome, boolean populate, State main, Object ... layers) {
return addFlatPreset(display, "terra", biome, populate, main, layers); // return addFlatPreset(display, "terra", biome, populate, main, layers);
} // }
//
private static Dimension addFlatPreset(String display, String base, Biome biome, boolean populate, State main, Object ... layers) { // private static Dimension addFlatPreset(String display, String base, Biome biome, boolean populate, State main, Object ... layers) {
Dimension dim = addPreset("Flach - " + display, base, "ClearGenerator:1b" + (populate ? "" : ",NoPopulation:1b")); // Dimension dim = addPreset("Flach - " + display, base, "ClearGenerator:1b" + (populate ? "" : ",NoPopulation:1b"));
// dim.setBiome(biome); // TODO: populator //// dim.setBiome(biome); // TODO: populator
if(main != null) // if(main != null)
dim.setFlatGen(main, layers); // dim.setFlatGen(main, layers);
return dim; // return dim;
} // }
static static
{ {
@ -111,34 +109,34 @@ public class GuiCreateDimension extends Gui {
addPreset("Chaotische Höhlen", "UpperLmtScale:2.0,LowerLmtScale:64.0,SeaLevel:6"); addPreset("Chaotische Höhlen", "UpperLmtScale:2.0,LowerLmtScale:64.0,SeaLevel:6");
addPreset("Viel Glück", "LiquidBlock:lava,SeaLevel:40"); addPreset("Viel Glück", "LiquidBlock:lava,SeaLevel:40");
addFlatPreset("Klassisch", Biome.PLAIN, false, Blocks.dirt.getState(), Blocks.bedrock.getState(), 2, Blocks.dirt.getState(), // addFlatPreset("Klassisch", Biome.PLAIN, false, Blocks.dirt.getState(), Blocks.bedrock.getState(), 2, Blocks.dirt.getState(),
Blocks.grass.getState()).enableVillages(); // Blocks.grass.getState()).enableVillages();
//
addFlatPreset("Abbauwelt", Biome.HILLS, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 230, Blocks.stone.getState(), // addFlatPreset("Abbauwelt", Biome.HILLS, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 230, Blocks.stone.getState(),
5, Blocks.dirt.getState(), Blocks.grass.getState()).enableStrongholds().enableMineshafts().setDungeons(8); // 5, Blocks.dirt.getState(), Blocks.grass.getState()).enableStrongholds().enableMineshafts().setDungeons(8);
//
addFlatPreset("Wasserwelt", Biome.SEA, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 5, Blocks.stone.getState(), // addFlatPreset("Wasserwelt", Biome.SEA, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 5, Blocks.stone.getState(),
52, Blocks.dirt.getState(), 5, Blocks.sand.getState(), 90, Blocks.water.getState()); // 52, Blocks.dirt.getState(), 5, Blocks.sand.getState(), 90, Blocks.water.getState());
//
addFlatPreset("Oberfläche", Biome.PLAIN, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(), // addFlatPreset("Oberfläche", Biome.PLAIN, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
3, Blocks.dirt.getState(), Blocks.grass.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages().enableStrongholds().enableMineshafts().setDungeons(8) // 3, Blocks.dirt.getState(), Blocks.grass.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages().enableStrongholds().enableMineshafts().setDungeons(8)
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false).addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true); // .addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false).addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true);
//
addFlatPreset("Verschneites Königreich", Biome.ICE, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(), // addFlatPreset("Verschneites Königreich", Biome.ICE, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).enableVillages(); // 3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).enableVillages();
//
addFlatPreset("Verschneites Königreich +", Biome.ICE, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(), // addFlatPreset("Verschneites Königreich +", Biome.ICE, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages() // 3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages()
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false); // .addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false);
//
addFlatPreset("Unendliche Grube", Biome.PLAIN, false, Blocks.dirt.getState(), 2, Blocks.cobblestone.getState(), 3, Blocks.dirt.getState(), Blocks.grass.getState()) // addFlatPreset("Unendliche Grube", Biome.PLAIN, false, Blocks.dirt.getState(), 2, Blocks.cobblestone.getState(), 3, Blocks.dirt.getState(), Blocks.grass.getState())
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages(); // .setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages();
//
addFlatPreset("Wüste", Biome.DESERT, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), 52, Blocks.sandstone.getState()) // addFlatPreset("Wüste", Biome.DESERT, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), 52, Blocks.sandstone.getState())
.enableVillages().enableScattered(); // .enableVillages().enableScattered();
//
addFlatPreset("Sandsteinwelt", Biome.DESERT, false, Blocks.sandstone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), // addFlatPreset("Sandsteinwelt", Biome.DESERT, false, Blocks.sandstone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(),
52, Blocks.sandstone.getState()); // 52, Blocks.sandstone.getState());
addPreset("Leer", "ClearGenerator:1b"); addPreset("Leer", "ClearGenerator:1b");
addPreset("Alpha 1.2", "Strongholds:0b,Villages:0b,MineShafts:0b,Scattered:0b,Generator:simple,Replacer:simple,Ravines:0b,SeaLevel:64,AltBlock2:sand"); addPreset("Alpha 1.2", "Strongholds:0b,Villages:0b,MineShafts:0b,Scattered:0b,Generator:simple,Replacer:simple,Ravines:0b,SeaLevel:64,AltBlock2:sand");

View file

@ -1,149 +1,27 @@
package common.biome; package common.biome;
import common.log.Log; public final class Biome {
public class Biome {
public static final Biome NONE = new Biome(0.0f, 50.0f).setSea();
public static final Biome PLAIN = new Biome(12.0f, 40.0f).setScaling(Scaling.PLAINS_LOW);
public static final Biome DESERT = new Biome(60.0f, 0.0f).setScaling(Scaling.PLAINS_LOW);
public static final Biome HILLS = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_LARGE);
public static final Biome FOREST = new Biome(8.0f, 80.0f);
public static final Biome TAIGA = new Biome(-10.0f, 80.0f).setScaling(Scaling.PLAINS_MEDIUM);
public static final Biome SWAMP = new Biome(12.0f, 90.0f).setScaling(Scaling.SEA_POND).disableBeach();
public static final Biome RIVER = new Biome(0.0f, 50.0f).setScaling(Scaling.SEA_SHALLOW).disableBeach();
public static final Biome ICE_SEA = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.SEA_MEDIUM).setSea().disableBeach();
public static final Biome ICE_RIVER = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.SEA_SHALLOW).disableBeach();
public static final Biome ICE = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.PLAINS_LOW);
public static final Biome ICE_HILLS = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.HILLS_LOW);
public static final Biome BEACH = new Biome(12.0f, 40.0f).setScaling(Scaling.SEA_SHORE);
public static final Biome DESERT_HILLS = new Biome(60.0f, 0.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome FOREST_HILLS = new Biome(8.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome TAIGA_HILLS = new Biome(-10.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome HILLS_EDGE = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_MEDIUM);
public static final Biome TROPIC = new Biome(18.0f, 90.0f).setTropical();
public static final Biome TROPIC_HILLS = new Biome(18.0f, 90.0f).setTropical().setScaling(Scaling.HILLS_LOW);
public static final Biome TROPIC_EDGE = new Biome(18.0f, 80.0f).setTropical();
public static final Biome SEA = new Biome(0.0f, 50.0f).setScaling(Scaling.SEA_MEDIUM).setSea().disableBeach();
public static final Biome STONE_BEACH = new Biome(-12.0f, 30.0f).setScaling(Scaling.SEA_VARYING);
public static final Biome ICE_BEACH = new Biome(-18.0f, 30.0f).setScaling(Scaling.SEA_SHORE).enableColdBeach();
public static final Biome BIRCH_FOREST = new Biome(4.0f, 60.0f);
public static final Biome BIRCH_HILLS = new Biome(4.0f, 60.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome DARK_FOREST = new Biome(8.0f, 80.0f);
public static final Biome ICE_TAIGA = new Biome(-40.0f, 40.0f).enableColdBeach().setScaling(Scaling.PLAINS_MEDIUM);
public static final Biome ICE_TAIGA_HILLS = new Biome(-40.0f, 40.0f).enableColdBeach().setScaling(Scaling.HILLS_LOW);
public static final Biome LARGE_TAIGA = new Biome(-8.0f, 80.0f).setScaling(Scaling.PLAINS_MEDIUM);
public static final Biome LARGE_TAIGA_HILLS = new Biome(-8.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome LARGE_HILLS = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_LARGE);
public static final Biome SAVANNA = new Biome(28.0f, 0.0f).setScaling(Scaling.PLAINS_LOW);
public static final Biome SAVANNA_PLATEAU = new Biome(20.0f, 0.0f).setScaling(Scaling.HILLS_PLATEAU);
public static final Biome DESERT_MOD = DESERT.mutate(60.0f, 0.0f);
public static final Biome HILLS_MOD = HILLS.mutate(new Biome(-12.0f, 30.0f).setScaling(HILLS.depth, HILLS.scale));
public static final Biome FLOWER_FOREST = FOREST.mutate(new Biome(8.0f, 80.0f).setScaling(FOREST.depth, FOREST.scale + 0.2F));
public static final Biome TAIGA_MOD = TAIGA.mutate(-10.0f, 80.0f);
public static final Biome SWAMP_MOD = SWAMP.mutate(12.0f, 90.0f);
public static final Biome ICE_SPIKES = ICE.mutate(new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(ICE.depth + 0.3F, ICE.scale + 0.4F));
public static final Biome TROPIC_MOD = TROPIC.mutate(18.0f, 90.0f);
public static final Biome TROPIC_EDGE_MOD = TROPIC_EDGE.mutate(18.0f, 80.0f);
public static final Biome BIRCH_FOREST_MOD = BIRCH_FOREST.mutate(4.0f, 60.0f);
public static final Biome BIRCH_HILLS_MOD = BIRCH_HILLS.mutate(4.0f, 60.0f);
public static final Biome DARK_FOREST_MOD = DARK_FOREST.mutate(8.0f, 80.0f);
public static final Biome ICE_TAIGA_MOD = ICE_TAIGA.mutate(-40.0f, 40.0f);
public static final Biome SPRUCE_TAIGA = LARGE_TAIGA.mutate((new Biome(-10.0f, 80.0f)).setScaling(LARGE_TAIGA.depth, LARGE_TAIGA.scale));
public static final Biome REDWOOD_TAIGA = LARGE_TAIGA.mutate(-10.0f, 80.0f);
public static final Biome LARGE_HILLS_MOD = LARGE_HILLS.mutate(new Biome(-12.0f, 30.0f).setScaling(LARGE_HILLS.depth, LARGE_HILLS.scale));
public static final Biome SAVANNA_MOD = SAVANNA.mutate(new Biome(24.0f, 0.0f, SAVANNA).setScaling(SAVANNA.depth * 0.5F + 0.3F, SAVANNA.scale * 0.5F + 1.2F));
public static final Biome SAVANNA_PLATEAU_MOD = SAVANNA_PLATEAU.mutate(new Biome(20.0f, 0.0f, SAVANNA_PLATEAU).setScaling(SAVANNA_PLATEAU.depth * 0.5F + 0.3F, SAVANNA_PLATEAU.scale * 0.5F + 1.2F));
public int id;
public final float temperature; public final float temperature;
public final float humidity; public final float humidity;
public final float depth;
public final float scale;
public final float factor;
protected Biome baseBiome; public int id;
public Biome mutated = null;
public float depth = Scaling.VARYING_LOW.depth;
public float scale = Scaling.VARYING_LOW.scale;
public float factor;
public boolean allowColdBeach = false;
public boolean disallowBeach = false;
public boolean tropical = false;
public Temperature category;
public Biome(float temperature, float humidity) { public Biome(float temperature, float humidity, float depth, float scale) {
BIOMES[id] = this;
this.id = id;
this.temperature = temperature; this.temperature = temperature;
this.humidity = humidity; this.humidity = humidity;
this.category = temperature < -12.0f ? Temperature.COLD : (temperature < 20.0f ? Temperature.MEDIUM : Temperature.WARM);
this.factor = Math.min(humidity * 0.01f * ((temperature + 14.0f) / 40.0f + 0.15f), 1.0f);
}
public Biome(float temperature, float humidity, Biome biome)
{
this(temperature, humidity);
this.baseBiome = biome;
this.allowColdBeach = biome.allowColdBeach;
this.tropical = biome.tropical;
this.disallowBeach = biome.disallowBeach;
this.depth = biome.depth + 0.1F;
this.scale = biome.scale + 0.2F;
this.category = biome.category;
this.factor = biome.factor;
}
protected final Biome setScaling(Scaling scaling)
{
return this.setScaling(scaling.depth, scaling.scale);
}
protected final Biome setScaling(float depth, float scale)
{
this.depth = depth; this.depth = depth;
this.scale = scale; this.scale = scale;
return this; this.factor = Math.min(humidity * 0.01f * ((temperature + 14.0f) / 40.0f + 0.15f), 1.0f);
}
protected Biome enableColdBeach()
{
this.allowColdBeach = true;
return this;
}
protected Biome disableBeach()
{
this.disallowBeach = true;
return this;
}
protected Biome setTropical()
{
this.tropical = true;
return this;
}
protected Biome setSea()
{
this.category = Temperature.SEA;
return this;
}
private Biome mutate(Biome mutated)
{
return this.mutated = mutated;
}
private Biome mutate(float temperature, float humidity)
{
return this.mutated = new Biome(temperature, humidity, this);
} }
public Class <? extends Biome > getBiomeClass() public Biome(float temperature, float humidity, Scaling scaling) {
{ this(temperature, humidity, scaling.depth, scaling.scale);
return this.baseBiome != null ? this.baseBiome.getBiomeClass() : this.getClass();
} }
public boolean isEqualTo(Biome biome) public Biome(float temperature, float humidity) {
{ this(temperature, humidity, Scaling.VARYING_LOW);
return this.baseBiome != null ? this.baseBiome.isEqualTo(biome) : (biome == this || (biome != null && this.getBiomeClass() == biome.getBiomeClass()));
} }
} }

View file

@ -1,5 +0,0 @@
package common.biome;
public enum Temperature {
SEA, COLD, MEDIUM, WARM;
}

View file

@ -234,7 +234,7 @@ public abstract class Dimension extends Section {
private float depth = 0.1f; // g.perlin private float depth = 0.1f; // g.perlin
private float scale = 0.2f; // g.perlin private float scale = 0.2f; // g.perlin
private Biome defaultBiome = Biome.NONE; // biomegen private Biome defaultBiome = null; // biomegen
private State filler = Blocks.air.getState(); // caves+rav, liquid, ore, g.perlin, g.cavern, g.island, private State filler = Blocks.air.getState(); // caves+rav, liquid, ore, g.perlin, g.cavern, g.island,
// g.simple, g.flat (sealevel), r.biome, r.simple, r.alternate, r.toplayer // g.simple, g.flat (sealevel), r.biome, r.simple, r.alternate, r.toplayer
@ -507,7 +507,7 @@ public abstract class Dimension extends Section {
public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity, public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
int addRarity, Biome ... add) { int addRarity, Biome ... add) {
this.defaultBiome = mainBiome; this.defaultBiome = mainBiome; //TODO: save
this.semiFixed = semiFixed; this.semiFixed = semiFixed;
this.biomeSize = biomeSize; this.biomeSize = biomeSize;
this.riverSize = riverSize; this.riverSize = riverSize;
@ -1128,7 +1128,7 @@ public abstract class Dimension extends Section {
this.snowRarity = tag.getInt("SnowRarity"); this.snowRarity = tag.getInt("SnowRarity");
this.seaRarity = tag.getInt("SeaRarity"); this.seaRarity = tag.getInt("SeaRarity");
this.addRarity = tag.getInt("AddRarity"); this.addRarity = tag.getInt("AddRarity");
this.defaultBiome = Biome.findByName(tag.getString("DefaultBiome")); // this.defaultBiome = Biome.findByName(tag.getString("DefaultBiome"));
this.semiFixed = tag.getBool("SemiFixed"); this.semiFixed = tag.getBool("SemiFixed");
this.defaultWeather = Weather.getByName(tag.getString("DefaultWeather")); this.defaultWeather = Weather.getByName(tag.getString("DefaultWeather"));
this.defaultWeather = this.weather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather; this.defaultWeather = this.weather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather;
@ -1149,81 +1149,81 @@ public abstract class Dimension extends Section {
else { else {
this.layers = null; this.layers = null;
} }
if(tag.hasStringArray("AddBiomes")) { // if(tag.hasStringArray("AddBiomes")) {
String[] list = tag.getStringArray("AddBiomes"); // String[] list = tag.getStringArray("AddBiomes");
if(list.length == 0) { // if(list.length == 0) {
this.addBiomes = null; // this.addBiomes = null;
} // }
else { // else {
this.addBiomes = new Biome[list.length]; // this.addBiomes = new Biome[list.length];
for(int z = 0; z < this.addBiomes.length; z++) { // for(int z = 0; z < this.addBiomes.length; z++) {
this.addBiomes[z] = Biome.findByName(list[z]); // this.addBiomes[z] = Biome.findByName(list[z]);
} // }
} // }
} // }
else { // else {
this.addBiomes = null; // this.addBiomes = null;
} // }
if(tag.hasStringArray("FrostBiomes")) { // if(tag.hasStringArray("FrostBiomes")) {
String[] list = tag.getStringArray("FrostBiomes"); // String[] list = tag.getStringArray("FrostBiomes");
if(list.length == 0) { // if(list.length == 0) {
this.frostBiomes = null; // this.frostBiomes = null;
} // }
else { // else {
this.frostBiomes = new Biome[list.length]; // this.frostBiomes = new Biome[list.length];
for(int z = 0; z < this.frostBiomes.length; z++) { // for(int z = 0; z < this.frostBiomes.length; z++) {
this.frostBiomes[z] = Biome.findByName(list[z]); // this.frostBiomes[z] = Biome.findByName(list[z]);
} // }
} // }
} // }
else { // else {
this.frostBiomes = null; // this.frostBiomes = null;
} // }
if(tag.hasStringArray("ColdBiomes")) { // if(tag.hasStringArray("ColdBiomes")) {
String[] list = tag.getStringArray("ColdBiomes"); // String[] list = tag.getStringArray("ColdBiomes");
if(list.length == 0) { // if(list.length == 0) {
this.coldBiomes = null; // this.coldBiomes = null;
} // }
else { // else {
this.coldBiomes = new Biome[list.length]; // this.coldBiomes = new Biome[list.length];
for(int z = 0; z < this.coldBiomes.length; z++) { // for(int z = 0; z < this.coldBiomes.length; z++) {
this.coldBiomes[z] = Biome.findByName(list[z]); // this.coldBiomes[z] = Biome.findByName(list[z]);
} // }
} // }
} // }
else { // else {
this.coldBiomes = null; // this.coldBiomes = null;
} // }
if(tag.hasStringArray("MediumBiomes")) { // if(tag.hasStringArray("MediumBiomes")) {
String[] list = tag.getStringArray("MediumBiomes"); // String[] list = tag.getStringArray("MediumBiomes");
if(list.length == 0) { // if(list.length == 0) {
this.mediumBiomes = null; // this.mediumBiomes = null;
} // }
else { // else {
this.mediumBiomes = new Biome[list.length]; // this.mediumBiomes = new Biome[list.length];
for(int z = 0; z < this.mediumBiomes.length; z++) { // for(int z = 0; z < this.mediumBiomes.length; z++) {
this.mediumBiomes[z] = Biome.findByName(list[z]); // this.mediumBiomes[z] = Biome.findByName(list[z]);
} // }
} // }
} // }
else { // else {
this.mediumBiomes = null; // this.mediumBiomes = null;
} // }
if(tag.hasStringArray("HotBiomes")) { // if(tag.hasStringArray("HotBiomes")) {
String[] list = tag.getStringArray("HotBiomes"); // String[] list = tag.getStringArray("HotBiomes");
if(list.length == 0) { // if(list.length == 0) {
this.hotBiomes = null; // this.hotBiomes = null;
} // }
else { // else {
this.hotBiomes = new Biome[list.length]; // this.hotBiomes = new Biome[list.length];
for(int z = 0; z < this.hotBiomes.length; z++) { // for(int z = 0; z < this.hotBiomes.length; z++) {
this.hotBiomes[z] = Biome.findByName(list[z]); // this.hotBiomes[z] = Biome.findByName(list[z]);
} // }
} // }
} // }
else { // else {
this.hotBiomes = null; // this.hotBiomes = null;
} // }
this.ores.clear(); this.ores.clear();
if(tag.hasList("Ores")) { if(tag.hasList("Ores")) {
List<TagObject> list = tag.getList("Ores"); List<TagObject> list = tag.getList("Ores");
@ -1348,7 +1348,7 @@ public abstract class Dimension extends Section {
tag.setInt("SnowRarity", this.snowRarity); tag.setInt("SnowRarity", this.snowRarity);
tag.setInt("SeaRarity", this.seaRarity); tag.setInt("SeaRarity", this.seaRarity);
tag.setInt("AddRarity", this.addRarity); tag.setInt("AddRarity", this.addRarity);
tag.setString("DefaultBiome", this.defaultBiome.getName()); // tag.setString("DefaultBiome", this.defaultBiome.getName());
tag.setBool("SemiFixed", this.semiFixed); tag.setBool("SemiFixed", this.semiFixed);
tag.setString("DefaultWeather", this.defaultWeather.getName()); tag.setString("DefaultWeather", this.defaultWeather.getName());
tag.setString("DefaultLeaves", this.defaultLeaves.getName()); tag.setString("DefaultLeaves", this.defaultLeaves.getName());
@ -1364,41 +1364,41 @@ public abstract class Dimension extends Section {
} }
tag.setStringArray("Layers", list); tag.setStringArray("Layers", list);
} }
if(this.addBiomes != null) { // if(this.addBiomes != null) {
String[] list = new String[this.addBiomes.length]; // String[] list = new String[this.addBiomes.length];
for(int z = 0; z < this.addBiomes.length; z++) { // for(int z = 0; z < this.addBiomes.length; z++) {
list[z] = this.addBiomes[z].getName(); // list[z] = this.addBiomes[z].getName();
} // }
tag.setStringArray("AddBiomes", list); // tag.setStringArray("AddBiomes", list);
} // }
if(this.frostBiomes != null) { // if(this.frostBiomes != null) {
String[] list = new String[this.frostBiomes.length]; // String[] list = new String[this.frostBiomes.length];
for(int z = 0; z < this.frostBiomes.length; z++) { // for(int z = 0; z < this.frostBiomes.length; z++) {
list[z] = this.frostBiomes[z].getName(); // list[z] = this.frostBiomes[z].getName();
} // }
tag.setStringArray("FrostBiomes", list); // tag.setStringArray("FrostBiomes", list);
} // }
if(this.coldBiomes != null) { // if(this.coldBiomes != null) {
String[] list = new String[this.coldBiomes.length]; // String[] list = new String[this.coldBiomes.length];
for(int z = 0; z < this.coldBiomes.length; z++) { // for(int z = 0; z < this.coldBiomes.length; z++) {
list[z] = this.coldBiomes[z].getName(); // list[z] = this.coldBiomes[z].getName();
} // }
tag.setStringArray("ColdBiomes", list); // tag.setStringArray("ColdBiomes", list);
} // }
if(this.mediumBiomes != null) { // if(this.mediumBiomes != null) {
String[] list = new String[this.mediumBiomes.length]; // String[] list = new String[this.mediumBiomes.length];
for(int z = 0; z < this.mediumBiomes.length; z++) { // for(int z = 0; z < this.mediumBiomes.length; z++) {
list[z] = this.mediumBiomes[z].getName(); // list[z] = this.mediumBiomes[z].getName();
} // }
tag.setStringArray("MediumBiomes", list); // tag.setStringArray("MediumBiomes", list);
} // }
if(this.hotBiomes != null) { // if(this.hotBiomes != null) {
String[] list = new String[this.hotBiomes.length]; // String[] list = new String[this.hotBiomes.length];
for(int z = 0; z < this.hotBiomes.length; z++) { // for(int z = 0; z < this.hotBiomes.length; z++) {
list[z] = this.hotBiomes[z].getName(); // list[z] = this.hotBiomes[z].getName();
} // }
tag.setStringArray("HotBiomes", list); // tag.setStringArray("HotBiomes", list);
} // }
if(!this.ores.isEmpty()) { if(!this.ores.isEmpty()) {
List<TagObject> list = Lists.newArrayList(); List<TagObject> list = Lists.newArrayList();
for(Ore gen : this.ores) { for(Ore gen : this.ores) {

View file

@ -1,6 +1,5 @@
package common.dimension; package common.dimension;
import common.biome.Biome;
import common.world.World; import common.world.World;
public final class Space extends Dimension { public final class Space extends Dimension {

View file

@ -5,6 +5,7 @@ import java.util.IdentityHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import common.biome.Biome; import common.biome.Biome;
import common.biome.Scaling;
import common.collect.Lists; import common.collect.Lists;
import common.collect.Maps; import common.collect.Maps;
import common.collect.Sets; import common.collect.Sets;
@ -17,7 +18,6 @@ import common.dimension.Galaxy;
import common.dimension.Moon; import common.dimension.Moon;
import common.dimension.Section; import common.dimension.Section;
import common.dimension.Planet; import common.dimension.Planet;
import common.dimension.RngSpawn;
import common.dimension.Sector; import common.dimension.Sector;
import common.dimension.Semi; import common.dimension.Semi;
import common.dimension.Space; import common.dimension.Space;
@ -37,7 +37,6 @@ import common.entity.animal.EntityWolf;
import common.entity.npc.EntityArachnoid; import common.entity.npc.EntityArachnoid;
import common.entity.npc.EntityBloodElf; import common.entity.npc.EntityBloodElf;
import common.entity.npc.EntityCultivator; import common.entity.npc.EntityCultivator;
import common.entity.npc.EntityDwarf;
import common.entity.npc.EntityElf; import common.entity.npc.EntityElf;
import common.entity.npc.EntityFireDemon; import common.entity.npc.EntityFireDemon;
import common.entity.npc.EntityHaunter; import common.entity.npc.EntityHaunter;
@ -51,7 +50,6 @@ import common.entity.npc.EntityUndead;
import common.entity.npc.EntityWoodElf; import common.entity.npc.EntityWoodElf;
import common.entity.npc.EntityZombie; import common.entity.npc.EntityZombie;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.rng.WeightedList;
import common.world.Weather; import common.world.Weather;
import java.util.Set; import java.util.Set;
@ -428,77 +426,62 @@ public abstract class UniverseRegistry {
private static void registerMoon(String display, int radius, long orbitRotation, float gravity, float temperature) { private static void registerMoon(String display, int radius, long orbitRotation, float gravity, float temperature) {
registerMoon(display, new Moon(radius, orbitRotation, gravity, temperature)); registerMoon(display, new Moon(radius, orbitRotation, gravity, temperature));
} }
/*public class BiomeBlackened extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityMetalhead.class, 50, 1, 1));
}
}
public class BiomeChaos extends MobPopulator { // public static final Biome PLAIN = new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW);
protected void addMobs(WeightedList<RngSpawn> mobs) { // public static final Biome DESERT = new Biome(60.0f, 0.0f, Scaling.PLAINS_LOW);
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) { // public static final Biome HILLS = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
if(EntityLiving.class.isAssignableFrom(clazz)) // public static final Biome FOREST = new Biome(8.0f, 80.0f);
mobs.add(new RngSpawn((Class<? extends EntityLiving>)clazz, 1, 1, 8)); // public static final Biome TAIGA = new Biome(-10.0f, 80.0f, Scaling.PLAINS_MEDIUM);
} // public static final Biome SWAMP = new Biome(12.0f, 90.0f, Scaling.SEA_POND);
} // public static final Biome ICE = new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW);
} // public static final Biome ICE_HILLS = new Biome(-20.0f, 50.0f, Scaling.HILLS_LOW);
// public static final Biome BEACH = new Biome(12.0f, 40.0f, Scaling.SEA_SHORE);
// public static final Biome DESERT_HILLS = new Biome(60.0f, 0.0f, Scaling.HILLS_LOW);
// public static final Biome FOREST_HILLS = new Biome(8.0f, 80.0f, Scaling.HILLS_LOW);
// public static final Biome TAIGA_HILLS = new Biome(-10.0f, 80.0f, Scaling.HILLS_LOW);
// public static final Biome HILLS_EDGE = new Biome(-12.0f, 30.0f, Scaling.HILLS_MEDIUM);
// public static final Biome TROPIC = new Biome(18.0f, 90.0f);
// public static final Biome TROPIC_HILLS = new Biome(18.0f, 90.0f, Scaling.HILLS_LOW);
// public static final Biome TROPIC_EDGE = new Biome(18.0f, 80.0f);
// public static final Biome STONE_BEACH = new Biome(-12.0f, 30.0f, Scaling.SEA_VARYING);
// public static final Biome ICE_BEACH = new Biome(-18.0f, 30.0f, Scaling.SEA_SHORE);
// public static final Biome BIRCH_FOREST = new Biome(4.0f, 60.0f);
// public static final Biome BIRCH_HILLS = new Biome(4.0f, 60.0f, Scaling.HILLS_LOW);
// public static final Biome DARK_FOREST = new Biome(8.0f, 80.0f);
// public static final Biome ICE_TAIGA = new Biome(-40.0f, 40.0f, Scaling.PLAINS_MEDIUM);
// public static final Biome ICE_TAIGA_HILLS = new Biome(-40.0f, 40.0f, Scaling.HILLS_LOW);
// public static final Biome LARGE_TAIGA = new Biome(-8.0f, 80.0f, Scaling.PLAINS_MEDIUM);
// public static final Biome LARGE_TAIGA_HILLS = new Biome(-8.0f, 80.0f, Scaling.HILLS_LOW);
// public static final Biome LARGE_HILLS = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
// public static final Biome SAVANNA = new Biome(28.0f, 0.0f, Scaling.PLAINS_LOW);
// public static final Biome SAVANNA_PLATEAU = new Biome(20.0f, 0.0f, Scaling.HILLS_PLATEAU);
//
// public static final Biome DESERT_MOD = new Biome(60.0f, 0.0f, 0.225F, 0.25F);
// public static final Biome HILLS_MOD = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
// public static final Biome FLOWER_FOREST = new Biome(8.0f, 80.0f, 0.1F, 0.4F);
// public static final Biome TAIGA_MOD = new Biome(-10.0f, 80.0f, 0.3F, 0.4F);
// public static final Biome SWAMP_MOD = new Biome(12.0f, 90.0f, -0.1F, 0.3F);
// public static final Biome ICE_SPIKES = new Biome(-20.0f, 50.0f, 0.425F, 0.45F);
// public static final Biome TROPIC_MOD = new Biome(18.0f, 90.0f, 0.2F, 0.4F);
// public static final Biome TROPIC_EDGE_MOD = new Biome(18.0f, 80.0f, 0.2F, 0.4F);
// public static final Biome BIRCH_FOREST_MOD = new Biome(4.0f, 60.0f, 0.2F, 0.4F);
// public static final Biome BIRCH_HILLS_MOD = new Biome(4.0f, 60.0f, 0.55F, 0.5F);
// public static final Biome DARK_FOREST_MOD = new Biome(8.0f, 80.0f, 0.2F, 0.4F);
// public static final Biome ICE_TAIGA_MOD = new Biome(-40.0f, 40.0f, 0.3F, 0.4F);
// public static final Biome SPRUCE_TAIGA = new Biome(-10.0f, 80.0f, Scaling.PLAINS_MEDIUM);
// public static final Biome REDWOOD_TAIGA = new Biome(-10.0f, 80.0f, 0.3F, 0.4F);
// public static final Biome LARGE_HILLS_MOD = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
// public static final Biome SAVANNA_MOD = new Biome(24.0f, 0.0f, 0.3625F, 1.225F);
// public static final Biome SAVANNA_PLATEAU_MOD = new Biome(20.0f, 0.0f, 1.05F, 1.2125F);
//
// .setBiomeGen(Biome.FOREST, false, 4, 4, 6, 50).enableMobs().enableSnow()
// .setFrostBiomes(Biome.ICE, Biome.ICE, Biome.ICE, Biome.ICE_TAIGA, Biome.LARGE_TAIGA)
// .setColdBiomes(Biome.FOREST, Biome.HILLS, Biome.TAIGA, Biome.PLAIN)
// .setMediumBiomes(Biome.FOREST, Biome.DARK_FOREST, Biome.HILLS, Biome.PLAIN, Biome.BIRCH_FOREST,
// Biome.SWAMP, Biome.TROPIC)
// .setHotBiomes(Biome.DESERT, Biome.DESERT, Biome.DESERT, Biome.SAVANNA, Biome.SAVANNA, Biome.PLAIN)
public class BiomeHell extends MobPopulator { static void register() { // TODO: add mushroom 0.2F, 0.3F .addSpawn(EntityDwarf.class, 8, 4, 8)
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityFireDemon.class, 50, 4, 4));
mobs.add(new RngSpawn(EntityTiefling.class, 100, 4, 4));
mobs.add(new RngSpawn(EntityBloodElf.class, 50, 2, 10));
mobs.add(new RngSpawn(EntityCultivator.class, 10, 1, 1));
}
}
public class BiomeMetalHell extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityFireDemon.class, 50, 4, 4));
mobs.add(new RngSpawn(EntityTiefling.class, 100, 4, 4));
mobs.add(new RngSpawn(EntityBloodElf.class, 10, 1, 2));
mobs.add(new RngSpawn(EntityMetalhead.class, 1, 1, 1));
}
}
public class BiomeMushroom extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityDwarf.class, 8, 4, 8));
}
}
public class BiomeSnowLand extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntitySheep.class, 50, 4, 4));
mobs.add(new RngSpawn(EntitySpirit.class, 10, 1, 1));
}
}
public class BiomeTian extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityCultivator.class, 50, 1, 1));
mobs.add(new RngSpawn(EntityMerfolk.class, 10, 4, 4));
mobs.add(new RngSpawn(EntityRabbit.class, 10, 3, 10));
mobs.add(new RngSpawn(EntityBat.class, 10, 8, 8));
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
}
}
public class BiomeElvenForest extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntitySheep.class, 12, 4, 4));
mobs.add(new RngSpawn(EntityRabbit.class, 10, 3, 10));
mobs.add(new RngSpawn(EntityChicken.class, 10, 4, 4));
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
mobs.add(new RngSpawn(EntityWoodElf.class, 100, 4, 16));
mobs.add(new RngSpawn(EntityElf.class, 12, 4, 16));
mobs.add(new RngSpawn(EntityFox.class, 3, 2, 5));
}
}
*/
static void register() { //TODO: add mushroom 0.2F, 0.3F
register("space", "Der Weltraum", Space.INSTANCE); register("space", "Der Weltraum", Space.INSTANCE);
registerGalaxy("milkyway", "Galaxie Milchstraße", () -> { registerGalaxy("milkyway", "Galaxie Milchstraße", () -> {
@ -507,12 +490,12 @@ public abstract class UniverseRegistry {
registerPlanet("Terra", new Planet(6378136, 8766144L, 24000L, 28.0f, 9.81f, 259.15f) registerPlanet("Terra", new Planet(6378136, 8766144L, 24000L, 28.0f, 9.81f, 259.15f)
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63) .setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()) .setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
.setBiomeGen(Biome.FOREST, false, 4, 4, 6, 50).enableMobs().enableSnow() .setBiomeGen(new Biome(8.0f, 80.0f), false, 4, 4, 6, 50).enableSnow()
.setFrostBiomes(Biome.ICE, Biome.ICE, Biome.ICE, Biome.ICE_TAIGA, Biome.LARGE_TAIGA) .setFrostBiomes(new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW), new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW), new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW), new Biome(-40.0f, 40.0f, Scaling.PLAINS_MEDIUM), new Biome(-8.0f, 80.0f, Scaling.PLAINS_MEDIUM))
.setColdBiomes(Biome.FOREST, Biome.HILLS, Biome.TAIGA, Biome.PLAIN) .setColdBiomes(new Biome(8.0f, 80.0f), new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE), new Biome(-10.0f, 80.0f, Scaling.PLAINS_MEDIUM), new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW))
.setMediumBiomes(Biome.FOREST, Biome.DARK_FOREST, Biome.HILLS, Biome.PLAIN, Biome.BIRCH_FOREST, .setMediumBiomes(new Biome(8.0f, 80.0f), new Biome(8.0f, 80.0f, 0.1F, 0.4F), new Biome(8.0f, 80.0f), new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE), new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW), new Biome(4.0f, 60.0f),
Biome.SWAMP, Biome.TROPIC) new Biome(12.0f, 90.0f, Scaling.SEA_POND), new Biome(18.0f, 90.0f))
.setHotBiomes(Biome.DESERT, Biome.DESERT, Biome.DESERT, Biome.SAVANNA, Biome.SAVANNA, Biome.PLAIN) .setHotBiomes(new Biome(60.0f, 0.0f, Scaling.PLAINS_LOW), new Biome(60.0f, 0.0f, Scaling.PLAINS_LOW), new Biome(60.0f, 0.0f, Scaling.HILLS_LOW), new Biome(28.0f, 0.0f, Scaling.PLAINS_LOW), new Biome(20.0f, 0.0f, Scaling.HILLS_PLATEAU), new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW))
.enableCavesRavines(Blocks.lava.getState()).setDungeons(8) .enableCavesRavines(Blocks.lava.getState()).setDungeons(8)
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false) .addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
.addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true) .addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true)
@ -612,17 +595,24 @@ public abstract class UniverseRegistry {
registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f + 8.0f) //TODO: check temp registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f + 8.0f) //TODO: check temp
.setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64) .setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
.setSimpleReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()) .setSimpleReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs().enableSnow() .enableCaves(Blocks.air.getState()).setDungeons(4).enableSnow()
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false) .addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true) .addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false) .addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true) .addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
.addOre(Blocks.thetium_ore.getState(), 1, 0, 3, 0, 14, false) .addOre(Blocks.thetium_ore.getState(), 1, 0, 3, 0, 14, false)
.addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false)); .addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false)
.addSpawn(EntitySheep.class, 12, 4, 4)
.addSpawn(EntityRabbit.class, 10, 3, 10)
.addSpawn(EntityChicken.class, 10, 4, 4)
.addSpawn(EntityMouse.class, 10, 8, 8)
.addSpawn(EntityWoodElf.class, 100, 4, 16)
.addSpawn(EntityElf.class, 12, 4, 16)
.addSpawn(EntityFox.class, 3, 2, 5));
registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f) registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
.setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63) .setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).setBiomeGen(Biome.FOREST, true, 5, 3, 3, 30) .setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).setBiomeGen(new Biome(8.0f, 80.0f), true, 5, 3, 3, 30)
.enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableMobs().enableSnow() .enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableSnow()
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false) .addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true) .addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false) .addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
@ -642,14 +632,18 @@ public abstract class UniverseRegistry {
.addSpawn(EntityWolf.class, 5, 2, 4) .addSpawn(EntityWolf.class, 5, 2, 4)
.addSpawn(EntityHorse.class, 5, 2, 6), () -> { .addSpawn(EntityHorse.class, 5, 2, 6), () -> {
registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice, 0.1F, 0.2F) //TODO: check height registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice, 0.1F, 0.2F) //TODO: check height
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW)); .enableSnow().setDefaultWeather(Weather.SNOW)
.addSpawn(EntitySheep.class, 50, 4, 4)
.addSpawn(EntitySpirit.class, 10, 1, 1));
registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice, 0.1F, 0.2F) registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice, 0.1F, 0.2F)
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW)); .enableSnow().setDefaultWeather(Weather.SNOW)
.addSpawn(EntitySheep.class, 50, 4, 4)
.addSpawn(EntitySpirit.class, 10, 1, 1));
}); });
registerPlanet("mesar", "Wüstenplanet Me'sar", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 9823183, 56643366L, 87340L, 11.0f, 333.15f) registerPlanet("mesar", "Wüstenplanet Me'sar", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 9823183, 56643366L, 87340L, 11.0f, 333.15f)
.setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63, 0.2f, 0.4f) .setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63, 0.2f, 0.4f)
.setMesarianReplacer(Blocks.red_sand.getState()) .setMesarianReplacer(Blocks.red_sand.getState())
.enableCavesRavines(Blocks.lava.getState()).enableMobs() .enableCavesRavines(Blocks.lava.getState())
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true) .addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true) .addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
.addOre(Blocks.iron_ore.getState(), 6, 2, 24, 0, 64, false) .addOre(Blocks.iron_ore.getState(), 6, 2, 24, 0, 64, false)
@ -667,62 +661,96 @@ public abstract class UniverseRegistry {
registerPlanet("blackplanet", "Der Schwarze Planet", new Planet(0x000000, 0x000000, 0x000000, 13038204, 4632918508L, 204556L, 12.0f, 0.0f) registerPlanet("blackplanet", "Der Schwarze Planet", new Planet(0x000000, 0x000000, 0x000000, 13038204, 4632918508L, 204556L, 12.0f, 0.0f)
.setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63) .setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63)
.setSimpleAltReplacer(Blocks.blackened_soil.getState(), Blocks.blackened_dirt.getState(), Blocks.blackened_cobble.getState()) .setSimpleAltReplacer(Blocks.blackened_soil.getState(), Blocks.blackened_dirt.getState(), Blocks.blackened_cobble.getState())
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs() .enableCaves(Blocks.air.getState()).setDungeons(4)
.addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true) .addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true)
// .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false) // .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false)
.addSpawn(EntityMetalhead.class, 50, 1, 1)
); );
}); });
}); });
}); });
registerSemi("warp", "Der Warp", new Semi(0x0c001f, 0x190033, 124072917, 285.0f, 3).setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f) Dimension warp = new Semi(0x0c001f, 0x190033, 124072917, 285.0f, 3).setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f)
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63, 1.0F, 2.0F) .setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63, 1.0F, 2.0F)
.enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow() .enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableSnow()
.addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false) .addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false)
.addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false) .addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false)
.addLiquid(Blocks.flowing_water.getState(), 1, 8, 255, false) .addLiquid(Blocks.flowing_water.getState(), 1, 8, 255, false)
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true) .addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true)
.setStarBrightness(0.9f).setDeepStarBrightness(0.6f) .setStarBrightness(0.9f).setDeepStarBrightness(0.6f)
.setStarColorSin(25.0f, 0.1f, 0.25f, 0xff00ff, 1, 4).setDeepStarColorSin(25.0f, 0.1f, 0.5f, 0xff00ff, 1, 4)); .setStarColorSin(25.0f, 0.1f, 0.25f, 0xff00ff, 1, 4).setDeepStarColorSin(25.0f, 0.1f, 0.5f, 0xff00ff, 1, 4);
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
if(EntityLiving.class.isAssignableFrom(clazz))
warp.addSpawn((Class<? extends EntityLiving>)clazz, 1, 1, 8);
}
registerSemi("warp", "Der Warp", warp);
registerDomain("Tian'Xin", () -> { registerDomain("Tian'Xin", () -> {
registerArea("Ni'enrath", new Area(0x7f00ff, 532109, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff) registerArea("Ni'enrath", new Area(0x7f00ff, 532109, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff)
.setPerlinGen(Blocks.tian.getState(), Blocks.spring_water.getState(), 63, 0.1F, 1.0F) .setPerlinGen(Blocks.tian.getState(), Blocks.spring_water.getState(), 63, 0.1F, 1.0F)
.setSimpleAltReplacer(Blocks.tian_soil.getState(), Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow() .setSimpleAltReplacer(Blocks.tian_soil.getState(), Blocks.tian.getState()).enableLongCaves().enableSnow()
.addLake(Blocks.spring_water.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false) .addLake(Blocks.spring_water.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
.addLiquid(Blocks.flowing_spring_water.getState(), 50, 8, 255, false)); .addLiquid(Blocks.flowing_spring_water.getState(), 50, 8, 255, false)
.addSpawn(EntityCultivator.class, 50, 1, 1)
.addSpawn(EntityMerfolk.class, 10, 4, 4)
.addSpawn(EntityRabbit.class, 10, 3, 10)
.addSpawn(EntityBat.class, 10, 8, 8)
.addSpawn(EntityMouse.class, 10, 8, 8));
}); });
registerDomain("Digital", () -> { registerDomain("Digital", () -> {
registerArea("Cyberspace", new Area(0x000000, 16777216, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction() registerArea("Cyberspace", new Area(0x000000, 16777216, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction()
.setFlatGen(Blocks.green_clay.getState(), 2) .setFlatGen(Blocks.green_clay.getState(), 2));
.enableMobs());
}); });
registerDomain("hell", "Hölle", () -> { registerDomain("hell", "Hölle", () -> {
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2).enableLongCaves().enableMobs().enableFortresses() registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2).enableLongCaves().enableFortresses()
.enableWorldCeiling().enableDenseFog() .enableWorldCeiling().enableDenseFog()
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63) .setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())); .setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 86742970, 387.15f, 3).enableLongCaves().enableMobs() .addSpawn(EntityFireDemon.class, 50, 4, 4)
.addSpawn(EntityTiefling.class, 100, 4, 4)
.addSpawn(EntityBloodElf.class, 10, 1, 2)
.addSpawn(EntityMetalhead.class, 1, 1, 1));
registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 86742970, 387.15f, 3).enableLongCaves()
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64) .setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState()) .setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false) .addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true)); .addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true)
registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 67028432, 467.15f, 15).enableLongCaves().enableMobs() .addSpawn(EntityFireDemon.class, 50, 4, 4)
.addSpawn(EntityTiefling.class, 100, 4, 4)
.addSpawn(EntityBloodElf.class, 50, 2, 10)
.addSpawn(EntityCultivator.class, 10, 1, 1));
registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 67028432, 467.15f, 15).enableLongCaves()
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63, 1.0F, 0.5F) .setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63, 1.0F, 0.5F)
.setSimpleAltReplacer(Blocks.soul_sand.getState()) .setSimpleAltReplacer(Blocks.soul_sand.getState())
.addLake(Blocks.lava.getState(), Blocks.soul_sand.getState(), Blocks.soul_sand.getState(), .addLake(Blocks.lava.getState(), Blocks.soul_sand.getState(), Blocks.soul_sand.getState(),
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true)); 2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true)
registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 54029584, 1067.15f, 15).enableMobs() .addSpawn(EntityFireDemon.class, 50, 4, 4)
.addSpawn(EntityTiefling.class, 100, 4, 4)
.addSpawn(EntityBloodElf.class, 50, 2, 10)
.addSpawn(EntityCultivator.class, 10, 1, 1));
registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 54029584, 1067.15f, 15)
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63, -0.2F, 0.1F) .setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63, -0.2F, 0.1F)
.setSimpleAltReplacer(Blocks.soul_sand.getState())); .setSimpleAltReplacer(Blocks.soul_sand.getState())
registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 43293629, 1707.15f, 15).enableMobs() .addSpawn(EntityFireDemon.class, 50, 4, 4)
.addSpawn(EntityTiefling.class, 100, 4, 4)
.addSpawn(EntityBloodElf.class, 50, 2, 10)
.addSpawn(EntityCultivator.class, 10, 1, 1));
registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 43293629, 1707.15f, 15)
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63, -0.2F, 0.1F) .setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63, -0.2F, 0.1F)
.setSimpleAltReplacer(Blocks.soul_sand.getState())); .setSimpleAltReplacer(Blocks.soul_sand.getState())
registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 36291872, 2482.0f, 1).enableLongCaves().enableMobs() .addSpawn(EntityFireDemon.class, 50, 4, 4)
.addSpawn(EntityTiefling.class, 100, 4, 4)
.addSpawn(EntityBloodElf.class, 50, 2, 10)
.addSpawn(EntityCultivator.class, 10, 1, 1));
registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 36291872, 2482.0f, 1).enableLongCaves()
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63, 0.125F, 0.05F) .setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63, 0.125F, 0.05F)
.setSimpleAltReplacer(Blocks.ash.getState(), Blocks.rock.getState(), Blocks.ash.getState()) .setSimpleAltReplacer(Blocks.ash.getState(), Blocks.rock.getState(), Blocks.ash.getState())
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(), .addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true)); 2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true)
.addSpawn(EntityFireDemon.class, 50, 4, 4)
.addSpawn(EntityTiefling.class, 100, 4, 4)
.addSpawn(EntityBloodElf.class, 50, 2, 10)
.addSpawn(EntityCultivator.class, 10, 1, 1));
}); });
} }
} }

View file

@ -108,7 +108,6 @@ import server.vars.SVar;
import server.vars.SVars; import server.vars.SVars;
import server.world.Region; import server.world.Region;
import server.world.WorldServer; import server.world.WorldServer;
import server.worldgen.biome.GenBiome;
public final class Server implements IThreadListener, Executor { public final class Server implements IThreadListener, Executor {
private final Thread thread = Thread.currentThread(); private final Thread thread = Thread.currentThread();

View file

@ -7,7 +7,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
import common.biome.Biome;
import common.block.Block; import common.block.Block;
import common.block.artificial.BlockFence; import common.block.artificial.BlockFence;
import common.block.artificial.BlockFenceGate; import common.block.artificial.BlockFenceGate;
@ -888,7 +887,7 @@ public class Player extends User implements Executor, IPlayer
{ {
int x = (chunk.xPos << 4) | (n >> 4); int x = (chunk.xPos << 4) | (n >> 4);
int z = (chunk.zPos << 4) | (n & 15); int z = (chunk.zPos << 4) | (n & 15);
int temp = Float.floatToIntBits(gen == null ? 0.0f : gen.getBiomeAt(new BlockPos(x, 0, z), Biome.NONE).temperature); int temp = Float.floatToIntBits(gen == null ? 0.0f : gen.getBiomeAt(new BlockPos(x, 0, z)).temperature);
int off = Float.floatToIntBits(world.getTempNoise(x, z)); int off = Float.floatToIntBits(world.getTempNoise(x, z));
dataset.data[j++] = (byte)(temp & 255); dataset.data[j++] = (byte)(temp & 255);
dataset.data[j++] = (byte)(temp >> 8 & 255); dataset.data[j++] = (byte)(temp >> 8 & 255);

View file

@ -1,9 +1,7 @@
package server.world; package server.world;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import common.biome.Biome;
import common.block.Block; import common.block.Block;
import common.entity.Entity; import common.entity.Entity;
import common.init.BlockRegistry; import common.init.BlockRegistry;

View file

@ -16,7 +16,6 @@ import common.util.ChunkPos;
import common.util.ExtMath; import common.util.ExtMath;
import common.world.World; import common.world.World;
import server.vars.SVars; import server.vars.SVars;
import server.worldgen.biome.GenBiome;
public abstract class Spawner { public abstract class Spawner {
private static final int MOB_COUNT_DIV = (int)Math.pow(17.0D, 2.0D); private static final int MOB_COUNT_DIV = (int)Math.pow(17.0D, 2.0D);

View file

@ -105,17 +105,15 @@ import server.worldgen.MobConstants;
import server.worldgen.ReplacerAltSimple; import server.worldgen.ReplacerAltSimple;
import server.worldgen.ReplacerAltBiome; import server.worldgen.ReplacerAltBiome;
import server.worldgen.ReplacerAltSurface; import server.worldgen.ReplacerAltSurface;
import server.worldgen.ReplacerBiome;
import server.worldgen.ReplacerMesa; import server.worldgen.ReplacerMesa;
import server.worldgen.ReplacerTerranian; import server.worldgen.ReplacerTerranian;
import server.worldgen.ReplacerTopLayer; import server.worldgen.ReplacerTopLayer;
import server.worldgen.biome.GenBiome;
import server.worldgen.caves.MapGenBigCaves; import server.worldgen.caves.MapGenBigCaves;
import server.worldgen.caves.MapGenCaves; import server.worldgen.caves.MapGenCaves;
import server.worldgen.caves.MapGenRavine; import server.worldgen.caves.MapGenRavine;
import server.worldgen.foliage.WorldGenBigMushroom; import server.worldgen.foliage.WorldGenBigMushroom;
import server.worldgen.populator.Populator; import server.worldgen.populator.Populator;
import server.worldgen.populator.PopulatorBasic; import server.worldgen.populator.PopulatorMesa;
import server.worldgen.structure.MapGenBridge; import server.worldgen.structure.MapGenBridge;
import server.worldgen.structure.MapGenMineshaft; import server.worldgen.structure.MapGenMineshaft;
import server.worldgen.structure.MapGenScatteredFeature; import server.worldgen.structure.MapGenScatteredFeature;
@ -270,7 +268,13 @@ public final class WorldServer extends AWorldServer {
private Populator createPopulator() { private Populator createPopulator() {
switch(this.dimension.getPopulatorType()) { switch(this.dimension.getPopulatorType()) {
case NONE:
return null;
case MESARIAN:
return new PopulatorMesa(true);
case TERRANIAN:
default:
return null;
} }
} }
@ -2340,13 +2344,21 @@ public final class WorldServer extends AWorldServer {
} }
protected float getTemperature(BlockPos pos) { protected float getTemperature(BlockPos pos) {
float temperature = this.biomeGen == null ? 0.0f : this.biomeGen.getBiomeAt(pos, Biome.NONE).temperature; float temperature = this.biomeGen == null ? 0.0f : this.biomeGen.getBiomeAt(pos).temperature;
return pos.getY() > 64 ? temperature - (this.getTempNoise(pos.getX(), pos.getZ()) + (float)pos.getY() - 64.0F) / 15.0f : temperature; return pos.getY() > 64 ? temperature - (this.getTempNoise(pos.getX(), pos.getZ()) + (float)pos.getY() - 64.0F) / 15.0f : temperature;
} }
public float getTempNoise(int x, int z) { public float getTempNoise(int x, int z) {
return (float)(this.tempGen.generate((double)x * 1.0D / 8.0D, (double)z * 1.0D / 8.0D) * 4.0D); return (float)(this.tempGen.generate((double)x * 1.0D / 8.0D, (double)z * 1.0D / 8.0D) * 4.0D);
} }
public float getGenTemperature(int x, int z) {
return this.dimension.getTemperature() + (this.biomeGen == null ? 0.0f : this.biomeGen.getBiomeAt(x, z).temperature);
}
public float getGenHumidity(int x, int z) {
return this.biomeGen == null ? 50.0f : this.biomeGen.getBiomeAt(x, z).humidity;
}
// public boolean canBlockSeeSky(BlockPos pos) { // public boolean canBlockSeeSky(BlockPos pos) {
// if(pos.getY() >= this.getSeaLevel()) { // if(pos.getY() >= this.getSeaLevel()) {

View file

@ -1,11 +1,9 @@
package server.worldgen; package server.worldgen;
import java.util.List; import java.util.List;
import java.util.Set;
import common.biome.Biome; import common.biome.Biome;
import common.biome.Scaling;
import common.collect.Lists; import common.collect.Lists;
import common.log.Log;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.LongHashMap; import common.util.LongHashMap;
import server.worldgen.layer.GenLayer; import server.worldgen.layer.GenLayer;
@ -15,15 +13,12 @@ import server.worldgen.layer.GenLayerAddSea;
import server.worldgen.layer.GenLayerAddSnow; import server.worldgen.layer.GenLayerAddSnow;
import server.worldgen.layer.GenLayerBase; import server.worldgen.layer.GenLayerBase;
import server.worldgen.layer.GenLayerBiome; import server.worldgen.layer.GenLayerBiome;
import server.worldgen.layer.GenLayerBiomeEdge;
import server.worldgen.layer.GenLayerEdge; import server.worldgen.layer.GenLayerEdge;
import server.worldgen.layer.GenLayerFuzzyZoom; import server.worldgen.layer.GenLayerFuzzyZoom;
import server.worldgen.layer.GenLayerHills;
import server.worldgen.layer.GenLayerRemoveEmpty; import server.worldgen.layer.GenLayerRemoveEmpty;
import server.worldgen.layer.GenLayerRiver; import server.worldgen.layer.GenLayerRiver;
import server.worldgen.layer.GenLayerRiverInit; import server.worldgen.layer.GenLayerRiverInit;
import server.worldgen.layer.GenLayerRiverMix; import server.worldgen.layer.GenLayerRiverMix;
import server.worldgen.layer.GenLayerShore;
import server.worldgen.layer.GenLayerSmooth; import server.worldgen.layer.GenLayerSmooth;
import server.worldgen.layer.GenLayerVoronoiZoom; import server.worldgen.layer.GenLayerVoronoiZoom;
import server.worldgen.layer.GenLayerZoom; import server.worldgen.layer.GenLayerZoom;
@ -56,12 +51,38 @@ public class BiomeGenerator {
private final GenLayer biomeIndexLayer; private final GenLayer biomeIndexLayer;
private final LongHashMap<CacheBlock> cacheMap = new LongHashMap(); private final LongHashMap<CacheBlock> cacheMap = new LongHashMap();
private final List<CacheBlock> cache = Lists.<CacheBlock>newArrayList(); private final List<CacheBlock> cache = Lists.<CacheBlock>newArrayList();
private final Biome[] biomes = new Biome[256]; private final Biome[] biomes;
private final Biome defBiome; private final Biome defBiome;
private long lastCleanupTime; private long lastCleanupTime;
public BiomeGenerator(long seed, Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity, public BiomeGenerator(long seed, Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
Biome[] add, int addRarity, Biome[] hot, Biome[] medium, Biome[] cold, Biome[] frost) { Biome[] add, int addRarity, Biome[] hot, Biome[] medium, Biome[] cold, Biome[] frost) {
this.biomes = new Biome[5 + hot.length + medium.length + cold.length + frost.length + add.length];
this.defBiome = this.biomes[GenLayer.NONE] = def;
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);
int n = 5;
for(Biome biome : frost) {
this.biomes[n++] = biome;
}
for(Biome biome : cold) {
this.biomes[n++] = biome;
}
for(Biome biome : medium) {
this.biomes[n++] = biome;
}
for(Biome biome : hot) {
this.biomes[n++] = biome;
}
for(Biome biome : add) {
this.biomes[n++] = biome;
}
for(int z = 0; z < this.biomes.length; z++) {
this.biomes[z].id = z;
}
GenLayer layer0t1 = new GenLayerBase(1L); GenLayer layer0t1 = new GenLayerBase(1L);
layer0t1 = new GenLayerFuzzyZoom(2000L, layer0t1); layer0t1 = new GenLayerFuzzyZoom(2000L, layer0t1);
GenLayerAddAreas layer2 = new GenLayerAddAreas(1L, layer0t1); GenLayerAddAreas layer2 = new GenLayerAddAreas(1L, layer0t1);
@ -85,25 +106,19 @@ public class BiomeGenerator {
GenLayerRiverInit layer20 = new GenLayerRiverInit(100L, layer19); GenLayerRiverInit layer20 = new GenLayerRiverInit(100L, layer19);
GenLayerBiome layer21n = new GenLayerBiome(200L, layer18, hot, medium, cold, frost, def, fixed); GenLayerBiome layer21n = new GenLayerBiome(200L, layer18, hot, medium, cold, frost, def, fixed);
GenLayer layer22n = GenLayerZoom.magnify(1000L, layer21n, 2); GenLayer layer22n = GenLayerZoom.magnify(1000L, layer21n, 2);
GenLayerBiomeEdge layer23n = new GenLayerBiomeEdge(this, 1000L, layer22n);
GenLayer layer21l = GenLayerZoom.magnify(1000L, layer20, 2);
GenLayer layer24n = new GenLayerHills(this, 1000L, layer23n, layer21l, def);
GenLayer layer21t22a = GenLayerZoom.magnify(1000L, layer20, 2); GenLayer layer21t22a = GenLayerZoom.magnify(1000L, layer20, 2);
layer21t22a = GenLayerZoom.magnify(1000L, layer21t22a, riverSize); layer21t22a = GenLayerZoom.magnify(1000L, layer21t22a, riverSize);
GenLayerRiver layer23a = new GenLayerRiver(1L, layer21t22a); GenLayerRiver layer23a = new GenLayerRiver(1L, layer21t22a);
GenLayerSmooth layer24a = new GenLayerSmooth(1000L, layer23a); GenLayerSmooth layer24a = new GenLayerSmooth(1000L, layer23a);
// layer24n = new GenLayerRareBiome(1001L, layer24n, biomeRarity); // layer24n = new GenLayerRareBiome(1001L, layer24n, biomeRarity);
for(int k = 0; k < biomeSize; ++k) { for(int k = 0; k < biomeSize; ++k) {
layer24n = new GenLayerZoom((long)(1000 + k), layer24n); layer22n = new GenLayerZoom((long)(1000 + k), layer22n);
if(k == 0) { if(k == 0) {
layer24n = new GenLayerAddAreas(3L, layer24n); layer22n = new GenLayerAddAreas(3L, layer22n);
}
if(k == 1 || biomeSize == 1) {
layer24n = new GenLayerShore(this, 1000L, layer24n);
} }
} }
GenLayerSmooth layer25n = new GenLayerSmooth(1000L, layer24n); GenLayerSmooth layer25n = new GenLayerSmooth(1000L, layer22n);
GenLayerRiverMix layerOut = new GenLayerRiverMix(100L, layer25n, layer24a, def); GenLayerRiverMix layerOut = new GenLayerRiverMix(100L, layer25n, layer24a, def, frost);
GenLayer layerIndex = // perlinGen ? new GenLayerRiverMix(100L, layer25n, layer24a) : GenLayer layerIndex = // perlinGen ? new GenLayerRiverMix(100L, layer25n, layer24a) :
new GenLayerVoronoiZoom(10L, layerOut); new GenLayerVoronoiZoom(10L, layerOut);
layerOut.initWorldGenSeed(seed); layerOut.initWorldGenSeed(seed);
@ -111,7 +126,6 @@ public class BiomeGenerator {
// return new GenLayer[] {layerOut, layerIndex}; // return new GenLayer[] {layerOut, layerIndex};
this.genBiomes = layerOut; this.genBiomes = layerOut;
this.biomeIndexLayer = layerIndex; this.biomeIndexLayer = layerIndex;
this.defBiome = def;
} }
private CacheBlock getBiomeCacheBlock(int x, int z) private CacheBlock getBiomeCacheBlock(int x, int z)
@ -156,16 +170,21 @@ public class BiomeGenerator {
} }
} }
public Biome getBiome(int id) private Biome getBiome(int id)
{ {
return id >= 0 && id < this.biomes.length ? this.biomes[id] : null; return id < 0 || id >= this.biomes.length || this.biomes[id] == null ? this.defBiome : this.biomes[id];
} }
public Biome getBiomeAt(BlockPos pos, Biome def) { public Biome getBiomeAt(BlockPos pos) {
int x = pos.getX(); int x = pos.getX();
int z = pos.getZ(); int z = pos.getZ();
Biome biome = this.getBiomeCacheBlock(x, z).getBiomeGenAt(x, z); Biome biome = this.getBiomeCacheBlock(x, z).getBiomeGenAt(x, z);
return biome == null ? def : biome; return biome == null ? this.defBiome : biome;
}
public Biome getBiomeAt(int x, int z) {
Biome biome = this.getBiomeCacheBlock(x, z).getBiomeGenAt(x, z);
return biome == null ? this.defBiome : biome;
} }
private void getFactors(double[] listToReuse, int x, int z, int width, int length) { private void getFactors(double[] listToReuse, int x, int z, int width, int length) {
@ -174,8 +193,7 @@ public class BiomeGenerator {
int[] aint = this.biomeIndexLayer.getInts(x, z, width, length); int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
for(int i = 0; i < width * length; ++i) { for(int i = 0; i < width * length; ++i) {
Biome biome = this.getBiome(aint[i]); listToReuse[i] = (double)this.getBiome(aint[i]).factor;
listToReuse[i] = biome == null ? 0.0 : (double)biome.factor;
} }
} }
@ -190,21 +208,20 @@ public class BiomeGenerator {
int[] aint = this.biomeIndexLayer.getInts(xPos, zPos, sizeX, sizeZ); int[] aint = this.biomeIndexLayer.getInts(xPos, zPos, sizeX, sizeZ);
for(int i = 0; i < sizeX * sizeZ; ++i) { for(int i = 0; i < sizeX * sizeZ; ++i) {
Biome biome = this.getBiome(aint[i]); factors[i] = (double)this.getBiome(aint[i]).factor;
factors[i] = biome == null ? 0.0 : (double)biome.factor;
} }
} }
} }
public void getGenBiomes(float[] depths, float[] scales, int x, int z, int width, int height) { public void genScaling(float[] depths, float[] scales, int x, int z, int width, int height) {
IntCache.resetIntCache(); IntCache.resetIntCache();
int[] aint = this.genBiomes.getInts(x, z, width, height); int[] aint = this.genBiomes.getInts(x, z, width, height);
for(int i = 0; i < width * height; ++i) { for(int i = 0; i < width * height; ++i) {
Biome biome = this.getBiome(aint[i]); Biome biome = this.getBiome(aint[i]);
depths[i] = biome == null ? 0.0f : biome.depth; depths[i] = biome.depth;
scales[i] = biome == null ? 0.0f : biome.scale; scales[i] = biome.scale;
} }
} }
@ -219,30 +236,8 @@ public class BiomeGenerator {
int[] aint = this.biomeIndexLayer.getInts(x, z, width, length); int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
for(int i = 0; i < width * length; ++i) { for(int i = 0; i < width * length; ++i) {
Biome biome = this.getBiome(aint[i]); listToReuse[i] = this.getBiome(aint[i]);
listToReuse[i] = biome == null ? this.defBiome : biome;
} }
} }
} }
public boolean areBiomesViable(int x, int z, int size, Set<Biome> allowed) {
IntCache.resetIntCache();
int i = x - size >> 2;
int j = z - size >> 2;
int k = x + size >> 2;
int l = z + size >> 2;
int i1 = k - i + 1;
int j1 = l - j + 1;
int[] aint = this.genBiomes.getInts(i, j, i1, j1);
for(int k1 = 0; k1 < i1 * j1; ++k1) {
Biome biome = this.getBiome(aint[k1]);
if(biome == null || !allowed.contains(biome.base)) {
return false;
}
}
return true;
}
} }

View file

@ -8,7 +8,6 @@ import common.util.BlockPos;
import common.world.LightType; import common.world.LightType;
import common.world.State; import common.world.State;
import server.world.WorldServer; import server.world.WorldServer;
import server.worldgen.biome.GenBiome;
public class FeatureLakes public class FeatureLakes
{ {

View file

@ -2,7 +2,6 @@ package server.worldgen;
import java.util.Arrays; import java.util.Arrays;
import common.biome.Biome;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.rng.NoiseGen; import common.rng.NoiseGen;
import common.rng.OctaveGen; import common.rng.OctaveGen;
@ -10,7 +9,6 @@ import common.rng.Random;
import common.util.ExtMath; import common.util.ExtMath;
import common.world.State; import common.world.State;
import server.world.WorldServer; import server.world.WorldServer;
import server.worldgen.biome.GenBiome;
public class GeneratorPerlin implements ChunkGenerator public class GeneratorPerlin implements ChunkGenerator
{ {
@ -119,7 +117,7 @@ public class GeneratorPerlin implements ChunkGenerator
{ {
int sea = world.getSeaLevel(); int sea = world.getSeaLevel();
if(world.getBiomeGenerator() != null) if(world.getBiomeGenerator() != null)
world.getBiomeGenerator().getGenBiomes(this.depths, this.scales, x * 4 - 2, z * 4 - 2, 10, 10); world.getBiomeGenerator().genScaling(this.depths, this.scales, x * 4 - 2, z * 4 - 2, 10, 10);
this.genNoisemap(x * 4, 0, z * 4); this.genNoisemap(x * 4, 0, z * 4);
for (int xb = 0; xb < 4; ++xb) for (int xb = 0; xb < 4; ++xb)

View file

@ -7,7 +7,6 @@ import common.rng.OctaveGen;
import common.rng.Random; import common.rng.Random;
import common.world.State; import common.world.State;
import server.world.WorldServer; import server.world.WorldServer;
import server.worldgen.biome.GenBiome;
public class ReplacerAltBiome implements BlockReplacer public class ReplacerAltBiome implements BlockReplacer
{ {

View file

@ -15,11 +15,10 @@ public class ReplacerMesa extends ReplacerBiome
private final PerlinGen baseBryceGen; private final PerlinGen baseBryceGen;
private final PerlinGen highBryceGen; private final PerlinGen highBryceGen;
private final PerlinGen clayColorGen; private final PerlinGen clayColorGen;
private final PerlinGen soilGen;
private final PerlinGen peakGen;
private final State surface; private final State surface;
private boolean bryce;
private boolean soil;
public ReplacerMesa(Random rand, State filler, State liquid, int seaLevel, State surface) { public ReplacerMesa(Random rand, State filler, State liquid, int seaLevel, State surface) {
super(rand, filler, liquid, seaLevel); super(rand, filler, liquid, seaLevel);
this.layers = new State[64]; this.layers = new State[64];
@ -27,6 +26,8 @@ public class ReplacerMesa extends ReplacerBiome
this.clayColorGen = new PerlinGen(rand, 1); this.clayColorGen = new PerlinGen(rand, 1);
this.baseBryceGen = new PerlinGen(rand, 4); this.baseBryceGen = new PerlinGen(rand, 4);
this.highBryceGen = new PerlinGen(rand, 1); this.highBryceGen = new PerlinGen(rand, 1);
this.soilGen = new PerlinGen(rand, 8);
this.peakGen = new PerlinGen(rand, 8);
this.setupLayers(rand); this.setupLayers(rand);
this.surface = surface; this.surface = surface;
} }
@ -39,9 +40,12 @@ public class ReplacerMesa extends ReplacerBiome
public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise) public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise)
{ {
boolean soil = this.soilGen.generate((double)x * 0.5D, (double)z * 0.5D) > 0.1;
boolean peak = this.peakGen.generate((double)x * 0.5D, (double)z * 0.5D) > 0.1;
double d4 = 0.0D; double d4 = 0.0D;
if (this.bryce) if (peak)
{ {
int i = (x & -16) + (z & 15); int i = (x & -16) + (z & 15);
int j = (z & -16) + (x & 15); int j = (z & -16) + (x & 15);
@ -118,7 +122,7 @@ public class ReplacerMesa extends ReplacerBiome
primer.set(by, i1, bx, Blocks.orange_clay.getState()); primer.set(by, i1, bx, Blocks.orange_clay.getState());
} }
} }
else if (this.soil && i1 > 86 + rng * 2) else if (soil && i1 > 86 + rng * 2)
{ {
if (hard) if (hard)
{ {

View file

@ -4,25 +4,14 @@ import common.block.foliage.BlockLilyPad;
import common.init.Blocks; import common.init.Blocks;
import common.rng.PerlinGen; import common.rng.PerlinGen;
import common.rng.Random; import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing; import common.util.Facing;
import common.world.State; import common.world.State;
import common.world.World;
import server.world.WorldServer; import server.world.WorldServer;
public class ReplacerTerranian extends ReplacerAltSimple { public class ReplacerTerranian extends ReplacerAltSimple {
private final PerlinGen grassNoiseGen; private final PerlinGen grassNoiseGen;
private final State dry; private final State dry;
private boolean stone; // hills*
private boolean gravel; // hills_mod*
private boolean podzol; // mega_taiga*
private boolean savanna; // savanna_mod*
private boolean swamp; // swamp*
private boolean sand; // beach*, desert*
private boolean fullStone; // stonebeach*
private boolean snow; // ice_spikes
public ReplacerTerranian(Random rand, State surface, State top, State filler, State alt, State dry, State liquid, int seaLevel) { public ReplacerTerranian(Random rand, State surface, State top, State filler, State alt, State dry, State liquid, int seaLevel) {
super(rand, surface, top, filler, alt, liquid, seaLevel); super(rand, surface, top, filler, alt, liquid, seaLevel);
this.grassNoiseGen = new PerlinGen(rand, 1); this.grassNoiseGen = new PerlinGen(rand, 1);
@ -35,44 +24,17 @@ public class ReplacerTerranian extends ReplacerAltSimple {
public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise) public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise)
{ {
float absTemp = world.getTemperatureC(new BlockPos(x, 0, z)); float absTemp = world.getGenTemperature(x, z);
float humidity = world.getGenHumidity(x, z);
State topBlock = this.surface; State topBlock = this.surface;
State fillerBlock = this.top; State fillerBlock = this.top;
if(this.sand) { if(absTemp >= 50.0f) {
topBlock = this.dry; topBlock = this.dry;
fillerBlock = this.dry; fillerBlock = this.dry;
} }
else if(this.fullStone) { else if(absTemp >= 38.0f && humidity < 50.0f) {
topBlock = this.filler;
fillerBlock = this.filler;
}
else if(this.snow) {
topBlock = Blocks.snow.getState();
}
if (this.gravel && (noise < -1.0D || noise > 2.0D))
{
topBlock = this.alt;
fillerBlock = this.alt;
}
else if (this.stone && noise > 1.0D)
{
topBlock = this.filler;
fillerBlock = this.filler;
}
if (this.podzol)
{
if (noise > 1.75D)
{
topBlock = Blocks.coarse_dirt.getState();
}
else if (noise > -0.95D)
{
topBlock = Blocks.podzol.getState();
}
}
if(this.savanna) {
if (noise > 1.75D) if (noise > 1.75D)
{ {
topBlock = this.filler; topBlock = this.filler;
@ -83,7 +45,34 @@ public class ReplacerTerranian extends ReplacerAltSimple {
topBlock = Blocks.coarse_dirt.getState(); topBlock = Blocks.coarse_dirt.getState();
} }
} }
if(this.swamp) { else if(absTemp <= 10.0f && humidity <= 10.0f) {
topBlock = this.filler;
fillerBlock = this.filler;
}
else if(absTemp <= 10.0f && humidity < 60.0f) {
if (noise < -1.0D || noise > 2.0D)
{
topBlock = this.alt;
fillerBlock = this.alt;
}
else if (humidity < 40.0f && noise > 1.0D)
{
topBlock = this.filler;
fillerBlock = this.filler;
}
}
else if (absTemp >= 25.0f && humidity >= 70.0f)
{
if (noise > 1.75D)
{
topBlock = Blocks.coarse_dirt.getState();
}
else if (noise > -0.95D)
{
topBlock = Blocks.podzol.getState();
}
}
else if(absTemp < 22.0f && humidity >= 65.0f) {
topBlock = Blocks.swamp.getState(); topBlock = Blocks.swamp.getState();
int sea = world.getSeaLevel() - 1; int sea = world.getSeaLevel() - 1;
double d0 = grassNoiseGen.generate((double)x * 0.25D, (double)z * 0.25D); double d0 = grassNoiseGen.generate((double)x * 0.25D, (double)z * 0.25D);

View file

@ -1,7 +0,0 @@
package server.worldgen.biome;
import common.biome.Biome;
import common.log.Log;
public class GenBiome extends Biome {
}

View file

@ -1,29 +1,19 @@
package server.worldgen.layer; package server.worldgen.layer;
import common.biome.Biome;
import server.worldgen.BiomeGenerator;
public abstract class GenLayer { public abstract class GenLayer {
protected BiomeGenerator generator; 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;
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 boolean canBeNearby(int id1, int id2) {
if(id1 == id2) {
return true;
}
else {
Biome biome1 = this.generator.getBiome(id1);
Biome biome2 = this.generator.getBiome(id2);
return biome1 != null && biome2 != null ? biome1.isEqualTo(biome2) : false;
}
}
protected static boolean isSea(int id) { protected static boolean isSea(int id) {
return id == Biome.SEA.id || id == Biome.ICE_SEA.id; return id == SEA || id == ICE_SEA;
} }
public GenLayer(long base) { public GenLayer(long base) {

View file

@ -1,7 +1,5 @@
package server.worldgen.layer; package server.worldgen.layer;
import common.biome.Biome;
public class GenLayerAddSea extends GenLayer public class GenLayerAddSea extends GenLayer
{ {
private final int rarity; private final int rarity;
@ -60,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 ? Biome.ICE_SEA.id : Biome.SEA.id; aint1[j1 + i1 * areaWidth] = l2 > 1 ? ICE_SEA : SEA;
} }
else else
{ {

View file

@ -1,170 +0,0 @@
package server.worldgen.layer;
import common.biome.Biome;
import common.biome.Temperature;
import server.worldgen.BiomeGenerator;
import server.worldgen.biome.GenBiome;
public class GenLayerBiomeEdge extends GenLayer
{
public GenLayerBiomeEdge(BiomeGenerator gen, long p_i45475_1_, GenLayer p_i45475_3_)
{
super(p_i45475_1_);
this.parent = p_i45475_3_;
this.generator = gen;
}
/**
* 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[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight);
for (int i = 0; i < areaHeight; ++i)
{
for (int j = 0; j < areaWidth; ++j)
{
this.initChunkSeed((long)(j + areaX), (long)(i + areaY));
int k = aint[j + 1 + (i + 1) * (areaWidth + 2)];
if (!this.replaceBiomeEdgeIfNecessary(aint, aint1, j, i, areaWidth, k, Biome.HILLS.id, Biome.HILLS_EDGE.id) && /* !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.mesaPlateau_F.id, Biome.mesa.id) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.mesaPlateau.id, Biome.mesa.id) && */ !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.LARGE_TAIGA.id, Biome.TAIGA.id))
{
if (k == Biome.DESERT.id)
{
int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
int i2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
int j2 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
int k2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];
if (l1 != Biome.ICE.id && i2 != Biome.ICE.id && j2 != Biome.ICE.id && k2 != Biome.ICE.id)
{
aint1[j + i * areaWidth] = k;
}
else
{
aint1[j + i * areaWidth] = Biome.LARGE_HILLS.id;
}
}
else if (k == Biome.SWAMP.id)
{
int l = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
int i1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
int j1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
int k1 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];
if (l != Biome.DESERT.id && i1 != Biome.DESERT.id && j1 != Biome.DESERT.id && k1 != Biome.DESERT.id && l != Biome.ICE_TAIGA.id && i1 != Biome.ICE_TAIGA.id && j1 != Biome.ICE_TAIGA.id && k1 != Biome.ICE_TAIGA.id && l != Biome.ICE.id && i1 != Biome.ICE.id && j1 != Biome.ICE.id && k1 != Biome.ICE.id)
{
if (l != Biome.TROPIC.id && k1 != Biome.TROPIC.id && i1 != Biome.TROPIC.id && j1 != Biome.TROPIC.id)
{
aint1[j + i * areaWidth] = k;
}
else
{
aint1[j + i * areaWidth] = Biome.TROPIC_EDGE.id;
}
}
else
{
aint1[j + i * areaWidth] = Biome.PLAIN.id;
}
}
else
{
aint1[j + i * areaWidth] = k;
}
}
}
}
return aint1;
}
/**
* Creates a border around a biome if necessary, e.g. A transition from hot to cold climates would otherwise occur.
*/
private boolean replaceBiomeEdgeIfNecessary(int[] p_151636_1_, int[] p_151636_2_, int p_151636_3_, int p_151636_4_, int p_151636_5_, int p_151636_6_, int p_151636_7_, int p_151636_8_)
{
if (!canBeNearby(p_151636_6_, p_151636_7_))
{
return false;
}
else
{
int i = p_151636_1_[p_151636_3_ + 1 + (p_151636_4_ + 1 - 1) * (p_151636_5_ + 2)];
int j = p_151636_1_[p_151636_3_ + 1 + 1 + (p_151636_4_ + 1) * (p_151636_5_ + 2)];
int k = p_151636_1_[p_151636_3_ + 1 - 1 + (p_151636_4_ + 1) * (p_151636_5_ + 2)];
int l = p_151636_1_[p_151636_3_ + 1 + (p_151636_4_ + 1 + 1) * (p_151636_5_ + 2)];
if (this.canBiomesBeNeighbors(i, p_151636_7_) && this.canBiomesBeNeighbors(j, p_151636_7_) && this.canBiomesBeNeighbors(k, p_151636_7_) && this.canBiomesBeNeighbors(l, p_151636_7_))
{
p_151636_2_[p_151636_3_ + p_151636_4_ * p_151636_5_] = p_151636_6_;
}
else
{
p_151636_2_[p_151636_3_ + p_151636_4_ * p_151636_5_] = p_151636_8_;
}
return true;
}
}
/**
* Creates a border around a biome.
*/
private boolean replaceBiomeEdge(int[] p_151635_1_, int[] p_151635_2_, int p_151635_3_, int p_151635_4_, int p_151635_5_, int p_151635_6_, int p_151635_7_, int p_151635_8_)
{
if (p_151635_6_ != p_151635_7_)
{
return false;
}
else
{
int i = p_151635_1_[p_151635_3_ + 1 + (p_151635_4_ + 1 - 1) * (p_151635_5_ + 2)];
int j = p_151635_1_[p_151635_3_ + 1 + 1 + (p_151635_4_ + 1) * (p_151635_5_ + 2)];
int k = p_151635_1_[p_151635_3_ + 1 - 1 + (p_151635_4_ + 1) * (p_151635_5_ + 2)];
int l = p_151635_1_[p_151635_3_ + 1 + (p_151635_4_ + 1 + 1) * (p_151635_5_ + 2)];
if (canBeNearby(i, p_151635_7_) && canBeNearby(j, p_151635_7_) && canBeNearby(k, p_151635_7_) && canBeNearby(l, p_151635_7_))
{
p_151635_2_[p_151635_3_ + p_151635_4_ * p_151635_5_] = p_151635_6_;
}
else
{
p_151635_2_[p_151635_3_ + p_151635_4_ * p_151635_5_] = p_151635_8_;
}
return true;
}
}
/**
* Returns if two biomes can logically be neighbors. If one is hot and the other cold, for example, it returns
* false.
*/
private boolean canBiomesBeNeighbors(int p_151634_1_, int p_151634_2_)
{
if (canBeNearby(p_151634_1_, p_151634_2_))
{
return true;
}
else
{
Biome biomegenbase = this.generator.getBiome(p_151634_1_);
Biome biomegenbase1 = this.generator.getBiome(p_151634_2_);
if (biomegenbase != null && biomegenbase1 != null)
{
Temperature biomegenbase$tempcategory = biomegenbase.category;
Temperature biomegenbase$tempcategory1 = biomegenbase1.category;
return biomegenbase$tempcategory == biomegenbase$tempcategory1 || biomegenbase$tempcategory == Temperature.MEDIUM || biomegenbase$tempcategory1 == Temperature.MEDIUM;
}
else
{
return false;
}
}
}
}

View file

@ -1,202 +0,0 @@
package server.worldgen.layer;
import common.biome.Biome;
import common.log.Log;
import server.worldgen.BiomeGenerator;
public class GenLayerHills extends GenLayer
{
private GenLayer field_151628_d;
private final int def;
public GenLayerHills(BiomeGenerator gen, long p_i45479_1_, GenLayer p_i45479_3_, GenLayer p_i45479_4_, Biome def)
{
super(p_i45479_1_);
this.parent = p_i45479_3_;
this.field_151628_d = p_i45479_4_;
this.def = def.id;
this.generator = gen;
}
/**
* 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[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
int[] aint1 = this.field_151628_d.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight);
for (int i = 0; i < areaHeight; ++i)
{
for (int j = 0; j < areaWidth; ++j)
{
this.initChunkSeed((long)(j + areaX), (long)(i + areaY));
int k = aint[j + 1 + (i + 1) * (areaWidth + 2)];
int l = aint1[j + 1 + (i + 1) * (areaWidth + 2)];
boolean flag = (l - 2) % 29 == 0;
if (k > 255)
{
Log.TICK.warn("Altes Biom (" + k + ")!");
}
if (k != 0 && l >= 2 && (l - 2) % 29 == 1 && k < 128)
{
Biome gb = this.generator.getBiome(k);
if (gb != null && gb.mutated != null)
{
aint2[j + i * areaWidth] = gb.mutated.id;
}
else
{
aint2[j + i * areaWidth] = k;
}
}
else if (this.nextInt(3) != 0 && !flag)
{
aint2[j + i * areaWidth] = k;
}
else
{
int i1 = k;
if (k == Biome.DESERT.id)
{
i1 = Biome.DESERT_HILLS.id;
}
else if (k == Biome.FOREST.id)
{
i1 = Biome.FOREST_HILLS.id;
}
else if (k == Biome.BIRCH_FOREST.id)
{
i1 = Biome.BIRCH_HILLS.id;
}
else if (k == Biome.DARK_FOREST.id)
{
i1 = Biome.PLAIN.id;
}
else if (k == Biome.TAIGA.id)
{
i1 = Biome.TAIGA_HILLS.id;
}
else if (k == Biome.LARGE_TAIGA.id)
{
i1 = Biome.LARGE_TAIGA_HILLS.id;
}
else if (k == Biome.ICE_TAIGA.id)
{
i1 = Biome.ICE_TAIGA_HILLS.id;
}
else if (k == Biome.PLAIN.id)
{
if (this.nextInt(3) == 0)
{
i1 = Biome.FOREST_HILLS.id;
}
else
{
i1 = Biome.FOREST.id;
}
}
else if (k == Biome.ICE.id)
{
i1 = Biome.ICE_HILLS.id;
}
else if (k == Biome.TROPIC.id)
{
i1 = Biome.TROPIC_HILLS.id;
}
else if (k == Biome.NONE.id)
{
i1 = this.def;
}
else if (k == Biome.HILLS.id)
{
i1 = Biome.LARGE_HILLS.id;
}
else if (k == Biome.SAVANNA.id)
{
i1 = Biome.SAVANNA_PLATEAU.id;
}
// else if (canBeNearby(k, Biome.mesaPlateau_F.id))
// {
// i1 = Biome.mesa.id;
// }
else if (k == Biome.SEA.id && this.nextInt(3) == 0)
{
int j1 = this.nextInt(2);
if (j1 == 0)
{
i1 = Biome.PLAIN.id;
}
else
{
i1 = Biome.FOREST.id;
}
}
if (flag && i1 != k)
{
Biome gb = this.generator.getBiome(i1);
if (gb != null && gb.mutated != null)
{
i1 = gb.mutated.id;
}
else
{
i1 = k;
}
}
if (i1 == k)
{
aint2[j + i * areaWidth] = k;
}
else
{
int k2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
int k1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
int l1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
int i2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];
int j2 = 0;
if (canBeNearby(k2, k))
{
++j2;
}
if (canBeNearby(k1, k))
{
++j2;
}
if (canBeNearby(l1, k))
{
++j2;
}
if (canBeNearby(i2, k))
{
++j2;
}
if (j2 >= 3)
{
aint2[j + i * areaWidth] = i1;
}
else
{
aint2[j + i * areaWidth] = k;
}
}
}
}
}
return aint2;
}
}

View file

@ -1,7 +1,5 @@
package server.worldgen.layer; package server.worldgen.layer;
import common.biome.Biome;
public class GenLayerRiver extends GenLayer public class GenLayerRiver extends GenLayer
{ {
public GenLayerRiver(long p_i2128_1_, GenLayer p_i2128_3_) public GenLayerRiver(long p_i2128_1_, GenLayer p_i2128_3_)
@ -39,7 +37,7 @@ public class GenLayerRiver extends GenLayer
} }
else else
{ {
aint1[j1 + i1 * areaWidth] = Biome.RIVER.id; aint1[j1 + i1 * areaWidth] = RIVER;
} }
} }
} }

View file

@ -1,19 +1,26 @@
package server.worldgen.layer; package server.worldgen.layer;
import java.util.Set;
import common.biome.Biome; import common.biome.Biome;
import common.collect.Sets;
public class GenLayerRiverMix extends GenLayer public class GenLayerRiverMix extends GenLayer
{ {
private GenLayer biomePatternGeneratorChain; private GenLayer biomePatternGeneratorChain;
private GenLayer riverPatternGeneratorChain; private GenLayer riverPatternGeneratorChain;
private final int def; private final int def;
private final Set<Integer> freeze = Sets.newHashSet();
public GenLayerRiverMix(long p_i2129_1_, GenLayer p_i2129_3_, GenLayer p_i2129_4_, Biome def) public GenLayerRiverMix(long p_i2129_1_, GenLayer p_i2129_3_, GenLayer p_i2129_4_, Biome def, Biome[] freeze)
{ {
super(p_i2129_1_); super(p_i2129_1_);
this.biomePatternGeneratorChain = p_i2129_3_; this.biomePatternGeneratorChain = p_i2129_3_;
this.riverPatternGeneratorChain = p_i2129_4_; this.riverPatternGeneratorChain = p_i2129_4_;
this.def = def.id; this.def = def.id;
for(Biome biome : freeze) {
this.freeze.add(biome.id);
}
} }
/** /**
@ -39,23 +46,23 @@ public class GenLayerRiverMix extends GenLayer
for (int i = 0; i < areaWidth * areaHeight; ++i) for (int i = 0; i < areaWidth * areaHeight; ++i)
{ {
if(biome[i] == Biome.NONE.id) if(biome[i] == NONE)
{ {
out[i] = this.def; out[i] = this.def;
} }
else if(biome[i] == Biome.SEA.id || biome[i] == Biome.ICE_SEA.id) else if(biome[i] == SEA || biome[i] == ICE_SEA)
{ {
out[i] = biome[i]; out[i] = biome[i];
} }
else if (river[i] == Biome.RIVER.id) else if (river[i] == RIVER)
{ {
if (biome[i] == Biome.ICE.id) if (this.freeze.contains(biome[i]))
{ {
out[i] = Biome.ICE_RIVER.id; out[i] = ICE_RIVER;
} }
else // if (biome[i] != Biome.mushroomPlains.id && biome[i] != Biome.mushroomPlainsEdge.id) else // if (biome[i] != Biome.mushroomPlains.id && biome[i] != Biome.mushroomPlainsEdge.id)
{ {
out[i] = Biome.RIVER.id; out[i] = RIVER;
} }
// else // else
// { // {

View file

@ -1,118 +0,0 @@
package server.worldgen.layer;
import common.biome.Biome;
import server.worldgen.BiomeGenerator;
import server.worldgen.biome.GenBiome;
public class GenLayerShore extends GenLayer
{
public GenLayerShore(BiomeGenerator gen, long base, GenLayer parent)
{
super(base);
this.parent = parent;
this.generator = gen;
}
public int[] getInts(int x, int z, int width, int height)
{
int[] pre = this.parent.getInts(x - 1, z - 1, width + 2, height + 2);
int[] data = IntCache.getIntCache(width * height);
for (int i = 0; i < height; ++i)
{
for (int j = 0; j < width; ++j)
{
this.initChunkSeed((long)(j + x), (long)(i + z));
int id = pre[j + 1 + (i + 1) * (width + 2)];
Biome biome = this.generator.getBiome(id);
if (biome != null && biome.tropical)
{
int i2 = pre[j + 1 + (i + 1 - 1) * (width + 2)];
int l2 = pre[j + 1 + 1 + (i + 1) * (width + 2)];
int k3 = pre[j + 1 - 1 + (i + 1) * (width + 2)];
int j4 = pre[j + 1 + (i + 1 + 1) * (width + 2)];
if (this.canPlaceTropical(i2) && this.canPlaceTropical(l2) && this.canPlaceTropical(k3) && this.canPlaceTropical(j4))
{
if (!isSea(i2) && !isSea(l2) && !isSea(k3) && !isSea(j4))
{
data[j + i * width] = id;
}
else
{
data[j + i * width] = Biome.BEACH.id;
}
}
else
{
data[j + i * width] = Biome.TROPIC_EDGE.id;
}
}
else if (id != Biome.HILLS.id && id != Biome.LARGE_HILLS.id && id != Biome.HILLS_EDGE.id)
{
if (biome != null && biome.allowColdBeach)
{
this.putBeach(pre, data, j, i, width, id, Biome.ICE_BEACH.id);
}
else if (biome != null && !biome.disallowBeach)
{
int l1 = pre[j + 1 + (i + 1 - 1) * (width + 2)];
int k2 = pre[j + 1 + 1 + (i + 1) * (width + 2)];
int j3 = pre[j + 1 - 1 + (i + 1) * (width + 2)];
int i4 = pre[j + 1 + (i + 1 + 1) * (width + 2)];
if (!isSea(l1) && !isSea(k2) && !isSea(j3) && !isSea(i4))
{
data[j + i * width] = id;
}
else
{
data[j + i * width] = Biome.BEACH.id;
}
}
else
{
data[j + i * width] = id;
}
}
else
{
this.putBeach(pre, data, j, i, width, id, Biome.STONE_BEACH.id);
}
}
}
return data;
}
private void putBeach(int[] pre, int[] data, int x, int z, int width, int biome, int beach)
{
if (isSea(biome))
{
data[x + z * width] = biome;
}
else
{
int i = pre[x + 1 + (z + 1 - 1) * (width + 2)];
int j = pre[x + 1 + 1 + (z + 1) * (width + 2)];
int k = pre[x + 1 - 1 + (z + 1) * (width + 2)];
int l = pre[x + 1 + (z + 1 + 1) * (width + 2)];
if (!isSea(i) && !isSea(j) && !isSea(k) && !isSea(l))
{
data[x + z * width] = biome;
}
else
{
data[x + z * width] = beach;
}
}
}
private boolean canPlaceTropical(int id)
{
Biome biome = this.generator.getBiome(id);
return (biome != null && biome.tropical) || id == Biome.TROPIC_EDGE.id || id == Biome.TROPIC.id || id == Biome.TROPIC_HILLS.id || id == Biome.FOREST.id || id == Biome.TAIGA.id || isSea(id);
}
}

View file

@ -10,7 +10,6 @@ import server.world.WorldServer;
public class MapGenScatteredFeature extends MapGenStructure public class MapGenScatteredFeature extends MapGenStructure
{ {
private static final List<Biome> biomelist = Arrays.<Biome>asList(Biome.DESERT, Biome.DESERT_HILLS, Biome.TROPIC, Biome.TROPIC_HILLS, Biome.SWAMP);
private static final int MAX_DISTANCE = 32; private static final int MAX_DISTANCE = 32;
private static final int MIN_DISTANCE = 8; private static final int MIN_DISTANCE = 8;
@ -42,22 +41,9 @@ public class MapGenScatteredFeature extends MapGenStructure
k = k + random.zrange(MapGenScatteredFeature.MAX_DISTANCE - MapGenScatteredFeature.MIN_DISTANCE); k = k + random.zrange(MapGenScatteredFeature.MAX_DISTANCE - MapGenScatteredFeature.MIN_DISTANCE);
l = l + random.zrange(MapGenScatteredFeature.MAX_DISTANCE - MapGenScatteredFeature.MIN_DISTANCE); l = l + random.zrange(MapGenScatteredFeature.MAX_DISTANCE - MapGenScatteredFeature.MIN_DISTANCE);
if (i == k && j == l && this.worldObj.getBiomeGenerator() != null) if (i == k && j == l)
{ {
Biome biomegenbase = this.worldObj.getBiomeGenerator().getBiomeAt(new BlockPos(i * 16 + 8, 0, j * 16 + 8), null); return true;
if (biomegenbase == null)
{
return false;
}
for (Biome biomegenbase1 : biomelist)
{
if (biomegenbase == biomegenbase1)
{
return true;
}
}
} }
return false; return false;
@ -92,20 +78,16 @@ public class MapGenScatteredFeature extends MapGenStructure
public Start(WorldServer worldIn, Random p_i2060_2_, int p_i2060_3_, int p_i2060_4_) public Start(WorldServer worldIn, Random p_i2060_2_, int p_i2060_3_, int p_i2060_4_)
{ {
super(p_i2060_3_, p_i2060_4_); super(p_i2060_3_, p_i2060_4_);
Biome biomegenbase = worldIn.getBiomeGenerator().getBiomeAt(new BlockPos(p_i2060_3_ * 16 + 8, 0, p_i2060_4_ * 16 + 8), null); float temp = worldIn.getGenTemperature(p_i2060_3_ * 16 + 8, p_i2060_4_ * 16 + 8);
if (biomegenbase != Biome.TROPIC && biomegenbase != Biome.TROPIC_HILLS) if(temp >= 40.0f) {
StructureScattered.DesertPyramid componentscatteredfeaturepieces$desertpyramid = new StructureScattered.DesertPyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
this.components.add(componentscatteredfeaturepieces$desertpyramid);
}
else if (temp < 30.0f)
{ {
if (biomegenbase == Biome.SWAMP) StructureScattered.SwampHut componentscatteredfeaturepieces$swamphut = new StructureScattered.SwampHut(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
{ this.components.add(componentscatteredfeaturepieces$swamphut);
StructureScattered.SwampHut componentscatteredfeaturepieces$swamphut = new StructureScattered.SwampHut(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
this.components.add(componentscatteredfeaturepieces$swamphut);
}
else if (biomegenbase == Biome.DESERT || biomegenbase == Biome.DESERT_HILLS)
{
StructureScattered.DesertPyramid componentscatteredfeaturepieces$desertpyramid = new StructureScattered.DesertPyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
this.components.add(componentscatteredfeaturepieces$desertpyramid);
}
} }
else else
{ {

View file

@ -11,8 +11,6 @@ import server.world.WorldServer;
public class MapGenVillage extends MapGenStructure public class MapGenVillage extends MapGenStructure
{ {
public static final Set<Biome> villageSpawnBiomes = Sets.<Biome>newHashSet(Biome.PLAIN, Biome.DESERT, Biome.SAVANNA);
/** World terrain type, 0 for normal, 1 for flat map */ /** World terrain type, 0 for normal, 1 for flat map */
private int terrainType; private int terrainType;
private int distance; private int distance;
@ -69,14 +67,9 @@ public class MapGenVillage extends MapGenStructure
k = k + random.zrange(this.distance - this.field_82666_h); k = k + random.zrange(this.distance - this.field_82666_h);
l = l + random.zrange(this.distance - this.field_82666_h); l = l + random.zrange(this.distance - this.field_82666_h);
if (i == k && j == l && this.worldObj.getBiomeGenerator() != null) if (i == k && j == l)
{ {
boolean flag = this.worldObj.getBiomeGenerator().areBiomesViable(i * 16 + 8, j * 16 + 8, 0, villageSpawnBiomes); return true;
if (flag)
{
return true;
}
} }
return false; return false;
@ -99,7 +92,7 @@ public class MapGenVillage extends MapGenStructure
{ {
super(x, z); super(x, z);
List<StructureVillage.PieceWeight> list = StructureVillage.getStructureVillageWeightedPieceList(rand, size); List<StructureVillage.PieceWeight> list = StructureVillage.getStructureVillageWeightedPieceList(rand, size);
StructureVillage.Start structurevillagepieces$start = new StructureVillage.Start(worldIn.getBiomeGenerator(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, size); StructureVillage.Start structurevillagepieces$start = new StructureVillage.Start(worldIn, 0, rand, (x << 4) + 2, (z << 4) + 2, list, size);
this.components.add(structurevillagepieces$start); this.components.add(structurevillagepieces$start);
structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand); structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand);
List<StructureComponent> list1 = structurevillagepieces$start.field_74930_j; List<StructureComponent> list1 = structurevillagepieces$start.field_74930_j;

View file

@ -216,12 +216,9 @@ public class StructureVillage
int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ; int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ;
int i1 = k > l ? k : l; int i1 = k > l ? k : l;
if (start.getBiomeGenerator().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes)) p_176066_1_.add(structurecomponent);
{ start.field_74932_i.add(structurecomponent);
p_176066_1_.add(structurecomponent); return structurecomponent;
start.field_74932_i.add(structurecomponent);
return structurecomponent;
}
} }
return null; return null;
@ -251,12 +248,9 @@ public class StructureVillage
int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ; int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ;
int i1 = k > l ? k : l; int i1 = k > l ? k : l;
if (start.getBiomeGenerator().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes)) p_176069_1_.add(structurecomponent);
{ start.field_74930_j.add(structurecomponent);
p_176069_1_.add(structurecomponent); return structurecomponent;
start.field_74930_j.add(structurecomponent);
return structurecomponent;
}
} }
return null; return null;
@ -1411,7 +1405,6 @@ public class StructureVillage
public static class Start extends StructureVillage.Well public static class Start extends StructureVillage.Well
{ {
public BiomeGenerator biomeGen;
public boolean inDesert; public boolean inDesert;
public int terrainType; public int terrainType;
public StructureVillage.PieceWeight structVillagePieceWeight; public StructureVillage.PieceWeight structVillagePieceWeight;
@ -1423,21 +1416,14 @@ public class StructureVillage
{ {
} }
public Start(BiomeGenerator genIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillage.PieceWeight> p_i2104_6_, int p_i2104_7_) public Start(WorldServer genIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillage.PieceWeight> p_i2104_6_, int p_i2104_7_)
{ {
super((StructureVillage.Start)null, 0, rand, p_i2104_4_, p_i2104_5_); super((StructureVillage.Start)null, 0, rand, p_i2104_4_, p_i2104_5_);
this.biomeGen = genIn;
this.structureVillageWeightedPieceList = p_i2104_6_; this.structureVillageWeightedPieceList = p_i2104_6_;
this.terrainType = p_i2104_7_; this.terrainType = p_i2104_7_;
Biome biomegenbase = genIn.getBiomeAt(new BlockPos(p_i2104_4_, 0, p_i2104_5_), null); this.inDesert = genIn.getGenTemperature(p_i2104_4_, p_i2104_5_) >= 40.0f;
this.inDesert = biomegenbase == Biome.DESERT || biomegenbase == Biome.DESERT_HILLS;
this.func_175846_a(this.inDesert); this.func_175846_a(this.inDesert);
} }
public BiomeGenerator getBiomeGenerator()
{
return this.biomeGen;
}
} }
public static class Torch extends StructureVillage.Village public static class Torch extends StructureVillage.Village