initial populator reimplementation
This commit is contained in:
parent
9688d1d802
commit
b9d62c2253
13 changed files with 86 additions and 39 deletions
|
@ -128,7 +128,7 @@ public class BlockCactus extends Block
|
|||
}
|
||||
|
||||
Block block = worldIn.getState(pos.down()).getBlock();
|
||||
return block == Blocks.cactus || block == Blocks.sand;
|
||||
return block == Blocks.cactus || block == Blocks.sand || block == Blocks.red_sand;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BlockDeadBush extends BlockBush
|
|||
*/
|
||||
protected boolean canPlaceBlockOn(Block ground)
|
||||
{
|
||||
return ground == Blocks.sand || ground == Blocks.hardened_clay || ground instanceof BlockColoredClay || ground == Blocks.dirt;
|
||||
return ground == Blocks.sand || ground == Blocks.red_sand || ground == Blocks.hardened_clay || ground instanceof BlockColoredClay || ground == Blocks.dirt || ground == Blocks.coarse_dirt;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,7 +99,20 @@ public abstract class Dimension extends Section {
|
|||
}
|
||||
|
||||
public static enum PopulatorType {
|
||||
NONE("none"), TERRANIAN("terranian"), MESARIAN("mesarian");
|
||||
NONE("none"),
|
||||
TERRANIAN("terranian"),
|
||||
MESARIAN("mesarian"),
|
||||
FOREST("forest"),
|
||||
ELVEN_FOREST("elven_forest"),
|
||||
ASTEROIDS("asteroids"),
|
||||
MUSHROOMS("mushrooms"),
|
||||
HELL("hell"),
|
||||
BLACKENED("blackened"),
|
||||
NO_MUSHROOMS("no_mushrooms"),
|
||||
TIAN("tian"),
|
||||
CHEESE("cheese"),
|
||||
CHAOS("chaos"),
|
||||
BASIC("basic");
|
||||
|
||||
private static final Map<String, PopulatorType> LOOKUP = Maps.newHashMap();
|
||||
|
||||
|
@ -440,8 +453,9 @@ public abstract class Dimension extends Section {
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setMesarianReplacer(State surface) {
|
||||
public final Dimension setMesarianReplacer(State surface, State top) {
|
||||
this.surface = surface;
|
||||
this.top = top;
|
||||
this.replacerType = ReplacerType.MESARIAN;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ public final class Space extends Dimension {
|
|||
private Space() {
|
||||
super(false);
|
||||
this.setPhysics(World.MAX_SIZE, 1L, 1L, 0.0f, 0.0f, 2.7f, 15);
|
||||
this.setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
|
||||
this.setStarBrightness(1.0f).setDeepStarBrightness(1.0f).setPopulator(PopulatorType.ASTEROIDS);
|
||||
}
|
||||
|
||||
public final DimType getType() {
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.dimension.Area;
|
|||
import common.dimension.CloudType;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Dimension.PopulatorType;
|
||||
import common.dimension.Domain;
|
||||
import common.dimension.Galaxy;
|
||||
import common.dimension.Moon;
|
||||
|
@ -490,6 +491,7 @@ public abstract class UniverseRegistry {
|
|||
registerPlanet("Terra", new Planet(6378136, 8766144L, 24000L, 28.0f, 9.81f, 259.15f)
|
||||
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
|
||||
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
|
||||
.setPopulator(PopulatorType.BASIC)
|
||||
.setBiomeGen(new Biome(8.0f, 80.0f), false, 4, 4, 6, 50).enableSnow()
|
||||
.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(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))
|
||||
|
@ -595,7 +597,7 @@ public abstract class UniverseRegistry {
|
|||
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)
|
||||
.setSimpleReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4).enableSnow()
|
||||
.setPopulator(PopulatorType.ELVEN_FOREST).enableCaves(Blocks.air.getState()).setDungeons(4).enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
|
@ -612,7 +614,7 @@ public abstract class UniverseRegistry {
|
|||
registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
|
||||
.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).enableSnow()
|
||||
.setPopulator(PopulatorType.FOREST).enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
|
@ -642,7 +644,7 @@ public abstract class UniverseRegistry {
|
|||
});
|
||||
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)
|
||||
.setMesarianReplacer(Blocks.red_sand.getState())
|
||||
.setMesarianReplacer(Blocks.red_sand.getState(), Blocks.dirt.getState()).setPopulator(PopulatorType.MESARIAN)
|
||||
.enableCavesRavines(Blocks.lava.getState())
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
|
@ -661,6 +663,7 @@ public abstract class UniverseRegistry {
|
|||
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)
|
||||
.setSimpleAltReplacer(Blocks.blackened_soil.getState(), Blocks.blackened_dirt.getState(), Blocks.blackened_cobble.getState())
|
||||
.setPopulator(PopulatorType.BLACKENED)
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4)
|
||||
.addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true)
|
||||
// .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
|
@ -671,7 +674,7 @@ public abstract class UniverseRegistry {
|
|||
});
|
||||
|
||||
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).setPopulator(PopulatorType.CHAOS)
|
||||
.enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false)
|
||||
|
@ -688,7 +691,8 @@ public abstract class UniverseRegistry {
|
|||
registerDomain("Tian'Xin", () -> {
|
||||
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)
|
||||
.setSimpleAltReplacer(Blocks.tian_soil.getState(), Blocks.tian.getState()).enableLongCaves().enableSnow()
|
||||
.setSimpleAltReplacer(Blocks.tian_soil.getState(), Blocks.tian.getState())
|
||||
.setPopulator(PopulatorType.TIAN).enableLongCaves().enableSnow()
|
||||
.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)
|
||||
.addSpawn(EntityCultivator.class, 50, 1, 1)
|
||||
|
@ -705,7 +709,7 @@ public abstract class UniverseRegistry {
|
|||
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2).enableLongCaves().enableFortresses()
|
||||
.enableWorldCeiling().enableDenseFog()
|
||||
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
|
||||
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState()).setPopulator(PopulatorType.HELL)
|
||||
.addSpawn(EntityFireDemon.class, 50, 4, 4)
|
||||
.addSpawn(EntityTiefling.class, 100, 4, 4)
|
||||
.addSpawn(EntityBloodElf.class, 10, 1, 2)
|
||||
|
|
|
@ -114,7 +114,18 @@ import server.worldgen.caves.MapGenCaves;
|
|||
import server.worldgen.caves.MapGenRavine;
|
||||
import server.worldgen.foliage.WorldGenBigMushroom;
|
||||
import server.worldgen.populator.Populator;
|
||||
import server.worldgen.populator.PopulatorAsteroids;
|
||||
import server.worldgen.populator.PopulatorBasic;
|
||||
import server.worldgen.populator.PopulatorBlackened;
|
||||
import server.worldgen.populator.PopulatorChaos;
|
||||
import server.worldgen.populator.PopulatorCheese;
|
||||
import server.worldgen.populator.PopulatorDefault;
|
||||
import server.worldgen.populator.PopulatorForest;
|
||||
import server.worldgen.populator.PopulatorHell;
|
||||
import server.worldgen.populator.PopulatorMesa;
|
||||
import server.worldgen.populator.PopulatorMushrooms;
|
||||
import server.worldgen.populator.PopulatorNoMushrooms;
|
||||
import server.worldgen.populator.PopulatorTian;
|
||||
import server.worldgen.structure.MapGenBridge;
|
||||
import server.worldgen.structure.MapGenMineshaft;
|
||||
import server.worldgen.structure.MapGenScatteredFeature;
|
||||
|
@ -272,10 +283,32 @@ public final class WorldServer extends AWorldServer {
|
|||
case NONE:
|
||||
return null;
|
||||
case MESARIAN:
|
||||
return new PopulatorMesa(true);
|
||||
return new PopulatorMesa();
|
||||
case TERRANIAN:
|
||||
default:
|
||||
return null;
|
||||
case FOREST:
|
||||
return new PopulatorForest(0);
|
||||
case ELVEN_FOREST:
|
||||
return new PopulatorForest(4);
|
||||
case ASTEROIDS:
|
||||
return new PopulatorAsteroids();
|
||||
case MUSHROOMS:
|
||||
return new PopulatorMushrooms();
|
||||
case HELL:
|
||||
return new PopulatorHell();
|
||||
case BLACKENED:
|
||||
return new PopulatorBlackened();
|
||||
case NO_MUSHROOMS:
|
||||
return new PopulatorNoMushrooms();
|
||||
case TIAN:
|
||||
return new PopulatorTian();
|
||||
case CHEESE:
|
||||
return new PopulatorCheese();
|
||||
case CHAOS:
|
||||
return new PopulatorChaos();
|
||||
case BASIC:
|
||||
return new PopulatorDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ public class ReplacerMesa extends ReplacerBiome
|
|||
|
||||
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;
|
||||
boolean soil = this.soilGen.generate((double)((x & ~15) | (z & 15)) * 0.5D, (double)((z & ~15) | (x & 15)) * 0.5D) > 0.1;
|
||||
boolean peak = this.peakGen.generate((double)((x & ~15) | (z & 15)) * 0.5D, (double)((z & ~15) | (x & 15)) * 0.5D) > 0.1;
|
||||
|
||||
double d4 = 0.0D;
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class ReplacerMesa extends ReplacerBiome
|
|||
}
|
||||
else
|
||||
{
|
||||
primer.set(by, i1, bx, Blocks.grass.getState());
|
||||
primer.set(by, i1, bx, Blocks.dirt.getState());
|
||||
}
|
||||
}
|
||||
else if (i1 <= this.seaLevel + 3 + rng)
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ReplacerTerranian extends ReplacerAltSimple {
|
|||
fillerBlock = this.filler;
|
||||
}
|
||||
}
|
||||
else if (absTemp >= 25.0f && humidity >= 70.0f)
|
||||
else if (absTemp < 5.0f && humidity >= 70.0f)
|
||||
{
|
||||
if (noise > 1.75D)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ public class ReplacerTerranian extends ReplacerAltSimple {
|
|||
topBlock = Blocks.podzol.getState();
|
||||
}
|
||||
}
|
||||
else if(absTemp < 22.0f && humidity >= 65.0f) {
|
||||
else if(absTemp < 22.0f && humidity >= 85.0f) {
|
||||
topBlock = Blocks.swamp.getState();
|
||||
int sea = world.getSeaLevel() - 1;
|
||||
double d0 = grassNoiseGen.generate((double)x * 0.25D, (double)z * 0.25D);
|
||||
|
|
|
@ -249,7 +249,7 @@ public class MapGenCaves extends MapGenBase
|
|||
: (state.getBlock() == Blocks.sandstone ? true
|
||||
: /* (p_175793_1_.getBlock() == Blocks.red_sandstone ? true : */ (state.getBlock() == Blocks.mycelium ? true
|
||||
: (state.getBlock() == Blocks.snow_layer ? true
|
||||
: (state.getBlock() == Blocks.sand || state.getBlock() == this.alt) && !above.getBlock().getMaterial().isColdLiquid()))))))); // );
|
||||
: (state.getBlock() == Blocks.sand || state.getBlock() == Blocks.red_sand || state.getBlock() == this.alt) && !above.getBlock().getMaterial().isColdLiquid()))))))); // );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,18 +48,6 @@ public abstract class PopulatorBasic implements Populator {
|
|||
public static final PopulatorBasic roofedForest = (new PopulatorForest(3));
|
||||
public static final PopulatorBasic tallBirchForest = new PopulatorForest(5);
|
||||
|
||||
public static final PopulatorBasic elvenForest = (new PopulatorForest(4));
|
||||
public static final PopulatorBasic mesa = (new PopulatorMesa(false));
|
||||
public static final PopulatorBasic mesaPlateau_F = (new PopulatorMesa(true));
|
||||
public static final PopulatorBasic space = (new PopulatorAsteroids());
|
||||
public static final PopulatorBasic mushroomPlains = (new PopulatorMushrooms());
|
||||
public static final PopulatorBasic upperHell = (new PopulatorHell());
|
||||
public static final PopulatorBasic blackened = (new PopulatorBlackened());
|
||||
public static final PopulatorBasic snowLand = (new PopulatorNoMushrooms());
|
||||
public static final PopulatorBasic tian = (new PopulatorTian());
|
||||
public static final PopulatorBasic moon = (new PopulatorCheese());
|
||||
public static final PopulatorBasic chaos = (new PopulatorChaos());
|
||||
|
||||
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();
|
||||
|
|
|
@ -1,23 +1,32 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.foliage.WorldGenTallGrass;
|
||||
import server.worldgen.tree.WorldGenBaseTree;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class PopulatorMesa extends PopulatorBasic
|
||||
{
|
||||
public PopulatorMesa(boolean soil)
|
||||
protected final WorldGenBaseTree treeGen = new WorldGenBaseTree(false, Blocks.oak_log.getState(), null);
|
||||
|
||||
public PopulatorMesa()
|
||||
{
|
||||
this.treesPerChunk = -999;
|
||||
this.deadBushPerChunk = 20;
|
||||
this.reedsPerChunk = 3;
|
||||
this.cactiPerChunk = 5;
|
||||
this.flowersPerChunk = 0;
|
||||
if (soil)
|
||||
this.treesPerChunk = 5;
|
||||
}
|
||||
|
||||
protected WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return this.worldGeneratorTrees;
|
||||
return this.treeGen;
|
||||
}
|
||||
|
||||
protected FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
||||
{
|
||||
return new WorldGenTallGrass(Blocks.dead_bush);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.init.WoodType;
|
|||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
|
||||
|
@ -118,7 +117,7 @@ public class WorldGenBaseTree extends WorldGenTree
|
|||
|
||||
if (block == Blocks.air || block.getMaterial() == Material.LEAVES || block.getMaterial() == Material.BUSH)
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.metaLeaves, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)));
|
||||
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves == null ? Blocks.dry_leaves.getState() : BlockLeaves.getLeavesBlock(this.metaLeaves, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ public class WorldGenBaseTree extends WorldGenTree
|
|||
{
|
||||
Block block2 = worldIn.getState(position.up(j3)).getBlock();
|
||||
|
||||
if (block2 == Blocks.air || block2.getMaterial() == Material.LEAVES || block2.getMaterial() == Material.BUSH)
|
||||
if (block2 == Blocks.air || block2.getMaterial() == Material.LEAVES || block2.getMaterial() == Material.BUSH || block2 == Blocks.dry_leaves)
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
|
||||
|
||||
|
|
|
@ -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.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 instanceof BlockLog || block instanceof BlockSapling || block instanceof BlockVine;
|
||||
}
|
||||
|
||||
public void prepare()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue