initial populator reimplementation

This commit is contained in:
Sen 2025-07-23 16:04:55 +02:00
parent 9688d1d802
commit b9d62c2253
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
13 changed files with 86 additions and 39 deletions

View file

@ -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();
}
}

View file

@ -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)

View file

@ -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);

View file

@ -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()))))))); // );
}
/**

View file

@ -47,18 +47,6 @@ public abstract class PopulatorBasic implements Populator {
public static final PopulatorBasic birchForest = (new PopulatorForest(2));
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);

View file

@ -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;
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);
}
}

View file

@ -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);

View file

@ -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()