change world floor and ceiling to filler an optional flag

This commit is contained in:
Sen 2025-05-21 16:32:28 +02:00
parent dfa5026a29
commit 272392c8ea
4 changed files with 33 additions and 61 deletions

View file

@ -279,8 +279,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
private State alt1 = Blocks.air.getState(); // cavebase, r.biome, r.simple, r.alternate
private State alt2 = Blocks.air.getState(); // r.simple, r.alternate
private State liquid = Blocks.air.getState(); // g.perlin, g.cavern, g.simple, r.biome, r.simple, r.alternate
private State floor = null; // chunk
private State ceiling = null; // chunk
private boolean ceiling = false; // chunk
private State caveFiller = Blocks.air.getState(); // cavebase, ravine
private State[] layers = null; // g.flat
private Biome[] frostBiomes = null; // b.layered
@ -547,22 +546,12 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
this.dungeons = value;
return this;
}
public final Dimension setWorldFloor(State value) {
this.floor = value;
public final Dimension enableWorldCeiling() {
this.ceiling = true;
return this;
}
public final Dimension setWorldCeiling(State value) {
this.ceiling = value;
return this;
}
public final Dimension setWorldFloorCeiling(State value) {
this.floor = this.ceiling = value;
return this;
}
public final Dimension enableStrongholds() {
this.useStrongholds = true;
return this;
@ -843,12 +832,8 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
public final boolean hasSnow() {
return this.snow;
}
public final State getWorldFloor() {
return this.floor;
}
public final State getWorldCeiling() {
public final boolean hasWorldCeiling() {
return this.ceiling;
}
@ -1001,6 +986,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
this.replacerType = ReplacerType.getByName(tag.getString("Replacer"));
this.mobs = tag.getBoolean("MobGen");
this.snow = tag.getBoolean("SnowGen");
this.ceiling = tag.getBoolean("Ceiling");
this.caves = tag.getBoolean("Caves");
this.ravines = tag.getBoolean("Ravines");
this.strideCaves = tag.getBoolean("AltCaves");
@ -1026,10 +1012,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
this.surface = BlockRegistry.getFromIdName(tag.getString("SurfaceBlock"), Blocks.grass.getState());
this.alt1 = BlockRegistry.getFromIdName(tag.getString("AltBlock1"), Blocks.gravel.getState());
this.alt2 = BlockRegistry.getFromIdName(tag.getString("AltBlock2"), Blocks.sand.getState());
this.floor = tag.hasKey("FloorBlock", 8) ?
BlockRegistry.getFromIdName(tag.getString("FloorBlock"), Blocks.bedrock.getState()) : null;
this.ceiling = tag.hasKey("CeilingBlock", 8) ?
BlockRegistry.getFromIdName(tag.getString("CeilingBlock"), null) : null;
this.caveFiller = BlockRegistry.getFromIdName(tag.getString("CaveFillBlock"), Blocks.lava.getState());
if(tag.hasKey("Layers", 9)) {
NBTTagList list = tag.getTagList("Layers", 8);
@ -1241,6 +1223,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
tag.setString("Replacer", this.replacerType.getName());
tag.setBoolean("MobGen", this.mobs);
tag.setBoolean("SnowGen", this.snow);
tag.setBoolean("Ceiling", this.ceiling);
tag.setBoolean("Caves", this.caves);
tag.setBoolean("Ravines", this.ravines);
tag.setBoolean("AltCaves", this.strideCaves);
@ -1266,10 +1249,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
tag.setString("SurfaceBlock", BlockRegistry.toIdName(this.surface));
tag.setString("AltBlock1", BlockRegistry.toIdName(this.alt1));
tag.setString("AltBlock2", BlockRegistry.toIdName(this.alt2));
if(this.floor != null)
tag.setString("FloorBlock", BlockRegistry.toIdName(this.floor));
if(this.ceiling != null)
tag.setString("CeilingBlock", BlockRegistry.toIdName(this.ceiling));
tag.setString("CaveFillBlock", BlockRegistry.toIdName(this.caveFiller));
if(this.layers != null) {
NBTTagList list = new NBTTagList();

View file

@ -532,7 +532,7 @@ public abstract class UniverseRegistry {
.setMediumBiomes(Biome.FOREST, Biome.ROOFEDFOREST, Biome.EXTREMEHILLS, Biome.PLAINS, Biome.BIRCHFOREST,
Biome.SWAMPLAND, Biome.JUNGLE, Biome.BLACKENED)
.setHotBiomes(Biome.DESERT, Biome.DESERT, Biome.DESERT, Biome.SAVANNA, Biome.SAVANNA, Biome.PLAINS)
.enableCavesRavines(Blocks.lava.getState()).setDungeons(8).setWorldFloor(Blocks.bedrock.getState())
.enableCavesRavines(Blocks.lava.getState()).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)
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
@ -594,7 +594,6 @@ public abstract class UniverseRegistry {
.setTimeQualifier(2).setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
.setSimpleReplacer(Blocks.gravel.getState(), Blocks.sand.getState()).setBiome(Biome.ELVENFOREST)
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs().enableSnow()
.setWorldFloor(Blocks.bedrock.getState())
.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)
@ -605,7 +604,6 @@ public abstract class UniverseRegistry {
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
.setBiomeReplacer(Blocks.gravel.getState()).setBiomeGen(Biome.FOREST, true, 5, 3, 3, 30)
.enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableMobs().enableSnow()
.setWorldFloor(Blocks.bedrock.getState())
.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)
@ -616,13 +614,12 @@ public abstract class UniverseRegistry {
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false), "girok");
registerDimension("'Eismond Yrdinath'", new Moon(103, "yrdinath", 0xccccff, 0xccccff, 46743637L, 17460L, 2.5f, 239.15f, 8).setTimeQualifier(4)
.setPerlinGen(Blocks.snow.getState(), Blocks.ice.getState(), 63).setBiome(Biome.SNOWLAND)
.setWorldFloor(Blocks.air.getState()).enableMobs().enableSnow().setWeather(Weather.SNOW), "transylvania");
.enableMobs().enableSnow().setWeather(Weather.SNOW), "transylvania");
registerDimension("'Wüstenplanet Me'sar'", new Planet(104, "mesar", 0xff7f3f, 0xff6022, 0xff6f00, 56643366L, 87340L, 11.0f, 333.15f)
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63)
.setBiomeReplacer(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND))
.setBiomeGen(Biome.MESA, true, 3, 1000, 100000, 100000)
.enableCavesRavines(Blocks.lava.getState()).enableMobs()
.setWorldFloor(Blocks.bedrock.getState())
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
.addOre(Blocks.iron_ore.getState(), 6, 2, 24, 0, 64, false)
@ -639,7 +636,6 @@ public abstract class UniverseRegistry {
.setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63)
.setBiomeReplacer(Blocks.blackened_cobble.getState()).setBiome(Biome.BLACKENED)
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs()
.setWorldFloor(Blocks.bedrock.getState())
.addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true)
// .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false)
, "ovrol");
@ -667,33 +663,28 @@ public abstract class UniverseRegistry {
registerDomain("Hölle", "hell");
registerDimension("Kreis Thedric", new Area(-1001, "thedric", 0x330707, 0x330707, 347.15f, 2).enableLongCaves().enableMobs().enableFortresses()
.setWorldFloor(Blocks.air.getState()).setWorldCeiling(Blocks.bedrock.getState()).enableDenseFog()
.enableWorldCeiling().enableDenseFog()
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
.setBiome(Biome.UPPERHELL), "hell");
registerDimension("Kreis Kyroth", new Area(-1002, "kyroth", 0x990000, 0x990000, 387.15f, 3).enableLongCaves().enableMobs()
.setWorldFloor(Blocks.air.getState())
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
.setBiome(Biome.LOWERHELL)
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true), "hell");
registerDimension("Kreis Ahrd", new Area(-1003, "ahrd", 0xcc0000, 0xcc0000, 467.15f, 15).enableLongCaves().enableMobs()
.setWorldFloor(Blocks.air.getState())
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.HELLHILLS)
.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), "hell");
registerDimension("Kreis Mizorath", new Area(-1004, "mizorath", 0xff0000, 0xff0000, 1067.15f, 15).enableMobs()
.setWorldFloor(Blocks.air.getState())
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOULPLAINS), "hell");
registerDimension("Kreis Dargoth", new Area(-1005, "dargoth", 0xff3f0c, 0xff3f0c, 1707.15f, 15).enableMobs()
.setWorldFloor(Blocks.air.getState())
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOULPLAINS), "hell");
registerDimension("Kreis Aasirith", new Area(-1006, "aasirith", 0x191919, 0x191919, 2482.0f, 1).enableLongCaves().enableMobs()
.setWorldFloor(Blocks.air.getState())
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63)
.setBiomeReplacer(Blocks.ash.getState()).setBiome(Biome.ASHLAND)
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),

View file

@ -73,7 +73,7 @@ public class Chunk {
Arrays.fill(this.biomes, (byte)-1);
}
public Chunk(World world, short[] data, int height, State base, State ceil, Random rand, Biome[] biomes, int x, int z) {
public Chunk(World world, short[] data, int height, boolean base, boolean ceil, Random rand, Biome[] biomes, int x, int z) {
this(world, x, z);
boolean sky = !world.dimension.hasNoLight();
for(int bx = 0; bx < 16; ++bx) {
@ -92,7 +92,8 @@ public class Chunk {
}
}
}
if(base != null) {
if(base) {
Block caves = world.dimension.getCaveFiller().getBlock();
BlockArray arr = this.getArray(0);
if(arr == null) {
arr = new BlockArray(0, sky, null);
@ -101,13 +102,16 @@ public class Chunk {
for(int bx = 0; bx < 16; ++bx) {
for(int bz = 0; bz < 16; ++bz) {
for(int by = 0; by < 5; ++by) {
if(by <= rand.zrange(5))
arr.set(bx, by, bz, base);
if(by <= rand.zrange(5)) {
Block block = arr.get(bx, by, bz).getBlock();
if(block == Blocks.air || block.getMaterial().isLiquid() || block == caves)
arr.set(bx, by, bz, this.filler);
}
}
}
}
}
if(ceil != null) {
if(ceil) {
int y = (height - 1) >> 4;
BlockArray arr = this.getArray(y);
if(arr == null) {
@ -124,7 +128,7 @@ public class Chunk {
for(int bz = 0; bz < 16; ++bz) {
for(int by = height - 1; by >= height - 5; --by) {
if(by >= (height - 1) - rand.zrange(5))
this.getArray(by >> 4).set(bx, by & 15, bz, ceil);
this.getArray(by >> 4).set(bx, by & 15, bz, Blocks.air.getState());
}
}
}
@ -132,12 +136,10 @@ public class Chunk {
for(int n = 0; n < this.biomes.length; ++n) {
this.biomes[n] = (byte)biomes[n].id;
}
this.bottom = height == 0 ? Integer.MAX_VALUE : 0;
this.top = height == 0 ? Integer.MIN_VALUE : ((height + 15) >> 4) << 4;
if(ceil == null)
this.genSkyLight();
else
if(ceil)
this.resetRelight();
else
this.genSkyLight();
}
public int getHeight(BlockPos pos) {

View file

@ -163,8 +163,8 @@ public final class WorldServer extends AWorldServer {
private BlockReplacer replacer;
private FeatureDungeons dungeons;
private State liquid;
private State base;
private State ceil;
private boolean base;
private boolean ceil;
private FeatureOres[] ores;
private FeatureLakes[] lakes;
private FeatureLiquids[] liquids;
@ -342,8 +342,8 @@ public final class WorldServer extends AWorldServer {
this.caveGen = null;
this.bigCaveGen = null;
this.ravineGen = null;
this.base = null;
this.ceil = null;
this.base = false;
this.ceil = false;
this.mobs = false;
this.snow = false;
this.strongholdGen = null;
@ -423,8 +423,8 @@ public final class WorldServer extends AWorldServer {
this.caveGen = this.createCaveGenerator();
this.bigCaveGen = this.createBigCaveGenerator();
this.ravineGen = this.createRavineGenerator();
this.base = this.dimension.getFiller().getBlock() == Blocks.air ? null : this.dimension.getFiller();
this.ceil = this.dimension.getWorldCeiling();
this.base = this.dimension.getFiller().getBlock() != Blocks.air;
this.ceil = this.dimension.hasWorldCeiling();
this.mobs = this.dimension.hasMobs();
this.snow = this.dimension.hasSnow();
this.strongholdGen = this.dimension.hasStrongholds() ? new MapGenStronghold() : null;
@ -1748,8 +1748,8 @@ public final class WorldServer extends AWorldServer {
this.replacer = null;
this.populate = false;
this.liquid = Blocks.air.getState();
this.base = null;
this.ceil = null;
this.base = false;
this.ceil = false;
this.height = this.generator.getMaximumHeight();
this.seaLevel = this.dimension.getSeaLevel();
this.ores = null;