fix terra gen
This commit is contained in:
parent
e1c75f577d
commit
cef99a063a
19 changed files with 68 additions and 50 deletions
|
@ -55,7 +55,6 @@ import common.inventory.InventoryBasic;
|
|||
import common.inventory.InventoryPlayer;
|
||||
import common.inventory.InventoryWarpChest;
|
||||
import common.item.ItemStack;
|
||||
import common.item.material.ItemDye;
|
||||
import common.item.material.ItemGrindedBones;
|
||||
import common.log.Log;
|
||||
import common.network.IClientPlayer;
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BlockBush extends Block
|
|||
*/
|
||||
protected boolean canPlaceBlockOn(Block ground)
|
||||
{
|
||||
return ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.farmland || ground == Blocks.tian_soil;
|
||||
return ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.coarse_dirt || ground == Blocks.podzol || ground == Blocks.farmland || ground == Blocks.tian_soil;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -71,9 +71,9 @@ import server.worldgen.caves.MapGenBigCaves;
|
|||
import server.worldgen.caves.MapGenCaves;
|
||||
import server.worldgen.caves.MapGenRavine;
|
||||
import server.worldgen.populator.PopulatorAsteroids;
|
||||
import server.worldgen.populator.PopulatorBiome;
|
||||
import server.worldgen.populator.PopulatorBlackened;
|
||||
import server.worldgen.populator.PopulatorChaos;
|
||||
import server.worldgen.populator.PopulatorDefault;
|
||||
import server.worldgen.populator.PopulatorForest;
|
||||
import server.worldgen.populator.PopulatorHell;
|
||||
import server.worldgen.populator.PopulatorMesa;
|
||||
|
@ -512,7 +512,7 @@ public abstract class UniverseRegistry extends DimensionRegistry {
|
|||
registerPlanet("Terra", new Planet(6378136, 8766144L, 24000L, 28.0f, 9.81f, 259.15f, Blocks.stone.getState(), Blocks.water.getState(), 63), new GeneratorData()
|
||||
.setGenerator(new GeneratorPerlin(true))
|
||||
.setReplacer(new ReplacerTerranian(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()))
|
||||
.setPopulator(new PopulatorDefault())
|
||||
.setPopulator(new PopulatorBiome())
|
||||
.setBiomeGen(new BiomeGenerator(new Biome(8.0f, 80.0f), false, 4, 4, 6, 50,
|
||||
new Biome[] {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)},
|
||||
new Biome[] {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), new Biome(12.0f, 90.0f, Scaling.SEA_POND), new Biome(18.0f, 90.0f)},
|
||||
|
|
|
@ -1275,7 +1275,7 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
// TODO: check id lakes check on village is really necessary
|
||||
}
|
||||
if(lakes && this.lakes != null && (this.populator == null || this.populator.canGenerateLakes())) {
|
||||
if(lakes && this.lakes != null) {
|
||||
for(FeatureLakes lake : this.lakes) {
|
||||
lake.generate(this, this.grng, pos);
|
||||
}
|
||||
|
@ -1293,7 +1293,7 @@ public final class WorldServer extends AWorldServer {
|
|||
if(this.populator != null) {
|
||||
this.populator.decorate(this, this.grng, pos);
|
||||
}
|
||||
if(this.liquids != null && (this.populator == null || this.populator.canGenerateLiquids())) {
|
||||
if(this.liquids != null) {
|
||||
for(FeatureLiquids liquid : this.liquids) {
|
||||
liquid.generate(this, this.grng, pos);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class WorldGenBlockBlob extends FeatureGenerator
|
|||
|
||||
Block block = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.stone)
|
||||
if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.podzol && block != Blocks.coarse_dirt && block != Blocks.stone)
|
||||
{
|
||||
break label0;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,4 @@ import server.world.WorldServer;
|
|||
|
||||
public interface Populator {
|
||||
void decorate(WorldServer world, Random rand, BlockPos pos);
|
||||
default boolean canGenerateLakes() {
|
||||
return true;
|
||||
}
|
||||
default boolean canGenerateLiquids() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,29 +25,6 @@ import server.worldgen.tree.WorldGenBigTree;
|
|||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public abstract class PopulatorBasic implements Populator {
|
||||
public static final PopulatorBasic plains = (new PopulatorPlains());
|
||||
public static final PopulatorBasic desert = (new PopulatorDesert());
|
||||
public static final PopulatorBasic extremeHills = (new PopulatorHills(false));
|
||||
public static final PopulatorBasic extremeHillsPlus = (new PopulatorHills(true));
|
||||
public static final PopulatorBasic taiga = (new PopulatorTaiga(0));
|
||||
public static final PopulatorBasic megaTaiga = (new PopulatorTaiga(1));
|
||||
public static final PopulatorBasic tallTreeTaiga = new PopulatorTaiga(2);
|
||||
public static final PopulatorBasic swampland = (new PopulatorSwamp());
|
||||
public static final PopulatorBasic river = (new PopulatorDefault());
|
||||
public static final PopulatorBasic icePlains = (new PopulatorSnow(false));
|
||||
public static final PopulatorBasic iceSpikes = new PopulatorSnow(true);
|
||||
public static final PopulatorBasic beach = (new PopulatorBeach());
|
||||
public static final PopulatorBasic jungle = (new PopulatorTropical(false));
|
||||
public static final PopulatorBasic jungleEdge = (new PopulatorTropical(true));
|
||||
public static final PopulatorBasic stoneBeach = (new PopulatorRocky());
|
||||
public static final PopulatorBasic savanna = (new PopulatorSavanna(true));
|
||||
public static final PopulatorBasic savannaNoDPlants = new PopulatorSavanna(false);
|
||||
public static final PopulatorBasic forest = (new PopulatorForest(0));
|
||||
public static final PopulatorBasic flowerForest = new PopulatorForest(1);
|
||||
public static final PopulatorBasic birchForest = (new PopulatorForest(2));
|
||||
public static final PopulatorBasic roofedForest = (new PopulatorForest(3));
|
||||
public static final PopulatorBasic tallBirchForest = new PopulatorForest(5);
|
||||
|
||||
protected static final PerlinGen TREE_NOISE = new PerlinGen(new Random(726528729282625L), 8);
|
||||
protected static final PerlinGen GRASS_NOISE = new PerlinGen(new Random(297363826225L), 1);
|
||||
protected static final FeatureDoublePlant DOUBLE_PLANT_GEN = new FeatureDoublePlant();
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class PopulatorBiome implements Populator {
|
||||
private final Populator plains = (new PopulatorPlains());
|
||||
private final Populator desert = (new PopulatorDesert());
|
||||
private final Populator extremeHills = (new PopulatorHills(false));
|
||||
private final Populator extremeHillsPlus = (new PopulatorHills(true));
|
||||
private final Populator taiga = (new PopulatorTaiga(0));
|
||||
private final Populator megaTaiga = (new PopulatorTaiga(1));
|
||||
private final Populator tallTreeTaiga = new PopulatorTaiga(2);
|
||||
private final Populator swampland = (new PopulatorSwamp());
|
||||
private final Populator river = (new PopulatorDefault());
|
||||
private final Populator icePlains = (new PopulatorSnow(false));
|
||||
private final Populator iceSpikes = new PopulatorSnow(true);
|
||||
private final Populator beach = (new PopulatorBeach());
|
||||
private final Populator jungle = (new PopulatorTropical(false));
|
||||
private final Populator jungleEdge = (new PopulatorTropical(true));
|
||||
private final Populator stoneBeach = (new PopulatorRocky());
|
||||
private final Populator savanna = (new PopulatorSavanna(true));
|
||||
private final Populator savannaNoDPlants = new PopulatorSavanna(false);
|
||||
private final Populator forest = (new PopulatorForest(0));
|
||||
private final Populator flowerForest = new PopulatorForest(1);
|
||||
private final Populator birchForest = (new PopulatorForest(2));
|
||||
private final Populator roofedForest = (new PopulatorForest(3));
|
||||
private final Populator tallBirchForest = new PopulatorForest(5);
|
||||
|
||||
public void decorate(WorldServer world, Random rand, BlockPos pos) {
|
||||
float absTemp = world.getGenTemperature(pos.getX(), pos.getZ());
|
||||
float humidity = world.getGenHumidity(pos.getX(), pos.getZ());
|
||||
|
||||
Populator gen = this.forest;
|
||||
|
||||
if(absTemp >= 50.0f)
|
||||
gen = this.desert;
|
||||
else if(absTemp >= 38.0f && humidity < 50.0f)
|
||||
gen = this.savanna;
|
||||
else if(absTemp <= 10.0f && humidity <= 10.0f)
|
||||
gen = this.stoneBeach;
|
||||
else if(absTemp <= 10.0f && humidity < 60.0f)
|
||||
gen = this.extremeHills;
|
||||
else if(absTemp < 5.0f && humidity >= 70.0f)
|
||||
gen = this.taiga;
|
||||
else if(absTemp < 22.0f && humidity >= 85.0f)
|
||||
gen = this.swampland;
|
||||
|
||||
gen.decorate(world, rand, pos);
|
||||
}
|
||||
}
|
|
@ -14,10 +14,6 @@ public class PopulatorDesert extends PopulatorBasic
|
|||
this.reedsPerChunk = 50;
|
||||
this.cactiPerChunk = 10;
|
||||
}
|
||||
|
||||
public boolean canGenerateLakes() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ public class WorldGenBaseTree extends WorldGenTree
|
|||
{
|
||||
Block block1 = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland || block1 == Blocks.tian_soil) && position.getY() < 512 - i - 1)
|
||||
if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.coarse_dirt || block1 == Blocks.podzol || block1 == Blocks.farmland || block1 == Blocks.tian_soil) && position.getY() < 512 - i - 1)
|
||||
{
|
||||
this.setBaseBlock(worldIn, position.down());
|
||||
int k2 = 3;
|
||||
|
|
|
@ -356,7 +356,7 @@ public class WorldGenBigTree extends WorldGenTree
|
|||
{
|
||||
Block block = this.world.getState(this.basePos.down()).getBlock();
|
||||
|
||||
if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland && block != Blocks.tian_soil)
|
||||
if (block != Blocks.dirt && block != Blocks.coarse_dirt && block != Blocks.podzol && block != Blocks.grass && block != Blocks.farmland && block != Blocks.tian_soil)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class WorldGenBirch extends WorldGenTree
|
|||
{
|
||||
Block block1 = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 512 - i - 1)
|
||||
if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.coarse_dirt || block1 == Blocks.podzol || block1 == Blocks.farmland) && position.getY() < 512 - i - 1)
|
||||
{
|
||||
this.setBaseBlock(worldIn, position.down());
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class WorldGenDarkOak extends WorldGenTree
|
|||
BlockPos blockpos = position.down();
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block != Blocks.grass && block != Blocks.dirt)
|
||||
if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.coarse_dirt && block != Blocks.podzol)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree
|
|||
BlockPos blockpos = p_175927_1_.down();
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2)
|
||||
if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol) && p_175927_1_.getY() >= 2)
|
||||
{
|
||||
this.setBaseBlock(worldIn, blockpos);
|
||||
this.setBaseBlock(worldIn, blockpos.east());
|
||||
|
|
|
@ -129,7 +129,7 @@ public class WorldGenPine extends WorldGenHugeTree
|
|||
BlockPos blockpos = p_175934_2_.up(i);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block == Blocks.grass || block == Blocks.dirt)
|
||||
if (block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol)
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g);
|
||||
break;
|
||||
|
|
|
@ -73,7 +73,7 @@ public class WorldGenSavanna extends WorldGenTree
|
|||
{
|
||||
Block block = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 512 - i - 1)
|
||||
if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol) && position.getY() < 512 - i - 1)
|
||||
{
|
||||
this.setBaseBlock(worldIn, position.down());
|
||||
Facing enumfacing = Facing.Plane.HORIZONTAL.random(rand);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class WorldGenTaiga1 extends WorldGenTree
|
|||
{
|
||||
Block block = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 512 - i - 1)
|
||||
if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol) && position.getY() < 512 - i - 1)
|
||||
{
|
||||
this.setBaseBlock(worldIn, position.down());
|
||||
int k2 = 0;
|
||||
|
|
|
@ -76,7 +76,7 @@ public class WorldGenTaiga2 extends WorldGenTree
|
|||
{
|
||||
Block block1 = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 512 - i - 1)
|
||||
if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.coarse_dirt || block1 == Blocks.podzol || block1 == Blocks.farmland) && position.getY() < 512 - i - 1)
|
||||
{
|
||||
this.setBaseBlock(worldIn, position.down());
|
||||
int i3 = rand.zrange(2);
|
||||
|
|
|
@ -20,7 +20,7 @@ public abstract class WorldGenTree extends FeatureGenerator
|
|||
|
||||
protected boolean canBeReplaced(Block block)
|
||||
{
|
||||
return block == Blocks.air || block.getMaterial() == Material.LEAVES || block == Blocks.grass || block == Blocks.swamp || block == Blocks.dry_leaves || block == Blocks.dirt || block instanceof BlockLog || block instanceof BlockSapling || block instanceof BlockVine;
|
||||
return block == Blocks.air || block.getMaterial() == Material.LEAVES || block == Blocks.grass || block == Blocks.swamp || block == Blocks.dry_leaves || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol || block instanceof BlockLog || block instanceof BlockSapling || block instanceof BlockVine;
|
||||
}
|
||||
|
||||
public void prepare()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue