From d56f28e6d29c60198bb51f768358ec46a71dfd8a Mon Sep 17 00:00:00 2001 From: Sen Date: Thu, 24 Jul 2025 22:49:22 +0200 Subject: [PATCH] make worldgen classes server side --- client/src/main/java/client/Client.java | 5 +- .../src/main/java/common/dimension/Area.java | 9 +- .../main/java/common/dimension/Dimension.java | 1087 +---------------- .../src/main/java/common/dimension/Lake.java | 6 - .../main/java/common/dimension/Liquid.java | 6 - .../src/main/java/common/dimension/Moon.java | 10 +- .../src/main/java/common/dimension/Ore.java | 6 - .../main/java/common/dimension/Planet.java | 25 +- .../src/main/java/common/dimension/Semi.java | 10 +- .../src/main/java/common/dimension/Space.java | 4 +- .../src/main/java/common/dimension/Star.java | 2 +- .../main/java/common/world/AWorldServer.java | 2 + common/src/main/java/common/world/World.java | 7 +- server/src/main/java/server/Server.java | 10 +- .../server/command/commands/CommandLoad.java | 3 +- .../server/command/commands/CommandSeed.java | 7 +- .../java/server/dimension/Dimensions.java | 1 - .../main/java/server}/dimension/Domain.java | 4 +- .../main/java/server}/dimension/Galaxy.java | 4 +- .../java/server/dimension/GeneratorData.java | 197 +++ .../main/java/server}/dimension/Sector.java | 4 +- .../java/server/init/UniverseRegistry.java | 289 +++-- .../main/java/server}/rng/ImprovedGen.java | 4 +- .../main/java/server}/rng/ImprovedGenOld.java | 4 +- .../src/main/java/server}/rng/NoiseGen.java | 2 +- .../src/main/java/server}/rng/OctaveGen.java | 4 +- .../main/java/server}/rng/OctaveGenOld.java | 4 +- .../src/main/java/server}/rng/PerlinGen.java | 4 +- .../main/java/server}/rng/PerlinGenOld.java | 4 +- .../src/main/java/server}/rng/SimplexGen.java | 4 +- .../main/java/server}/rng/SimplexGenOld.java | 4 +- .../main/java/server/world/ChunkServer.java | 8 +- .../src/main/java/server/world/Spawner.java | 2 +- .../main/java/server/world/WorldServer.java | 377 ++---- .../src/main/java/server/worldgen}/Biome.java | 6 +- .../java/server/worldgen/BiomeGenPerlin.java | 2 +- .../java/server/worldgen/BiomeGenerator.java | 27 +- .../java/server/worldgen/BlockReplacer.java | 12 +- .../java/server/worldgen/ChunkGenerator.java | 4 + .../java/server/worldgen/FeatureLakes.java | 4 +- .../java/server/worldgen/GeneratorCavern.java | 33 +- .../server/worldgen/GeneratorDestroyed.java | 10 +- .../java/server/worldgen/GeneratorFlat.java | 53 +- .../java/server/worldgen/GeneratorIsland.java | 27 +- .../java/server/worldgen/GeneratorPerlin.java | 79 +- .../server/worldgen/GeneratorSettings.java | 20 + .../java/server/worldgen/GeneratorSimple.java | 52 +- .../java/server/worldgen/MobConstants.java | 14 - .../server/worldgen/ReplacerAltBiome.java | 73 +- .../server/worldgen/ReplacerAltSimple.java | 52 +- .../server/worldgen/ReplacerAltSurface.java | 29 +- .../java/server/worldgen/ReplacerBiome.java | 35 +- .../java/server/worldgen/ReplacerMesa.java | 32 +- .../server/worldgen/ReplacerTerranian.java | 16 +- .../server/worldgen/ReplacerTopLayer.java | 29 +- .../main/java/server/worldgen}/RngSpawn.java | 2 +- .../main/java/server/worldgen}/Scaling.java | 2 +- .../server/worldgen/caves/MapGenBase.java | 5 + .../server/worldgen/caves/MapGenBigCaves.java | 20 +- .../server/worldgen/caves/MapGenCaves.java | 28 +- .../server/worldgen/caves/MapGenRavine.java | 24 +- .../worldgen/layer/GenLayerAddExtra.java | 2 +- .../server/worldgen/layer/GenLayerBiome.java | 2 +- .../worldgen/layer/GenLayerRiverMix.java | 2 +- .../worldgen/populator/PopulatorBasic.java | 2 +- .../structure/MapGenScatteredFeature.java | 2 +- .../worldgen/structure/MapGenVillage.java | 2 +- .../worldgen/structure/StructureVillage.java | 2 +- .../server/worldgen/tree/WorldGenTree.java | 4 +- 69 files changed, 1018 insertions(+), 1809 deletions(-) delete mode 100644 common/src/main/java/common/dimension/Lake.java delete mode 100644 common/src/main/java/common/dimension/Liquid.java delete mode 100644 common/src/main/java/common/dimension/Ore.java rename {common/src/main/java/common => server/src/main/java/server}/dimension/Domain.java (62%) rename {common/src/main/java/common => server/src/main/java/server}/dimension/Galaxy.java (62%) create mode 100644 server/src/main/java/server/dimension/GeneratorData.java rename {common/src/main/java/common => server/src/main/java/server}/dimension/Sector.java (62%) rename {common/src/main/java/common => server/src/main/java/server}/rng/ImprovedGen.java (99%) rename {common/src/main/java/common => server/src/main/java/server}/rng/ImprovedGenOld.java (95%) rename {common/src/main/java/common => server/src/main/java/server}/rng/NoiseGen.java (95%) rename {common/src/main/java/common => server/src/main/java/server}/rng/OctaveGen.java (96%) rename {common/src/main/java/common => server/src/main/java/server}/rng/OctaveGenOld.java (91%) rename {common/src/main/java/common => server/src/main/java/server}/rng/PerlinGen.java (95%) rename {common/src/main/java/common => server/src/main/java/server}/rng/PerlinGenOld.java (91%) rename {common/src/main/java/common => server/src/main/java/server}/rng/SimplexGen.java (98%) rename {common/src/main/java/common => server/src/main/java/server}/rng/SimplexGenOld.java (95%) rename {common/src/main/java/common/biome => server/src/main/java/server/worldgen}/Biome.java (84%) create mode 100644 server/src/main/java/server/worldgen/GeneratorSettings.java delete mode 100644 server/src/main/java/server/worldgen/MobConstants.java rename {common/src/main/java/common/dimension => server/src/main/java/server/worldgen}/RngSpawn.java (93%) rename {common/src/main/java/common/biome => server/src/main/java/server/worldgen}/Scaling.java (96%) diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 662de971..9ba6c2ad 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -1871,9 +1871,8 @@ public class Client implements IThreadListener { this.world.getDayTime() % this.world.dimension.getOrbitalPeriod(), this.world.dimension.getOrbitalPeriod() ) + "\n" + - String.format("Laub: %s%s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)", - !this.world.dimension.hasSeasons() ? "*" : "", - this.world.getLeavesGen(pos).getDisplayName(), + String.format("Laub: %s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)", + !this.world.dimension.hasSeasons() ? "*" : this.world.getLeavesType().getDisplayName(), this.world.getTemperatureK(pos), this.world.getTemperatureC(pos), this.world.getWeather().getDisplay(), this.world.getRainStrength(), this.world.getDarkness() diff --git a/common/src/main/java/common/dimension/Area.java b/common/src/main/java/common/dimension/Area.java index 33dcc7d8..323511e2 100755 --- a/common/src/main/java/common/dimension/Area.java +++ b/common/src/main/java/common/dimension/Area.java @@ -1,5 +1,7 @@ package common.dimension; +import common.world.State; + public final class Area extends Dimension { public static int widthToSize(int width) { int size = width / 2; @@ -10,14 +12,15 @@ public final class Area extends Dimension { super(true); } - public Area(int sky, int fog, int width, float temperature, int brightness) { + public Area(int sky, int fog, int width, float temperature, int brightness, State surface, State liquid, int seaLevel) { super(false); this.setPhysics(widthToSize(width), 1L, 1L, 0.0f, 10.0f, temperature, brightness); this.setSkyColor(sky).setFogColor(fog); + this.setComposition(surface, liquid, seaLevel); } - public Area(int color, int width, float temperature, int brightness) { - this(color, color, width, temperature, brightness); + public Area(int color, int width, float temperature, int brightness, State surface, State liquid, int seaLevel) { + this(color, color, width, temperature, brightness, surface, liquid, seaLevel); } public final DimType getType() { diff --git a/common/src/main/java/common/dimension/Dimension.java b/common/src/main/java/common/dimension/Dimension.java index bf457da7..dae96c1d 100755 --- a/common/src/main/java/common/dimension/Dimension.java +++ b/common/src/main/java/common/dimension/Dimension.java @@ -1,19 +1,7 @@ package common.dimension; -import java.util.List; -import java.util.Map; -import common.biome.Biome; -import common.block.foliage.LeavesType; -import common.collect.Lists; -import common.collect.Maps; -import common.entity.Entity; -import common.entity.animal.EntityChicken; -import common.entity.types.EntityLiving; import common.init.BlockRegistry; import common.init.Blocks; -import common.init.EntityRegistry; -import common.init.MetalType; -import common.rng.WeightedList; import common.tags.TagObject; import common.util.ExtMath; import common.util.Vec3; @@ -22,119 +10,6 @@ import common.world.Weather; import common.world.World; public abstract class Dimension extends Section { - public class GeneratorSettings { - public float coordinateScale = 684.412F; - public float heightScale = 684.412F; - public float upperLimitScale = 512.0F; - public float lowerLimitScale = 512.0F; - public float depthNoiseScaleX = 200.0F; - public float depthNoiseScaleZ = 200.0F; - public float amplification = 0.0F; - public float mainNoiseScaleX = 80.0F; - public float mainNoiseScaleY = 160.0F; - public float mainNoiseScaleZ = 80.0F; - public float baseSize = 8.5F; - public float stretchY = 12.0F; - public float biomeDepthWeight = 1.0F; - public float biomeDepthOffset = 0.0F; - public float biomeScaleWeight = 1.0F; - public float biomeScaleOffset = 0.0F; - } - - public static enum GeneratorType { - FLAT("flat"), PERLIN("perlin"), SIMPLE("simple"), ISLAND("island"), CAVERN("cavern"), DESTROYED("destroyed"); - - private static final Map LOOKUP = Maps.newHashMap(); - - private final String name; - - private GeneratorType(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - public static GeneratorType getByName(String name) { - GeneratorType type = LOOKUP.get(name.toLowerCase()); - return type == null ? FLAT : type; - } - - static { - for(GeneratorType type : values()) { - LOOKUP.put(type.name, type); - } - } - } - - public static enum ReplacerType { - NONE("none"), TERRANIAN("terranian"), MESARIAN("mesarian"), ALT_SIMPLE("alt_simple"), SIMPLE("simple"), ALTERNATE("alternate"), TOPLAYER("toplayer"); - - private static final Map LOOKUP = Maps.newHashMap(); - - private final String name; - - private ReplacerType(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - public static ReplacerType getByName(String name) { - ReplacerType type = LOOKUP.get(name.toLowerCase()); - return type == null ? NONE : type; - } - - static { - for(ReplacerType type : values()) { - LOOKUP.put(type.name, type); - } - } - } - - public static enum PopulatorType { - 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 LOOKUP = Maps.newHashMap(); - - private final String name; - - private PopulatorType(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - public static PopulatorType getByName(String name) { - PopulatorType type = LOOKUP.get(name.toLowerCase()); - return type == null ? NONE : type; - } - - static { - for(PopulatorType type : values()) { - LOOKUP.put(type.name, type); - } - } - } - public static interface ColorGenerator { int getColor(long time); } @@ -179,13 +54,6 @@ public abstract class Dimension extends Section { return ((int)(r * 255.0f) << 16) | ((int)(g * 255.0f) << 8) | (int)(b * 255.0f); } } - - private static final int[] METAL_SIZES = new int[] {13, 11, 11, 9, 9, 7, 6, 5, 4, 3}; - private static final int[] METAL_COUNTS = new int[] {20, 12, 8, 5, 3, 1, -2, -4, -6, -8}; - private static final int[] METAL_OFFSETS = new int[] { 0, -12, -32, -48, -64, -72, -96, -112, -142, -168}; - private static final int[] METAL_HEIGHTS = new int[] {64, 32, 12, -10, -32, -48, -68, -84, -102, -136}; - - private final GeneratorSettings noiseGen = new GeneratorSettings(); // g.perlin // client private boolean denseFog = false; @@ -202,7 +70,9 @@ public abstract class Dimension extends Section { private SkyboxType skyboxTexture = null; private ColorGenerator starColorFunc = null; private ColorGenerator deepstarColorFunc = null; - private String[] baseNames = new String[0]; // synced only + + // synced + private String[] baseNames = new String[0]; private int sunColor = 0xffffffff; private int[] moonColors = new int[0]; @@ -214,101 +84,16 @@ public abstract class Dimension extends Section { private long rotationPeriod = 1L; private int brightness = 0; private int size = World.MAX_SIZE; - - // server / gen private Weather defaultWeather = Weather.CLEAR; - private LeavesType defaultLeaves = LeavesType.SPRING; - - private GeneratorType generatorType = GeneratorType.FLAT; - private ReplacerType replacerType = ReplacerType.NONE; - private PopulatorType populatorType = PopulatorType.NONE; - - private boolean snow = false; // snowgen+update - private boolean caves = false; - private boolean ravines = false; - private boolean strideCaves = false; - private boolean useStrongholds = false; - private boolean useVillages = false; - private boolean useMineshafts = false; - private boolean useScattered = false; - private boolean useFortresses = false; - private boolean semiFixed = false; // b.layered - - private int dungeons = 0; // dungeon - private int biomeSize = 0; // b.layered - private int riverSize = 4; // b.layered - private int snowRarity = 6; // b.layered - private int seaRarity = 50; // b.layered - private int addRarity = 50; // b.layered - private int seaLevel = 0; // g.perlin, g.cavern, g.simple, g.destroyed, lake (r), r.biome, r.simple, r.alternate, ... - private float depth = 0.1f; // g.perlin - private float scale = 0.2f; // g.perlin - - private Biome defaultBiome = null; // biomegen - - 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 - private State top = Blocks.air.getState(); // caves+rav, lake - private State surface = Blocks.air.getState(); // caves+rav, r.toplayer - 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 boolean ceiling = false; // chunk - private State caveFiller = Blocks.air.getState(); // cavebase, ravine - private State[] layers = null; // g.flat - private Biome[] frostBiomes = null; // b.layered - private Biome[] coldBiomes = null; // b.layered - private Biome[] mediumBiomes = null; // b.layered - private Biome[] hotBiomes = null; // b.layered - private Biome[] addBiomes = null; // b.layered - - private final List ores = Lists.newArrayList(); - private final List lakes = Lists.newArrayList(); - private final List liquids = Lists.newArrayList(); - private final WeightedList spawns = new WeightedList(); + private int seaLevel = 0; + private State filler = Blocks.air.getState(); + private State liquid = Blocks.air.getState(); private long seed = 0L; private boolean exterminated = false; private long timeExisted = 0L; private Weather weather = this.defaultWeather; - public static void writeState(TagObject tag, String name, State state) { - if(state != null) - tag.setString(name, BlockRegistry.getName(state)); - } - - public static void writeState(TagObject tag, State state) { - writeState(tag, "Block", state); - } - - public static State readState(TagObject tag, String name, State def) { - return tag.hasString(name) ? BlockRegistry.byName(tag.getString(name), def) : def; - } - - public static State readState(TagObject tag, State def) { - return readState(tag, "Block", def); - } - - public static void writeType(TagObject tag, String name, Class type) { - if(type != null) - tag.setString(name, EntityRegistry.getEntityString(type)); - } - - public static void writeType(TagObject tag, Class type) { - writeType(tag, "Type", type); - } - - public static Class readType(TagObject tag, String name, Class def) { - if(!tag.hasString(name)) - return def; - Class type = EntityRegistry.getEntityClass(tag.getString(name)); - return type != null && EntityLiving.class.isAssignableFrom(type) ? (Class)type : def; - } - - public static Class readType(TagObject tag, Class def) { - return readType(tag, "Type", def); - } - protected Dimension(boolean custom) { super(custom); } @@ -332,325 +117,31 @@ public abstract class Dimension extends Section { this.weather = weather; } - -// public final Dimension setLayers(List layers) { -// this.seaLevel = 0; -// for(FlatSettings layer : layers) { -// this.seaLevel += layer.height; -// } -// this.layers = new IBlockState[this.seaLevel]; -// int pos = 0; -// for(FlatSettings layer : layers) { -// for(int z = 0; z < layer.height; z++) { -// this.layers[pos++] = layer.state; -// } -// } -// this.generatorType = GeneratorType.FLAT; -// return this; -// } -// -// public final List getLayerList() { -// if(this.layers == null) -// return Lists.newArrayList(new FlatSettings(this.filler)); -// List list = Lists.newArrayList(); -// IBlockState last = null; -// FlatSettings current = null; -// for(IBlockState state : this.layers) { -// if(state != last) -// list.add(current = new FlatSettings(state)); -// else -// current.height += 1; -// } -// return list; -// } - -// public final Dimension setOres(List ores) { -// this.ores.clear(); -// for(OreSettings ore : ores) { -// this.ores.add(ore.createGenerator()); -// } -// return this; -// } - - public final Dimension setFlatGen(State state, int height) { - this.layers = null; - this.filler = this.top = this.surface = this.alt1 = state; - this.seaLevel = height; - this.generatorType = GeneratorType.FLAT; - return this; + + public final long getSeed() { + return this.seed; } - public final Dimension setFlatGen(State main, Object ... data) { - List states = Lists.newArrayList(); - int height = 1; - for(Object obj : data) { - if(obj instanceof Integer) - height = (Integer)obj; - else if(obj instanceof State) { - for(int z = 0; z < height; z++) { - states.add((State)obj); - } - height = 1; - } - else - throw new IllegalArgumentException("Argument muss Integer oder IBlockState sein"); - } - if(states.size() > 512) - throw new IllegalArgumentException("Es können höchstens 512 Schichten definiert werden"); - this.layers = states.toArray(new State[states.size()]); - this.filler = this.top = this.surface = this.alt1 = main; - this.seaLevel = this.layers.length; - this.generatorType = GeneratorType.FLAT; - return this; + public final boolean isExterminated() { + return this.exterminated; } - public final Dimension setIslandGen(State filler) { - this.filler = this.top = this.surface = this.alt1 = filler; - this.seaLevel = 0; - this.generatorType = GeneratorType.ISLAND; - return this; + public final long getTimeExisted() { + return this.timeExisted; } - public final Dimension setCavernGen(State filler, State liquid, int seaLevel) { - this.filler = this.top = this.surface = this.alt1 = filler; + public final Weather getCurrentWeather() { + return this.weather; + } + + + protected final void setComposition(State filler, State liquid, int seaLevel) { + this.filler = filler; this.liquid = liquid; this.seaLevel = seaLevel; - this.generatorType = GeneratorType.CAVERN; - return this; } - public final Dimension setSimpleGen(State filler, State liquid, int seaLevel) { - this.filler = this.top = this.surface = this.alt1 = filler; - this.liquid = liquid; - this.seaLevel = seaLevel; - this.generatorType = GeneratorType.SIMPLE; - return this; - } - - public final Dimension setPerlinGen(State filler, State liquid, int seaLevel) { - this.filler = this.top = this.surface = this.alt1 = filler; - this.liquid = liquid; - this.seaLevel = seaLevel; - this.generatorType = GeneratorType.PERLIN; - return this; - } - - public final Dimension setPerlinGen(State filler, State liquid, int seaLevel, float depth, float scale) { - this.depth = depth; // TODO: save - this.scale = scale; - return this.setPerlinGen(filler, liquid, seaLevel); - } - - public final Dimension setTerranianReplacer(State surface, State top, State alt1, State alt2) { - this.surface = surface; - this.top = top; - this.alt1 = alt1; - this.alt2 = alt2; - this.replacerType = ReplacerType.TERRANIAN; - return this; - } - - public final Dimension setMesarianReplacer(State surface, State top) { - this.surface = surface; - this.top = top; - this.replacerType = ReplacerType.MESARIAN; - return this; - } - - public final Dimension setSimpleAltReplacer(State surface, State top, State alt1) { - this.surface = surface; - this.top = top; - this.alt1 = alt1; - this.replacerType = ReplacerType.ALT_SIMPLE; - return this; - } - - public final Dimension setSimpleAltReplacer(State surface, State top) { - this.surface = surface; - this.top = top; - this.replacerType = ReplacerType.ALT_SIMPLE; - return this; - } - - public final Dimension setSimpleAltReplacer(State alt1) { - this.alt1 = alt1; - this.replacerType = ReplacerType.ALT_SIMPLE; - return this; - } - - public final Dimension setSimpleReplacer(State surface, State top, State alt1, State alt2) { - this.surface = surface; - this.top = top; - this.alt1 = alt1; - this.alt2 = alt2; - this.replacerType = ReplacerType.SIMPLE; - return this; - } - - public final Dimension setSimpleReplacer(State alt1, State alt2) { - this.alt1 = alt1; - this.alt2 = alt2; - this.replacerType = ReplacerType.SIMPLE; - return this; - } - - public final Dimension setSurfaceReplacer(State alt1, State alt2) { - this.alt1 = alt1; - this.alt2 = alt2; - this.replacerType = ReplacerType.ALTERNATE; - return this; - } - - public final Dimension setTopReplacer(State surface) { - this.surface = surface; - this.replacerType = ReplacerType.TOPLAYER; - return this; - } - - public final Dimension setPopulator(PopulatorType type) { - this.populatorType = type; - return this; - } - - public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity) { - return this.setBiomeGen(mainBiome, semiFixed, biomeSize, riverSize, snowRarity, seaRarity, 1); - } - - public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity, - int addRarity, Biome ... add) { - this.defaultBiome = mainBiome; //TODO: save - this.semiFixed = semiFixed; - this.biomeSize = biomeSize; - this.riverSize = riverSize; - this.snowRarity = snowRarity; - this.seaRarity = seaRarity; - this.addRarity = addRarity; - this.addBiomes = add; - return this; - } - - public final Dimension setFrostBiomes(Biome ... biomes) { - this.frostBiomes = biomes; - return this; - } - - public final Dimension setColdBiomes(Biome ... biomes) { - this.coldBiomes = biomes; - return this; - } - - public final Dimension setMediumBiomes(Biome ... biomes) { - this.mediumBiomes = biomes; - return this; - } - - public final Dimension setHotBiomes(Biome ... biomes) { - this.hotBiomes = biomes; - return this; - } - - public final Dimension enableSnow() { - this.snow = true; - return this; - } - - public final Dimension enableCaves(State filler) { - this.caves = true; - this.caveFiller = filler; - return this; - } - - public final Dimension enableRavines(State filler) { - this.ravines = true; - this.caveFiller = filler; - return this; - } - - public final Dimension enableCavesRavines(State filler) { - this.caves = this.ravines = true; - this.caveFiller = filler; - return this; - } - - public final Dimension enableLongCaves() { - this.strideCaves = true; - return this; - } - - public final Dimension setDungeons(int value) { - this.dungeons = value; - return this; - } - - public final Dimension enableWorldCeiling() { - this.ceiling = true; - return this; - } - - public final Dimension enableStrongholds() { - this.useStrongholds = true; - return this; - } - - public final Dimension enableVillages() { - this.useVillages = true; - return this; - } - - public final Dimension enableMineshafts() { - this.useMineshafts = true; - return this; - } - - public final Dimension enableScattered() { - this.useScattered = true; - return this; - } - - public final Dimension enableFortresses() { - this.useFortresses = true; - return this; - } - - public final Dimension setLeavesType(LeavesType value) { - this.defaultLeaves = value; - return this; - } - - public final Dimension addLake(State state, State filler, State top, int chance, int minHeight, int maxHeight, - boolean ratiod) { - this.lakes.add(new Lake(state, filler, top, chance, minHeight, maxHeight, ratiod)); - return this; - } - - public final Dimension addLiquid(State state, int chance, int minHeight, int maxHeight, boolean lower) { - this.liquids.add(new Liquid(state, chance, minHeight, maxHeight, lower)); - return this; - } - - public final Dimension addOre(State state, int count, int more, int size, int minHeight, int maxHeight, boolean distrib) { - this.ores.add(new Ore(state, count, more, size, minHeight, maxHeight, distrib)); - return this; - } - - public final Dimension addMetalOres(MetalType ... metals) { - for(MetalType metal : metals) { - int count = METAL_COUNTS[metal.rarity]; - this.ores.add(new Ore(BlockRegistry.byName(metal.name + "_ore").getState(), - count < 0 ? 0 : count, count < 0 ? (-count) : 0, METAL_SIZES[metal.rarity], METAL_OFFSETS[metal.rarity], METAL_HEIGHTS[metal.rarity], false)); - } - return this; - } - - public final Dimension addSpawn(Class type, int weight, int min, int max) { - this.spawns.add(new RngSpawn(type, weight, min, max)); - return this; - } - - - - protected final Dimension setPhysics(int size, long orbitalPeriod, long rotationPeriod, float orbitOffset, float gravity, float temperature, - int brightness) { + protected final void setPhysics(int size, long orbitalPeriod, long rotationPeriod, float orbitOffset, float gravity, float temperature, int brightness) { this.size = size; this.orbitalPeriod = orbitalPeriod; this.rotationPeriod = rotationPeriod; @@ -658,7 +149,6 @@ public abstract class Dimension extends Section { this.gravity = gravity; this.temperature = temperature; this.brightness = brightness; - return this; } protected final Dimension setSkyColor(int value) { @@ -675,6 +165,7 @@ public abstract class Dimension extends Section { this.cloudColor = value; return this; } + public final Dimension setLightColor(int value) { this.lightColor = value; @@ -691,7 +182,6 @@ public abstract class Dimension extends Section { return this; } - public final Dimension setDefaultWeather(Weather value) { this.defaultWeather = this.weather = value; return this; @@ -757,23 +247,6 @@ public abstract class Dimension extends Section { return this; } - - public final long getSeed() { - return this.seed; - } - - public final boolean isExterminated() { - return this.exterminated; - } - - public final long getTimeExisted() { - return this.timeExisted; - } - - public final Weather getCurrentWeather() { - return this.weather; - } - public final long getOrbitalPeriod() { return this.orbitalPeriod; @@ -799,17 +272,10 @@ public abstract class Dimension extends Section { return this.size; } - -// public final String getCustomName() { -// return this.customName; -// } - - public final Weather getDefaultWeather() { return this.defaultWeather; } - public final int getBrightness() { return this.brightness; } @@ -869,6 +335,18 @@ public abstract class Dimension extends Section { public final boolean hasDenseFog() { return this.denseFog; } + + public final State getFiller() { + return this.filler; + } + + public final State getLiquid() { + return this.liquid; + } + + public final int getSeaLevel() { + return this.seaLevel; + } public boolean isBaseDestroyed() { @@ -927,63 +405,6 @@ public abstract class Dimension extends Section { public final String[] getBaseNames() { return this.baseNames; } - - - public final State getFiller() { - return this.filler; - } - - public final State getTop() { - return this.top; - } - - public final State getLiquid() { - return this.liquid; - } - - public final LeavesType getLeavesType() { - return this.defaultLeaves; - } - - public final boolean hasSnow() { - return this.snow; - } - - public final boolean hasWorldCeiling() { - return this.ceiling; - } - - public final int getSeaLevel() { - return this.seaLevel; - } - - public final boolean hasStrongholds() { - return this.useStrongholds; - } - - public final boolean hasVillages() { - return this.useVillages; - } - - public final boolean hasMineshafts() { - return this.useMineshafts; - } - - public final boolean hasScattered() { - return this.useScattered; - } - - public final boolean hasFortresses() { - return this.useFortresses; - } - - public float getDepth() { - return this.depth; - } - - public float getScale() { - return this.scale; - } public static Dimension create(DimType type) { @@ -1014,12 +435,6 @@ public abstract class Dimension extends Section { return dim; } - public final TagObject dumpTags() { - TagObject tag = new TagObject(); - this.toTags(tag); - return tag; - } - public final TagObject writeData(boolean send) { TagObject tag = new TagObject(); tag.setLong("Seed", this.seed); @@ -1057,180 +472,10 @@ public abstract class Dimension extends Section { public final void fromTags(TagObject tag) { this.seaLevel = tag.getInt("SeaLevel"); - this.filler = readState(tag, "FillerBlock", Blocks.stone.getState()); - this.liquid = readState(tag, "LiquidBlock", Blocks.water.getState()); - this.noiseGen.coordinateScale = tag.getFloat("CoordScale"); - this.noiseGen.heightScale = tag.getFloat("HeightScale"); - this.noiseGen.upperLimitScale = tag.getFloat("UpperLmtScale"); - this.noiseGen.lowerLimitScale = tag.getFloat("LowerLmtScale"); - this.noiseGen.depthNoiseScaleX = tag.getFloat("DepthScaleX"); - this.noiseGen.depthNoiseScaleZ = tag.getFloat("DepthScaleZ"); - this.noiseGen.amplification = tag.getFloat("Amplification"); - this.noiseGen.mainNoiseScaleX = tag.getFloat("ScaleX"); - this.noiseGen.mainNoiseScaleY = tag.getFloat("ScaleY"); - this.noiseGen.mainNoiseScaleZ = tag.getFloat("ScaleZ"); - this.noiseGen.baseSize = tag.getFloat("BaseSize"); - this.noiseGen.stretchY = tag.getFloat("Stretch"); - this.noiseGen.biomeDepthWeight = tag.getFloat("BDepthWeight"); - this.noiseGen.biomeDepthOffset = tag.getFloat("BDepthOffset"); - this.noiseGen.biomeScaleWeight = tag.getFloat("BScaleWeight"); - this.noiseGen.biomeScaleOffset = tag.getFloat("BScaleOffset"); - this.generatorType = GeneratorType.getByName(tag.getString("Generator")); - this.replacerType = ReplacerType.getByName(tag.getString("Replacer")); - this.populatorType = PopulatorType.getByName(tag.getString("Populator")); - this.snow = tag.getBool("SnowGen"); - this.ceiling = tag.getBool("Ceiling"); - this.caves = tag.getBool("Caves"); - this.ravines = tag.getBool("Ravines"); - this.strideCaves = tag.getBool("AltCaves"); - this.useStrongholds = tag.getBool("Strongholds"); - this.useVillages = tag.getBool("Villages"); - this.useMineshafts = tag.getBool("Mineshafts"); - this.useScattered = tag.getBool("Scattered"); - this.useFortresses = tag.getBool("Fortresses"); - this.dungeons = tag.getInt("Dungeons"); - this.biomeSize = tag.getInt("BiomeSize"); - this.riverSize = tag.getInt("RiverSize"); - this.snowRarity = tag.getInt("SnowRarity"); - this.seaRarity = tag.getInt("SeaRarity"); - this.addRarity = tag.getInt("AddRarity"); -// this.defaultBiome = Biome.findByName(tag.getString("DefaultBiome")); - this.semiFixed = tag.getBool("SemiFixed"); + this.filler = BlockRegistry.byName(tag.getString("FillerBlock"), Blocks.stone.getState()); + this.liquid = BlockRegistry.byName(tag.getString("LiquidBlock"), Blocks.water.getState()); this.defaultWeather = Weather.getByName(tag.getString("DefaultWeather")); this.defaultWeather = this.weather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather; - this.defaultLeaves = LeavesType.getByName(tag.getString("DefaultLeaves")); - this.defaultLeaves = this.defaultLeaves == null ? LeavesType.SPRING : this.defaultLeaves; - this.top = readState(tag, "TopBlock", Blocks.dirt.getState()); - this.surface = readState(tag, "SurfaceBlock", Blocks.grass.getState()); - this.alt1 = readState(tag, "AltBlock1", Blocks.gravel.getState()); - this.alt2 = readState(tag, "AltBlock2", Blocks.sand.getState()); - this.caveFiller = readState(tag, "CaveFillBlock", Blocks.lava.getState()); - if(tag.hasStringArray("Layers")) { - String[] list = tag.getStringArray("Layers"); - this.layers = new State[list.length]; - for(int z = 0; z < this.layers.length; z++) { - this.layers[z] = BlockRegistry.byName(list[z], Blocks.air.getState()); - } - } - else { - this.layers = null; - } -// if(tag.hasStringArray("AddBiomes")) { -// String[] list = tag.getStringArray("AddBiomes"); -// if(list.length == 0) { -// this.addBiomes = null; -// } -// else { -// this.addBiomes = new Biome[list.length]; -// for(int z = 0; z < this.addBiomes.length; z++) { -// this.addBiomes[z] = Biome.findByName(list[z]); -// } -// } -// } -// else { -// this.addBiomes = null; -// } -// if(tag.hasStringArray("FrostBiomes")) { -// String[] list = tag.getStringArray("FrostBiomes"); -// if(list.length == 0) { -// this.frostBiomes = null; -// } -// else { -// this.frostBiomes = new Biome[list.length]; -// for(int z = 0; z < this.frostBiomes.length; z++) { -// this.frostBiomes[z] = Biome.findByName(list[z]); -// } -// } -// } -// else { -// this.frostBiomes = null; -// } -// if(tag.hasStringArray("ColdBiomes")) { -// String[] list = tag.getStringArray("ColdBiomes"); -// if(list.length == 0) { -// this.coldBiomes = null; -// } -// else { -// this.coldBiomes = new Biome[list.length]; -// for(int z = 0; z < this.coldBiomes.length; z++) { -// this.coldBiomes[z] = Biome.findByName(list[z]); -// } -// } -// } -// else { -// this.coldBiomes = null; -// } -// if(tag.hasStringArray("MediumBiomes")) { -// String[] list = tag.getStringArray("MediumBiomes"); -// if(list.length == 0) { -// this.mediumBiomes = null; -// } -// else { -// this.mediumBiomes = new Biome[list.length]; -// for(int z = 0; z < this.mediumBiomes.length; z++) { -// this.mediumBiomes[z] = Biome.findByName(list[z]); -// } -// } -// } -// else { -// this.mediumBiomes = null; -// } -// if(tag.hasStringArray("HotBiomes")) { -// String[] list = tag.getStringArray("HotBiomes"); -// if(list.length == 0) { -// this.hotBiomes = null; -// } -// else { -// this.hotBiomes = new Biome[list.length]; -// for(int z = 0; z < this.hotBiomes.length; z++) { -// this.hotBiomes[z] = Biome.findByName(list[z]); -// } -// } -// } -// else { -// this.hotBiomes = null; -// } - this.ores.clear(); - if(tag.hasList("Ores")) { - List list = tag.getList("Ores"); - for(int z = 0; z < list.size(); z++) { - TagObject gen = list.get(z); - this.ores.add(new Ore(readState(gen, Blocks.iron_ore.getState()), - gen.getInt("Count"), gen.getInt("Add"), gen.getInt("Size"), - gen.getInt("MinC"), gen.getInt("MaxS"), gen.getBool("Distrib"))); - } - } - this.lakes.clear(); - if(tag.hasList("Lakes")) { - List list = tag.getList("Lakes"); - for(int z = 0; z < list.size(); z++) { - TagObject gen = list.get(z); - this.lakes.add(new Lake( - readState(gen, Blocks.water.getState()), - readState(gen, "Filler", null), readState(gen, "Top", null), - gen.getInt("Chance"), gen.getInt("Min"), gen.getInt("Max"), gen.getBool("Ratiod"))); - } - } - this.liquids.clear(); - if(tag.hasList("Liquids")) { - List list = tag.getList("Liquids"); - for(int z = 0; z < list.size(); z++) { - TagObject gen = list.get(z); - this.liquids.add(new Liquid( - readState(gen, Blocks.flowing_water.getState()), - gen.getInt("Chance"), gen.getInt("Min"), gen.getInt("Max"), gen.getBool("Lower"))); - } - } - this.spawns.clear(); - if(tag.hasList("Spawns")) { - List list = tag.getList("Spawns"); - for(int z = 0; z < list.size(); z++) { - TagObject gen = list.get(z); - this.spawns.add(new RngSpawn( - readType(gen, EntityChicken.class), - gen.getInt("Weight"), gen.getInt("Min"), gen.getInt("Max"))); - } - } this.denseFog = tag.getBool("DenseFog"); this.brightness = tag.getInt("Brightness"); this.skyColor = tag.getInt("SkyColor"); @@ -1277,149 +522,9 @@ public abstract class Dimension extends Section { public final void toTags(TagObject tag) { tag.setInt("SeaLevel", this.seaLevel); - writeState(tag, "FillerBlock", this.filler); - writeState(tag, "LiquidBlock", this.liquid); - tag.setFloat("CoordScale", this.noiseGen.coordinateScale); - tag.setFloat("HeightScale", this.noiseGen.heightScale); - tag.setFloat("UpperLmtScale", this.noiseGen.upperLimitScale); - tag.setFloat("LowerLmtScale", this.noiseGen.lowerLimitScale); - tag.setFloat("DepthScaleX", this.noiseGen.depthNoiseScaleX); - tag.setFloat("DepthScaleZ", this.noiseGen.depthNoiseScaleZ); - tag.setFloat("Amplification", this.noiseGen.amplification); - tag.setFloat("ScaleX", this.noiseGen.mainNoiseScaleX); - tag.setFloat("ScaleY", this.noiseGen.mainNoiseScaleY); - tag.setFloat("ScaleZ", this.noiseGen.mainNoiseScaleZ); - tag.setFloat("BaseSize", this.noiseGen.baseSize); - tag.setFloat("Stretch", this.noiseGen.stretchY); - tag.setFloat("BDepthWeight", this.noiseGen.biomeDepthWeight); - tag.setFloat("BDepthOffset", this.noiseGen.biomeDepthOffset); - tag.setFloat("BScaleWeight", this.noiseGen.biomeScaleWeight); - tag.setFloat("BScaleOffset", this.noiseGen.biomeScaleOffset); - tag.setString("Generator", this.generatorType.getName()); - tag.setString("Replacer", this.replacerType.getName()); - tag.setString("Populator", this.populatorType.getName()); - tag.setBool("SnowGen", this.snow); - tag.setBool("Ceiling", this.ceiling); - tag.setBool("Caves", this.caves); - tag.setBool("Ravines", this.ravines); - tag.setBool("AltCaves", this.strideCaves); - tag.setBool("Strongholds", this.useStrongholds); - tag.setBool("Villages", this.useVillages); - tag.setBool("Mineshafts", this.useMineshafts); - tag.setBool("Scattered", this.useScattered); - tag.setBool("Fortresses", this.useFortresses); - tag.setInt("Dungeons", this.dungeons); - tag.setInt("BiomeSize", this.biomeSize); - tag.setInt("RiverSize", this.riverSize); - tag.setInt("SnowRarity", this.snowRarity); - tag.setInt("SeaRarity", this.seaRarity); - tag.setInt("AddRarity", this.addRarity); -// tag.setString("DefaultBiome", this.defaultBiome.getName()); - tag.setBool("SemiFixed", this.semiFixed); + tag.setString("FillerBlock", BlockRegistry.getName(this.filler)); + tag.setString("LiquidBlock", BlockRegistry.getName(this.liquid)); tag.setString("DefaultWeather", this.defaultWeather.getName()); - tag.setString("DefaultLeaves", this.defaultLeaves.getName()); - writeState(tag, "TopBlock", this.top); - writeState(tag, "SurfaceBlock", this.surface); - writeState(tag, "AltBlock1", this.alt1); - writeState(tag, "AltBlock2", this.alt2); - writeState(tag, "CaveFillBlock", this.caveFiller); - if(this.layers != null) { - String[] list = new String[this.layers.length]; - for(int z = 0; z < this.layers.length; z++) { - list[z] = BlockRegistry.getName(this.layers[z]); - } - tag.setStringArray("Layers", list); - } -// if(this.addBiomes != null) { -// String[] list = new String[this.addBiomes.length]; -// for(int z = 0; z < this.addBiomes.length; z++) { -// list[z] = this.addBiomes[z].getName(); -// } -// tag.setStringArray("AddBiomes", list); -// } -// if(this.frostBiomes != null) { -// String[] list = new String[this.frostBiomes.length]; -// for(int z = 0; z < this.frostBiomes.length; z++) { -// list[z] = this.frostBiomes[z].getName(); -// } -// tag.setStringArray("FrostBiomes", list); -// } -// if(this.coldBiomes != null) { -// String[] list = new String[this.coldBiomes.length]; -// for(int z = 0; z < this.coldBiomes.length; z++) { -// list[z] = this.coldBiomes[z].getName(); -// } -// tag.setStringArray("ColdBiomes", list); -// } -// if(this.mediumBiomes != null) { -// String[] list = new String[this.mediumBiomes.length]; -// for(int z = 0; z < this.mediumBiomes.length; z++) { -// list[z] = this.mediumBiomes[z].getName(); -// } -// tag.setStringArray("MediumBiomes", list); -// } -// if(this.hotBiomes != null) { -// String[] list = new String[this.hotBiomes.length]; -// for(int z = 0; z < this.hotBiomes.length; z++) { -// list[z] = this.hotBiomes[z].getName(); -// } -// tag.setStringArray("HotBiomes", list); -// } - if(!this.ores.isEmpty()) { - List list = Lists.newArrayList(); - for(Ore gen : this.ores) { - TagObject ore = new TagObject(); - writeState(ore, gen.state()); - ore.setBool("Distrib", gen.dist()); - ore.setInt("Size", gen.size()); - ore.setInt("Count", gen.count()); - ore.setInt("Add", gen.more()); - ore.setInt("MinC", gen.min()); - ore.setInt("MaxS", gen.max()); - list.add(ore); - } - tag.setList("Ores", list); - } - if(!this.lakes.isEmpty()) { - List list = Lists.newArrayList(); - for(Lake gen : this.lakes) { - TagObject lake = new TagObject(); - writeState(lake, gen.state()); - writeState(lake, "Filler", gen.filler()); - writeState(lake, "Top", gen.top()); - lake.setBool("Ratiod", gen.ratiod()); - lake.setInt("Chance", gen.chance()); - lake.setInt("Min", gen.minHeight()); - lake.setInt("Max", gen.maxHeight()); - list.add(lake); - } - tag.setList("Lakes", list); - } - if(!this.liquids.isEmpty()) { - List list = Lists.newArrayList(); - for(Liquid gen : this.liquids) { - TagObject liquid = new TagObject(); - writeState(liquid, gen.state()); - liquid.setBool("Lower", gen.lower()); - liquid.setInt("Chance", gen.chance()); - liquid.setInt("Min", gen.minHeight()); - liquid.setInt("Max", gen.maxHeight()); - list.add(liquid); - } - tag.setList("Liquids", list); - } - if(!this.spawns.isEmpty()) { - List list = Lists.newArrayList(); - for(RngSpawn gen : this.spawns) { - TagObject spawn = new TagObject(); - writeType(spawn, gen.type); - spawn.setInt("Weight", gen.weight); - spawn.setInt("Min", gen.min); - spawn.setInt("Max", gen.max); - list.add(spawn); - } - tag.setList("Spawns", list); - } tag.setBool("DenseFog", this.denseFog); tag.setInt("Brightness", this.brightness); tag.setInt("SkyColor", this.skyColor); @@ -1467,120 +572,4 @@ public abstract class Dimension extends Section { tag.setObject("DStarColorFnc", fnc); } } - - public int getBiomeSize() { - return this.biomeSize; - } - - public Biome getDefaultBiome() { - return this.defaultBiome; - } - - public boolean isSemiFixed() { - return this.semiFixed; - } - - public int getRiverSize() { - return this.riverSize; - } - - public int getSnowRarity() { - return this.snowRarity; - } - - public int getSeaRarity() { - return this.seaRarity; - } - - public Biome[] getAddBiomes() { - return this.addBiomes; - } - - public int getAddRarity() { - return this.addRarity; - } - - public Biome[] getHotBiomes() { - return this.hotBiomes; - } - - public Biome[] getMediumBiomes() { - return this.mediumBiomes; - } - - public Biome[] getColdBiomes() { - return this.coldBiomes; - } - - public Biome[] getFrostBiomes() { - return this.frostBiomes; - } - - public GeneratorType getGeneratorType() { - return this.generatorType; - } - - public State[] getLayers() { - return this.layers; - } - - public GeneratorSettings getNoiseGen() { - return this.noiseGen; - } - - public ReplacerType getReplacerType() { - return this.replacerType; - } - - public PopulatorType getPopulatorType() { - return this.populatorType; - } - - public State getAlt1() { - return this.alt1; - } - - public State getAlt2() { - return this.alt2; - } - - public State getSurface() { - return this.surface; - } - - public int getDungeons() { - return this.dungeons; - } - - public boolean hasCaves() { - return this.caves; - } - - public State getCaveFiller() { - return this.caveFiller; - } - - public boolean hasRavines() { - return this.ravines; - } - - public boolean hasStrideCaves() { - return this.strideCaves; - } - - public List getOres() { - return this.ores; - } - - public List getLakes() { - return this.lakes; - } - - public List getLiquids() { - return this.liquids; - } - - public WeightedList getSpawns() { - return this.spawns; - } } diff --git a/common/src/main/java/common/dimension/Lake.java b/common/src/main/java/common/dimension/Lake.java deleted file mode 100644 index 6b32f6bd..00000000 --- a/common/src/main/java/common/dimension/Lake.java +++ /dev/null @@ -1,6 +0,0 @@ -package common.dimension; - -import common.world.State; - -public record Lake(State state, State filler, State top, int chance, int minHeight, int maxHeight, boolean ratiod) { -} diff --git a/common/src/main/java/common/dimension/Liquid.java b/common/src/main/java/common/dimension/Liquid.java deleted file mode 100644 index 191a84d4..00000000 --- a/common/src/main/java/common/dimension/Liquid.java +++ /dev/null @@ -1,6 +0,0 @@ -package common.dimension; - -import common.world.State; - -public record Liquid(State state, int chance, int minHeight, int maxHeight, boolean lower) { -} diff --git a/common/src/main/java/common/dimension/Moon.java b/common/src/main/java/common/dimension/Moon.java index 7320d4c9..4979f973 100755 --- a/common/src/main/java/common/dimension/Moon.java +++ b/common/src/main/java/common/dimension/Moon.java @@ -8,20 +8,20 @@ public final class Moon extends Dimension { super(true); } - public Moon(int sky, int fog, int radius, long orbit, long rotation, float gravity, float temperature, int brightness, Block surface, Block liquid, float depth, float scale) { + public Moon(int sky, int fog, int radius, long orbit, long rotation, float gravity, float temperature, int brightness, Block surface, Block liquid) { super(false); this.setPhysics(Planet.radiusToSize(Math.min(radius, 26000000)), orbit, rotation, 0.0f, gravity, temperature, brightness); this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f); this.setSkyColor(sky).setFogColor(fog); - this.setPerlinGen(surface.getState(), liquid.getState(), 63, depth, scale); + this.setComposition(surface.getState(), liquid.getState(), 63); } - public Moon(int color, int radius, long orbit, long rotation, float gravity, float temperature, Block surface, Block liquid, float depth, float scale) { - this(color, color, radius, orbit, rotation, gravity, temperature, 8, surface, liquid, depth, scale); + public Moon(int color, int radius, long orbit, long rotation, float gravity, float temperature, Block surface, Block liquid) { + this(color, color, radius, orbit, rotation, gravity, temperature, 8, surface, liquid); } public Moon(int radius, long orbit, long rotation, float gravity, float temperature) { - this(0x333333, radius, orbit, rotation, gravity, temperature, Blocks.moon_rock, Blocks.air, 0.125F, 0.05F); + this(0x333333, radius, orbit, rotation, gravity, temperature, Blocks.moon_rock, Blocks.air); } public Moon(int radius, long orbitRotation, float gravity, float temperature) { diff --git a/common/src/main/java/common/dimension/Ore.java b/common/src/main/java/common/dimension/Ore.java deleted file mode 100644 index 6bbdb934..00000000 --- a/common/src/main/java/common/dimension/Ore.java +++ /dev/null @@ -1,6 +0,0 @@ -package common.dimension; - -import common.world.State; - -public record Ore(State state, int count, int more, int size, int min, int max, boolean dist) { -} diff --git a/common/src/main/java/common/dimension/Planet.java b/common/src/main/java/common/dimension/Planet.java index 58cea181..5523d84c 100755 --- a/common/src/main/java/common/dimension/Planet.java +++ b/common/src/main/java/common/dimension/Planet.java @@ -1,5 +1,7 @@ package common.dimension; +import common.world.State; + public final class Planet extends Dimension { public static int radiusToSize(int radius) { int size = (int)(Math.sqrt((double)radius * (double)radius * 4.0 * Math.PI) / 2.0); @@ -11,33 +13,34 @@ public final class Planet extends Dimension { } public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float gravity, float temperature, - int brightness) { - this(sky, fog, clouds, radius, orbit, rotation, 0.0f, gravity, temperature, brightness); + int brightness, State surface, State liquid, int seaLevel) { + this(sky, fog, clouds, radius, orbit, rotation, 0.0f, gravity, temperature, brightness, surface, liquid, seaLevel); } public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float offset, float gravity, - float temperature) { - this(sky, fog, clouds, radius, orbit, rotation, offset, gravity, temperature, 0); + float temperature, State surface, State liquid, int seaLevel) { + this(sky, fog, clouds, radius, orbit, rotation, offset, gravity, temperature, 0, surface, liquid, seaLevel); } - public Planet(int radius, long orbit, long rotation, float offset, float gravity, float temperature) { - this(0x7aa7ff, 0xc0d8ff, 0xffffff, radius, orbit, rotation, offset, gravity, temperature, 0); + public Planet(int radius, long orbit, long rotation, float offset, float gravity, float temperature, State surface, State liquid, int seaLevel) { + this(0x7aa7ff, 0xc0d8ff, 0xffffff, radius, orbit, rotation, offset, gravity, temperature, 0, surface, liquid, seaLevel); } - public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float gravity, float temperature) { - this(sky, fog, clouds, radius, orbit, rotation, 0.0f, gravity, temperature, 0); + public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float gravity, float temperature, State surface, State liquid, int seaLevel) { + this(sky, fog, clouds, radius, orbit, rotation, 0.0f, gravity, temperature, 0, surface, liquid, seaLevel); } - public Planet(int radius, long orbit, long rotation, float gravity, float temperature) { - this(radius, orbit, rotation, 0.0f, gravity, temperature); + public Planet(int radius, long orbit, long rotation, float gravity, float temperature, State surface, State liquid, int seaLevel) { + this(radius, orbit, rotation, 0.0f, gravity, temperature, surface, liquid, seaLevel); } public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float offset, float gravity, - float temperature, int brightness) { + float temperature, int brightness, State surface, State liquid, int seaLevel) { super(false); this.setPhysics(radiusToSize(Math.min(radius, 36750000)), orbit, rotation, offset, gravity, temperature, brightness); this.setStarBrightness(0.5f).setDeepStarBrightness(0.0f); this.setSkyColor(sky).setFogColor(fog).setCloudColor(clouds); + this.setComposition(surface, liquid, seaLevel); } public final DimType getType() { diff --git a/common/src/main/java/common/dimension/Semi.java b/common/src/main/java/common/dimension/Semi.java index b1595078..442fb316 100755 --- a/common/src/main/java/common/dimension/Semi.java +++ b/common/src/main/java/common/dimension/Semi.java @@ -1,19 +1,23 @@ package common.dimension; +import common.block.Block; +import common.world.State; + public final class Semi extends Dimension { Semi() { super(true); } - public Semi(int sky, int fog, int clouds, int width, float temperature, int brightness) { + public Semi(int sky, int fog, int clouds, int width, float temperature, int brightness, State surface, State liquid, int seaLevel) { super(false); this.setPhysics(Area.widthToSize(width), 1L, 1L, 0.0f, 10.0f, temperature, brightness); this.setStarBrightness(0.5f).setDeepStarBrightness(0.5f); this.setSkyColor(sky).setFogColor(fog).setCloudColor(clouds); + this.setComposition(surface, liquid, seaLevel); } - public Semi(int color, int clouds, int width, float temperature, int brightness) { - this(color, color, clouds, width, temperature, brightness); + public Semi(int color, int clouds, int width, float temperature, int brightness, State surface, State liquid, int seaLevel) { + this(color, color, clouds, width, temperature, brightness, surface, liquid, seaLevel); } public final DimType getType() { diff --git a/common/src/main/java/common/dimension/Space.java b/common/src/main/java/common/dimension/Space.java index 665cadbc..7cc2af55 100755 --- a/common/src/main/java/common/dimension/Space.java +++ b/common/src/main/java/common/dimension/Space.java @@ -1,5 +1,6 @@ package common.dimension; +import common.init.Blocks; import common.world.World; public final class Space extends Dimension { @@ -8,7 +9,8 @@ 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).setPopulator(PopulatorType.ASTEROIDS); + this.setStarBrightness(1.0f).setDeepStarBrightness(1.0f); + this.setComposition(Blocks.air.getState(), Blocks.air.getState(), 0); } public final DimType getType() { diff --git a/common/src/main/java/common/dimension/Star.java b/common/src/main/java/common/dimension/Star.java index a5ee5344..b1057014 100755 --- a/common/src/main/java/common/dimension/Star.java +++ b/common/src/main/java/common/dimension/Star.java @@ -12,7 +12,7 @@ public final class Star extends Dimension { super(false); this.setPhysics(Planet.radiusToSize(Math.min(radius, 945000000) / 25), 1L, 96000L, 0.0f, gravity, temp, 15); this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f); - this.setSkyColor(color).setFogColor(color).setFlatGen(filler.getState(), 128); + this.setSkyColor(color).setFogColor(color).setComposition(filler.getState(), Blocks.air.getState(), 128); } public Star(int radius, float gravity, float temp) { diff --git a/common/src/main/java/common/world/AWorldServer.java b/common/src/main/java/common/world/AWorldServer.java index e7632bb6..8ea71710 100644 --- a/common/src/main/java/common/world/AWorldServer.java +++ b/common/src/main/java/common/world/AWorldServer.java @@ -3,6 +3,7 @@ package common.world; import java.util.List; import common.block.Block; +import common.block.foliage.LeavesType; import common.dimension.Dimension; import common.entity.Entity; import common.entity.npc.EntityNPC; @@ -52,6 +53,7 @@ public abstract class AWorldServer extends World { public abstract void generateTree(BlockPos pos, State state, Random rand); public abstract float getGenTemperature(int x, int z); public abstract float getGenHumidity(int x, int z); + public abstract LeavesType getLeavesGen(BlockPos pos); public abstract void scheduleUpdate(BlockPos pos, Block blockIn, int delay); public abstract void notifyNeighborsOfStateChange(BlockPos pos, Block blockType); } diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index 30cab454..5b4c019d 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -1451,10 +1451,9 @@ public abstract class World implements IWorldAccess { -0.125f) * (float)Math.PI * 2.0f); } - public LeavesType getLeavesGen(BlockPos pos) { - return this.canFreezeAt(pos) ? LeavesType.SNOWY : (!this.dimension.hasSeasons() ? - this.dimension.getLeavesType() : LeavesType.values()[(int)((this.daytime % - this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]); + public LeavesType getLeavesType() { + return LeavesType.values()[(int)((this.daytime % + this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]; } public float getTemperatureK(BlockPos pos) { diff --git a/server/src/main/java/server/Server.java b/server/src/main/java/server/Server.java index f6aa410f..955957c8 100755 --- a/server/src/main/java/server/Server.java +++ b/server/src/main/java/server/Server.java @@ -30,12 +30,9 @@ import common.color.TextColor; import common.dimension.Area; import common.dimension.DimType; import common.dimension.Dimension; -import common.dimension.Domain; -import common.dimension.Galaxy; import common.dimension.Moon; import common.dimension.Section; import common.dimension.Planet; -import common.dimension.Sector; import common.dimension.Semi; import common.dimension.Space; import common.dimension.Star; @@ -102,6 +99,9 @@ import server.clipboard.RotationRegistry; import server.command.CommandEnvironment; import server.command.Executor; import server.dimension.Dimensions; +import server.dimension.Domain; +import server.dimension.Galaxy; +import server.dimension.Sector; import server.init.TeleportRegistry; import server.init.UniverseRegistry; import server.network.HandshakeHandler; @@ -601,7 +601,7 @@ public final class Server implements IThreadListener, Executor { this.keyPair = EncryptUtil.createKeypair(); } User.loadDatabase(this.users); - this.worlds.add(this.space = new WorldServer(this, wtime, Space.INSTANCE)); + this.worlds.add(this.space = new WorldServer(this, wtime, Space.INSTANCE, UniverseRegistry.getGenerator(Space.INSTANCE))); this.dimensions.put(UniverseRegistry.getId(this.space.dimension), this.space); new File("players").mkdirs(); this.setTpsTarget(20.0f); @@ -764,7 +764,7 @@ public final class Server implements IThreadListener, Executor { return null; WorldServer world = this.dimensions.get(UniverseRegistry.getId(dim)); if(world == null) { - world = new WorldServer(this, this.space.getDayTime(), dim); + world = new WorldServer(this, this.space.getDayTime(), dim, UniverseRegistry.getGenerator(dim)); this.worlds.add(world); this.dimensions.put(UniverseRegistry.getId(dim), world); } diff --git a/server/src/main/java/server/command/commands/CommandLoad.java b/server/src/main/java/server/command/commands/CommandLoad.java index 92a463da..8fa2d035 100644 --- a/server/src/main/java/server/command/commands/CommandLoad.java +++ b/server/src/main/java/server/command/commands/CommandLoad.java @@ -11,6 +11,7 @@ import common.dimension.DimType; import common.dimension.Dimension; import common.dimension.Planet; import common.dimension.Star; +import common.init.Blocks; import common.init.NameRegistry; import common.packet.SPacketDimensions; import common.rng.Random; @@ -35,7 +36,7 @@ public class CommandLoad extends Command { star = star == null ? UniverseRegistry.getName(new Random().pick(Lists.newArrayList(UniverseRegistry.getStars()))) : star; if(!UniverseRegistry.isType(star, DimType.STAR) || UniverseRegistry.isRegistered(name)) return null; - Planet dim = new Planet(sky, fog, clouds, 17000000, orbit, rotation, offset, gravity, temperature, brightness); + Planet dim = new Planet(sky, fog, clouds, 17000000, orbit, rotation, offset, gravity, temperature, brightness, Blocks.stone.getState(), Blocks.water.getState(), 63); Planet planet = UniverseRegistry.registerCustomPlanet(name, custom, dim, star); Dimensions.updateDimensions(); server.sendPacket(new SPacketDimensions(UniverseRegistry.getId(planet), UniverseRegistry.getName(planet), planet)); diff --git a/server/src/main/java/server/command/commands/CommandSeed.java b/server/src/main/java/server/command/commands/CommandSeed.java index ca9f5d7e..693d15a9 100644 --- a/server/src/main/java/server/command/commands/CommandSeed.java +++ b/server/src/main/java/server/command/commands/CommandSeed.java @@ -10,14 +10,9 @@ public class CommandSeed extends Command { super("seed"); this.addWorld("dim", true); - - this.setParamsOptional(); - this.addFlag("dump", 'd'); } - public Object exec(CommandEnvironment env, Executor exec, WorldServer world, boolean dump) { - if(dump) - exec.log("Daten: %s", world.dimension.dumpTags().format(4)); + public Object exec(CommandEnvironment env, Executor exec, WorldServer world) { exec.log("Startwert von %s: %d", world.dimension.getDisplay(), world.dimension.getSeed()); return world.dimension.getSeed(); } diff --git a/server/src/main/java/server/dimension/Dimensions.java b/server/src/main/java/server/dimension/Dimensions.java index 1587be42..d26107c8 100644 --- a/server/src/main/java/server/dimension/Dimensions.java +++ b/server/src/main/java/server/dimension/Dimensions.java @@ -8,7 +8,6 @@ import common.dimension.DimType; import common.dimension.Dimension; import common.dimension.Moon; import common.dimension.Planet; -import common.dimension.Sector; import common.dimension.Space; import common.dimension.Star; import common.entity.npc.EntityNPC; diff --git a/common/src/main/java/common/dimension/Domain.java b/server/src/main/java/server/dimension/Domain.java similarity index 62% rename from common/src/main/java/common/dimension/Domain.java rename to server/src/main/java/server/dimension/Domain.java index 471afb11..3967809d 100755 --- a/common/src/main/java/common/dimension/Domain.java +++ b/server/src/main/java/server/dimension/Domain.java @@ -1,4 +1,6 @@ -package common.dimension; +package server.dimension; + +import common.dimension.Section; public final class Domain extends Section { public Domain(boolean custom) { diff --git a/common/src/main/java/common/dimension/Galaxy.java b/server/src/main/java/server/dimension/Galaxy.java similarity index 62% rename from common/src/main/java/common/dimension/Galaxy.java rename to server/src/main/java/server/dimension/Galaxy.java index 69ee9dc8..124b9730 100755 --- a/common/src/main/java/common/dimension/Galaxy.java +++ b/server/src/main/java/server/dimension/Galaxy.java @@ -1,4 +1,6 @@ -package common.dimension; +package server.dimension; + +import common.dimension.Section; public final class Galaxy extends Section { public Galaxy(boolean custom) { diff --git a/server/src/main/java/server/dimension/GeneratorData.java b/server/src/main/java/server/dimension/GeneratorData.java new file mode 100644 index 00000000..9b79809b --- /dev/null +++ b/server/src/main/java/server/dimension/GeneratorData.java @@ -0,0 +1,197 @@ +package server.dimension; + +import java.util.Collections; +import java.util.List; +import common.block.foliage.LeavesType; +import common.collect.Lists; +import common.dimension.Dimension; +import common.entity.types.EntityLiving; +import common.init.BlockRegistry; +import common.init.MetalType; +import common.rng.WeightedList; +import common.world.State; +import server.worldgen.BiomeGenerator; +import server.worldgen.BlockReplacer; +import server.worldgen.ChunkGenerator; +import server.worldgen.FeatureDungeons; +import server.worldgen.FeatureLakes; +import server.worldgen.FeatureLiquids; +import server.worldgen.FeatureOres; +import server.worldgen.RngSpawn; +import server.worldgen.caves.MapGenBase; +import server.worldgen.populator.Populator; +import server.worldgen.structure.MapGenStructure; + +public class GeneratorData { + private static final int[] METAL_SIZES = new int[] {13, 11, 11, 9, 9, 7, 6, 5, 4, 3}; + private static final int[] METAL_COUNTS = new int[] {20, 12, 8, 5, 3, 1, -2, -4, -6, -8}; + private static final int[] METAL_OFFSETS = new int[] { 0, -12, -32, -48, -64, -72, -96, -112, -142, -168}; + private static final int[] METAL_HEIGHTS = new int[] {64, 32, 12, -10, -32, -48, -68, -84, -102, -136}; + + private final List caves = Lists.newArrayList(); + private final List features = Lists.newArrayList(); + private final List structures = Lists.newArrayList(); + private final List ores = Lists.newArrayList(); + private final List lakes = Lists.newArrayList(); + private final List liquids = Lists.newArrayList(); + private final WeightedList spawns = new WeightedList(); + + private LeavesType defaultLeaves = LeavesType.SPRING; + private boolean snow; + private boolean ceiling; + private State top; + private State surface; + private ChunkGenerator generator; + private BlockReplacer replacer; + private Populator populator; + private BiomeGenerator biomeGen; + + public void init(Dimension dim) { + this.top = this.replacer != null && this.replacer.getTop() != null ? this.replacer.getTop() : dim.getFiller(); + this.surface = this.replacer != null && this.replacer.getSurface() != null ? this.replacer.getSurface() : dim.getFiller(); + } + + public State getTop() { + return this.top; + } + + public State getSurface() { + return this.surface; + } + + public GeneratorData enableSnow() { + this.snow = true; + return this; + } + + public GeneratorData enableWorldCeiling() { + this.ceiling = true; + return this; + } + + public GeneratorData setGenerator(ChunkGenerator type) { + this.generator = type; + return this; + } + + public GeneratorData setReplacer(BlockReplacer type) { + this.replacer = type; + return this; + } + + public GeneratorData setPopulator(Populator type) { + this.populator = type; + return this; + } + + public GeneratorData setBiomeGen(BiomeGenerator type) { + this.biomeGen = type; + return this; + } + + public GeneratorData setLeavesType(LeavesType value) { + this.defaultLeaves = value; + return this; + } + + public GeneratorData addCaveGen(MapGenBase ... gens) { + Collections.addAll(this.caves, gens); + return this; + } + + public GeneratorData addFeature(FeatureDungeons ... gens) { + Collections.addAll(this.features, gens); + return this; + } + + public GeneratorData addStructure(MapGenStructure ... gens) { + Collections.addAll(this.structures, gens); + return this; + } + + public GeneratorData addLake(State state, State filler, State top, int chance, int minHeight, int maxHeight, boolean ratiod) { + this.lakes.add(new FeatureLakes(state, filler, top, chance, minHeight, maxHeight, ratiod)); + return this; + } + + public GeneratorData addLiquid(State state, int chance, int minHeight, int maxHeight, boolean lower) { + this.liquids.add(new FeatureLiquids(state, chance, minHeight, maxHeight, lower)); + return this; + } + + public GeneratorData addOre(State state, int count, int more, int size, int minHeight, int maxHeight, boolean distrib) { + this.ores.add(new FeatureOres(state, count, more, size, minHeight, maxHeight, distrib)); + return this; + } + + public GeneratorData addMetalOres(MetalType ... metals) { + for(MetalType metal : metals) { + int count = METAL_COUNTS[metal.rarity]; + this.ores.add(new FeatureOres(BlockRegistry.byName(metal.name + "_ore").getState(), + count < 0 ? 0 : count, count < 0 ? (-count) : 0, METAL_SIZES[metal.rarity], METAL_OFFSETS[metal.rarity], METAL_HEIGHTS[metal.rarity], false)); + } + return this; + } + + public GeneratorData addSpawn(Class type, int weight, int min, int max) { + this.spawns.add(new RngSpawn(type, weight, min, max)); + return this; + } + + + public LeavesType getLeavesType() { + return this.defaultLeaves; + } + + public boolean hasSnow() { + return this.snow; + } + + public boolean hasWorldCeiling() { + return this.ceiling; + } + + public BiomeGenerator getBiomeGen() { + return this.biomeGen; + } + + public ChunkGenerator getGenerator() { + return this.generator; + } + + public BlockReplacer getReplacer() { + return this.replacer; + } + + public Populator getPopulator() { + return this.populator; + } + + public List getStructures() { + return this.structures; + } + + public List getFeatures() { + return this.features; + } + + public List getCaveGens() { + return this.caves; + } + + public List getOres() { + return this.ores; + } + + public List getLakes() { + return this.lakes; + } + + public List getLiquids() { + return this.liquids; + } + + public WeightedList getSpawns() { + return this.spawns; + } +} diff --git a/common/src/main/java/common/dimension/Sector.java b/server/src/main/java/server/dimension/Sector.java similarity index 62% rename from common/src/main/java/common/dimension/Sector.java rename to server/src/main/java/server/dimension/Sector.java index ceca69cc..ac9eb77b 100755 --- a/common/src/main/java/common/dimension/Sector.java +++ b/server/src/main/java/server/dimension/Sector.java @@ -1,4 +1,6 @@ -package common.dimension; +package server.dimension; + +import common.dimension.Section; public final class Sector extends Section { public Sector(boolean custom) { diff --git a/server/src/main/java/server/init/UniverseRegistry.java b/server/src/main/java/server/init/UniverseRegistry.java index 27c70ebd..5ef04ccf 100755 --- a/server/src/main/java/server/init/UniverseRegistry.java +++ b/server/src/main/java/server/init/UniverseRegistry.java @@ -3,8 +3,7 @@ package server.init; import java.util.Collection; import java.util.List; import java.util.Map; -import common.biome.Biome; -import common.biome.Scaling; + import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; @@ -12,13 +11,9 @@ 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; import common.dimension.Section; import common.dimension.Planet; -import common.dimension.Sector; import common.dimension.Semi; import common.dimension.Space; import common.dimension.Star; @@ -55,6 +50,39 @@ import common.init.DimensionRegistry; import common.init.EntityRegistry; import common.init.MetalType; import common.world.Weather; +import server.dimension.Domain; +import server.dimension.Galaxy; +import server.dimension.GeneratorData; +import server.dimension.Sector; +import server.worldgen.Biome; +import server.worldgen.BiomeGenerator; +import server.worldgen.FeatureDungeons; +import server.worldgen.GeneratorCavern; +import server.worldgen.GeneratorFlat; +import server.worldgen.GeneratorPerlin; +import server.worldgen.GeneratorSimple; +import server.worldgen.ReplacerAltBiome; +import server.worldgen.ReplacerAltSimple; +import server.worldgen.ReplacerAltSurface; +import server.worldgen.ReplacerMesa; +import server.worldgen.ReplacerTerranian; +import server.worldgen.Scaling; +import server.worldgen.caves.MapGenBigCaves; +import server.worldgen.caves.MapGenCaves; +import server.worldgen.caves.MapGenRavine; +import server.worldgen.populator.PopulatorAsteroids; +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; +import server.worldgen.populator.PopulatorTian; +import server.worldgen.structure.MapGenBridge; +import server.worldgen.structure.MapGenMineshaft; +import server.worldgen.structure.MapGenScatteredFeature; +import server.worldgen.structure.MapGenStronghold; +import server.worldgen.structure.MapGenVillage; import java.util.Set; @@ -73,6 +101,8 @@ public abstract class UniverseRegistry extends DimensionRegistry { private static final Map AREA_DOMAIN = Maps.newHashMap(); private static final Map> DOMAIN_AREAS = Maps.newHashMap(); private static final Set SEMI = Sets.newHashSet(); + + private static final Map GEN_MAP = Maps.newHashMap(); public static List
getSections() { return SECTIONS; @@ -166,6 +196,10 @@ public abstract class UniverseRegistry extends DimensionRegistry { return NAME_MAP.containsKey(name) && NAME_MAP.get(name) instanceof Dimension dim && dim.getType() == type; } + public static GeneratorData getGenerator(Dimension dim) { + return GEN_MAP.containsKey(dim) ? GEN_MAP.get(dim) : new GeneratorData(); + } + public static Galaxy registerCustomGalaxy(String name, String display) { Galaxy galaxy = new Galaxy(true); registerGalaxyInt(name, display, galaxy); @@ -327,32 +361,38 @@ public abstract class UniverseRegistry extends DimensionRegistry { lastDomain = null; } - private static void registerStar(String name, String display, Dimension dim, Runnable sub) { + private static void registerStar(String name, String display, Dimension dim, GeneratorData gen, Runnable sub) { registerStarInt(name, display, lastStar = (Star)dim, lastSector); + GEN_MAP.put(dim, gen); sub.run(); lastStar = null; } - private static void registerPlanet(String name, String display, Dimension dim) { + private static void registerPlanet(String name, String display, Dimension dim, GeneratorData gen) { registerPlanetInt(name, display, (Planet)dim, lastStar); + GEN_MAP.put(dim, gen); } - private static void registerPlanet(String name, String display, Dimension dim, Runnable sub) { + private static void registerPlanet(String name, String display, Dimension dim, GeneratorData gen, Runnable sub) { registerPlanetInt(name, display, lastPlanet = (Planet)dim, lastStar); + GEN_MAP.put(dim, gen); sub.run(); lastPlanet = null; } - private static void registerMoon(String name, String display, Dimension dim) { + private static void registerMoon(String name, String display, Dimension dim, GeneratorData gen) { registerMoonInt(name, display, (Moon)dim, lastPlanet); + GEN_MAP.put(dim, gen); } - private static void registerArea(String name, String display, Dimension dim) { + private static void registerArea(String name, String display, Dimension dim, GeneratorData gen) { registerAreaInt(name, display, (Area)dim, lastDomain); + GEN_MAP.put(dim, gen); } - private static void registerSemi(String name, String display, Dimension dim) { + private static void registerSemi(String name, String display, Dimension dim, GeneratorData gen) { registerSemiInt(name, display, (Semi)dim); + GEN_MAP.put(dim, gen); } private static void registerGalaxy(String display, Runnable sub) { @@ -367,40 +407,40 @@ public abstract class UniverseRegistry extends DimensionRegistry { registerDomain(fromDisplay(display), display, sub); } - private static void registerStar(String display, Dimension dim, Runnable sub) { - registerStar(fromDisplay(display), "Stern " + display, dim, sub); + private static void registerStar(String display, Dimension dim, GeneratorData gen, Runnable sub) { + registerStar(fromDisplay(display), "Stern " + display, dim, gen, sub); } - private static void registerPlanet(String display, Dimension dim) { - registerPlanet(fromDisplay(display), "Planet " + display, dim); + private static void registerPlanet(String display, Dimension dim, GeneratorData gen) { + registerPlanet(fromDisplay(display), "Planet " + display, dim, gen); } - private static void registerPlanet(String display, Dimension dim, Runnable sub) { - registerPlanet(fromDisplay(display), "Planet " + display, dim, sub); + private static void registerPlanet(String display, Dimension dim, GeneratorData gen, Runnable sub) { + registerPlanet(fromDisplay(display), "Planet " + display, dim, gen, sub); } - private static void registerMoon(String display, Dimension dim) { - registerMoon(fromDisplay(display), "Mond " + display, dim); + private static void registerMoon(String display, Dimension dim, GeneratorData gen) { + registerMoon(fromDisplay(display), "Mond " + display, dim, gen); } - private static void registerArea(String display, Dimension dim) { - registerArea(fromDisplay(display), display, dim); + private static void registerArea(String display, Dimension dim, GeneratorData gen) { + registerArea(fromDisplay(display), display, dim, gen); } - private static void registerSemi(String display, Dimension dim) { - registerSemi(fromDisplay(display), display, dim); + private static void registerSemi(String display, Dimension dim, GeneratorData gen) { + registerSemi(fromDisplay(display), display, dim, gen); } private static void registerStar(String display, int radius, float gravity, float temp, Runnable sub) { - registerStar(display, new Star(radius, gravity, temp), sub); + registerStar(display, new Star(radius, gravity, temp), new GeneratorData().setGenerator(new GeneratorFlat()), sub); } private static void registerMoon(String display, int radius, long orbit, long rotation, float gravity, float temperature) { - registerMoon(display, new Moon(radius, orbit, rotation, gravity, temperature)); + registerMoon(display, new Moon(radius, orbit, rotation, gravity, temperature), new GeneratorData().setGenerator(new GeneratorPerlin(0.125F, 0.05F))); } 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), new GeneratorData().setGenerator(new GeneratorPerlin(0.125F, 0.05F))); } // public static final Biome PLAIN = new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW); @@ -456,24 +496,31 @@ public abstract class UniverseRegistry extends DimensionRegistry { // .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 static final WeightedList MAGEHUT_MOBS = new WeightedList(new RngSpawn(EntityMage.class, 1, 1, 1)); +// public static final WeightedList FORTRESS_MOBS = new WeightedList(new RngSpawn(EntityDarkMage.class, 10, 2, 3), +// new RngSpawn(EntityTiefling.class, 5, 4, 4), new RngSpawn(EntityUndead.class, 10, 4, 4)); public static void register() { // TODO: add mushroom 0.2F, 0.3F .addSpawn(EntityDwarf.class, 8, 4, 8) register("space", "Der Weltraum", Space.INSTANCE); + GEN_MAP.put(Space.INSTANCE, new GeneratorData().setPopulator(new PopulatorAsteroids())); registerGalaxy("milkyway", "Galaxie Milchstraße", () -> { registerSector("Solar", () -> { registerStar("Sol", 695508000, 274.0f, 5778.0f, () -> { - 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)) - .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), - new Biome(12.0f, 90.0f, Scaling.SEA_POND), new Biome(18.0f, 90.0f)) - .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) + 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()) + .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)}, + new Biome[] {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)}, + new Biome[] {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)})) + .enableSnow() + .addCaveGen(new MapGenCaves(Blocks.lava.getState()), new MapGenRavine(Blocks.lava.getState())) + .addFeature(new FeatureDungeons(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) @@ -508,33 +555,33 @@ public abstract class UniverseRegistry extends DimensionRegistry { .addSpawn(EntityMerfolk.class, 10, 4, 4) .addSpawn(EntityHorse.class, 5, 2, 6) .addSpawn(EntityCat.class, 2, 1, 1) - .enableVillages().enableMineshafts().enableScattered().enableStrongholds(), () -> { + .addStructure(new MapGenMineshaft(), new MapGenVillage(), new MapGenStronghold(), new MapGenScatteredFeature()), () -> { registerMoon("Luna", 1737100, 655728L, 1.62f, 210.0f); }); - registerPlanet("mercury", "Planet Merkur", new Planet(0x666666, 0x535353, 0x858585, 2440530, 2111297L, 1407509L, 3.7f, 440.0f) - .setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)); - registerPlanet("Venus", new Planet(0xc0c0c0, 0xa0a0a0, 0xe0e0e0, 6051800, 5392908L, 5832449L, 8.87f, 737.0f) - .setPerlinGen(Blocks.sand.getState(), Blocks.air.getState(), 63)); - registerPlanet("Mars", new Planet(0xd6905b, 0xbd723a, 0xbd9273, 3396190, 16487781L, 24623L, 3.71f, 208.0f) - .setPerlinGen(Blocks.red_sand.getState(), Blocks.air.getState(), 63), () -> { + registerPlanet("mercury", "Planet Merkur", new Planet(0x666666, 0x535353, 0x858585, 2440530, 2111297L, 1407509L, 3.7f, 440.0f, Blocks.moon_rock.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin())); + registerPlanet("Venus", new Planet(0xc0c0c0, 0xa0a0a0, 0xe0e0e0, 6051800, 5392908L, 5832449L, 8.87f, 737.0f, Blocks.sand.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin())); + registerPlanet("Mars", new Planet(0xd6905b, 0xbd723a, 0xbd9273, 3396190, 16487781L, 24623L, 3.71f, 208.0f, Blocks.red_sand.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin()), () -> { registerMoon("Phobos", 11080, 7654L, 0.0057f, 233.0f); registerMoon("Deimos", 6270, 30312L, 0.003f, 233.0f); }); - registerPlanet("Jupiter", new Planet(0xffd5ba, 0xb89f90, 0xc7b5a9, 71492000, 103989391L, 9925L, 24.79f, 163.0f).enableDenseFog() - .setFlatGen(Blocks.hydrogen.getState(), 256).setCloudHeight(576.0f), () -> { + registerPlanet("Jupiter", new Planet(0xffd5ba, 0xb89f90, 0xc7b5a9, 71492000, 103989391L, 9925L, 24.79f, 163.0f, Blocks.hydrogen.getState(), Blocks.air.getState(), 256).enableDenseFog().setCloudHeight(576.0f), + new GeneratorData().setGenerator(new GeneratorFlat()), () -> { }); - registerPlanet("Saturn", new Planet(0xf1d1a1, 0xd3b385, 0xeed7b5, 60268000, 258141008L, 10656L, 10.44f, 133.0f).enableDenseFog() - .setFlatGen(Blocks.hydrogen.getState(), 256).setCloudHeight(576.0f), () -> { + registerPlanet("Saturn", new Planet(0xf1d1a1, 0xd3b385, 0xeed7b5, 60268000, 258141008L, 10656L, 10.44f, 133.0f, Blocks.hydrogen.getState(), Blocks.air.getState(), 256).enableDenseFog().setCloudHeight(576.0f), + new GeneratorData().setGenerator(new GeneratorFlat()), () -> { }); - registerPlanet("Uranus", new Planet(0xcee6ff, 0xadd2f9, 0x8eb0d3, 25559000, 736503770L, 17240L, 8.87f, 78.0f) - .setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70) + registerPlanet("Uranus", new Planet(0xcee6ff, 0xadd2f9, 0x8eb0d3, 25559000, 736503770L, 17240L, 8.87f, 78.0f, Blocks.packed_ice.getState(), Blocks.water.getState(), 70), + new GeneratorData().setGenerator(new GeneratorPerlin()) .addOre(Blocks.diamond_ore.getState(), 4, 4, 12, 0, 60, false), () -> { }); - registerPlanet("neptune", "Planet Neptun", new Planet(0xb4d9ff, 0x85bef9, 0x649bd3, 24764000, 1444584441L, 16110L, 11.15f, 72.0f) - .setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70) + registerPlanet("neptune", "Planet Neptun", new Planet(0xb4d9ff, 0x85bef9, 0x649bd3, 24764000, 1444584441L, 16110L, 11.15f, 72.0f, Blocks.packed_ice.getState(), Blocks.water.getState(), 70), + new GeneratorData().setGenerator(new GeneratorPerlin()) .addOre(Blocks.diamond_ore.getState(), 4, 2, 1, 0, 60, false), () -> { registerMoon("Triton", 1353400, 141044L, 0.779f, 38.0f); // registerMoon("Nereid", , L, f, .0f); @@ -551,28 +598,28 @@ public abstract class UniverseRegistry extends DimensionRegistry { // registerMoon("Neso", , L, f, .0f); // registerMoon("Hippocamp", , L, f, .0f); }); - registerPlanet("Ceres", new Planet(0x666666, 0x535353, 0x858585, 473000, 40315496L, 9074L, 0.27f, 167.0f) - .setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)); - registerPlanet("Pluto", new Planet(0x666666, 0x535353, 0x858585, 1188300, 2173127098L, 153293L, 0.62f, 40.0f) - .setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63), () -> { + registerPlanet("Ceres", new Planet(0x666666, 0x535353, 0x858585, 473000, 40315496L, 9074L, 0.27f, 167.0f, Blocks.moon_rock.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin())); + registerPlanet("Pluto", new Planet(0x666666, 0x535353, 0x858585, 1188300, 2173127098L, 153293L, 0.62f, 40.0f, Blocks.moon_rock.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin()), () -> { registerMoon("Charon", 606000, 153293L, 0.288f, 53.0f); registerMoon("Nix", 22500, 596511L, 0.0028f, 38.0f); registerMoon("Hydra", 27500, 916842L, 0.051f, 23.0f); registerMoon("Kerberos", 7000, 772021L, 0.0015f, 19.0f); registerMoon("Styx", 5500, 483877L, 77760L, 0.0013f, 18.0f); }); - registerPlanet("Haumea", new Planet(0x666666, 0x535353, 0x858585, 816000, 2487831667L, 3914L, 0.63f, 48.0f) - .setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)); - registerPlanet("Makemake", new Planet(0x666666, 0x535353, 0x858585, 715000, 2684193293L, 22826L, 0.4f, 30.0f) - .setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)); - registerPlanet("Eris", new Planet(0x666666, 0x535353, 0x858585, 1163000, 4900274496L, 378862L, 0.82f, 30.0f) - .setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)); + registerPlanet("Haumea", new Planet(0x666666, 0x535353, 0x858585, 816000, 2487831667L, 3914L, 0.63f, 48.0f, Blocks.moon_rock.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin())); + registerPlanet("Makemake", new Planet(0x666666, 0x535353, 0x858585, 715000, 2684193293L, 22826L, 0.4f, 30.0f, Blocks.moon_rock.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin())); + registerPlanet("Eris", new Planet(0x666666, 0x535353, 0x858585, 1163000, 4900274496L, 378862L, 0.82f, 30.0f, Blocks.moon_rock.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin())); }); registerStar("Gi'rok", 603421976, 232.0f, 5220.0f, () -> { - 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()) - .setPopulator(PopulatorType.ELVEN_FOREST).enableCaves(Blocks.air.getState()).setDungeons(4).enableSnow() + registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f + 8.0f, Blocks.dirt.getState(), Blocks.water.getState(), 64), //TODO: check temp + new GeneratorData().setGenerator(new GeneratorSimple(true)) + .setReplacer(new ReplacerAltBiome(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())) + .setPopulator(new PopulatorForest(4)).addCaveGen(new MapGenCaves(Blocks.air.getState())).addFeature(new FeatureDungeons(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) @@ -586,10 +633,12 @@ public abstract class UniverseRegistry extends DimensionRegistry { .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) - .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) - .setPopulator(PopulatorType.FOREST).enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableSnow() + registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f, Blocks.rock.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())) + .setBiomeGen(new BiomeGenerator(new Biome(8.0f, 80.0f), true, 5, 3, 3, 30)) + .setPopulator(new PopulatorForest(0)).addCaveGen(new MapGenCaves(Blocks.lava.getState()), new MapGenRavine(Blocks.lava.getState())) + .addFeature(new FeatureDungeons(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) @@ -608,19 +657,21 @@ public abstract class UniverseRegistry extends DimensionRegistry { .addSpawn(EntityMouse.class, 10, 8, 8) .addSpawn(EntityWolf.class, 5, 2, 4) .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 - .enableSnow().setDefaultWeather(Weather.SNOW) + registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice).setDefaultWeather(Weather.SNOW), + new GeneratorData().setGenerator(new GeneratorPerlin(0.1F, 0.2F)) + .enableSnow() .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) - .enableSnow().setDefaultWeather(Weather.SNOW) + registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice).setDefaultWeather(Weather.SNOW), + new GeneratorData().setGenerator(new GeneratorPerlin(0.1F, 0.2F)) + .enableSnow() .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) - .setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63, 0.2f, 0.4f) - .setMesarianReplacer(Blocks.red_sand.getState(), Blocks.dirt.getState()).setPopulator(PopulatorType.MESARIAN) - .enableCavesRavines(Blocks.lava.getState()) + registerPlanet("mesar", "Wüstenplanet Me'sar", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 9823183, 56643366L, 87340L, 11.0f, 333.15f, Blocks.rock.getState(), Blocks.air.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin(0.2f, 0.4f)) + .setReplacer(new ReplacerMesa(Blocks.red_sand.getState())).setPopulator(new PopulatorMesa()) + .addCaveGen(new MapGenCaves(Blocks.lava.getState()), new MapGenRavine(Blocks.lava.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) @@ -634,12 +685,12 @@ public abstract class UniverseRegistry extends DimensionRegistry { }); registerGalaxy("Drkthrn", () -> { registerSector("blvck", "Sectvr Blvck", () -> { - registerStar("Ov'rol", new Star(0x000000, 832718528, 302.0f, 12666.0f, Blocks.goo), () -> { - 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) + registerStar("Ov'rol", new Star(0x000000, 832718528, 302.0f, 12666.0f, Blocks.goo), new GeneratorData().setGenerator(new GeneratorFlat()), () -> { + registerPlanet("blackplanet", "Der Schwarze Planet", new Planet(0x000000, 0x000000, 0x000000, 13038204, 4632918508L, 204556L, 12.0f, 0.0f, Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin()) + .setReplacer(new ReplacerAltSimple(Blocks.blackened_soil.getState(), Blocks.blackened_dirt.getState(), Blocks.blackened_cobble.getState())) + .setPopulator(new PopulatorBlackened()) + .addCaveGen(new MapGenCaves(Blocks.air.getState())).addFeature(new FeatureDungeons(4)) .addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true) // .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false) .addSpawn(EntityMetalhead.class, 50, 1, 1) @@ -648,26 +699,26 @@ public abstract class UniverseRegistry extends DimensionRegistry { }); }); - 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).setPopulator(PopulatorType.CHAOS) - .enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableSnow() + GeneratorData warp = new GeneratorData().setGenerator(new GeneratorPerlin(1.0F, 2.0F)).setPopulator(new PopulatorChaos()) + .addCaveGen(new MapGenCaves(Blocks.air.getState()), new MapGenBigCaves(), new MapGenRavine(Blocks.air.getState())).enableSnow() .addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false) .addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false) .addLiquid(Blocks.flowing_water.getState(), 1, 8, 255, false) - .addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true) - .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); + .addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true); for(Class clazz : EntityRegistry.getAllClasses()) { if(EntityLiving.class.isAssignableFrom(clazz)) warp.addSpawn((Class)clazz, 1, 1, 8); } - registerSemi("warp", "Der Warp", warp); + registerSemi("warp", "Der Warp", new Semi(0x0c001f, 0x190033, 124072917, 285.0f, 3, Blocks.obsidian.getState(), Blocks.lava.getState(), 63) + .setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f) + .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), warp); 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()) - .setPopulator(PopulatorType.TIAN).enableLongCaves().enableSnow() + registerArea("Ni'enrath", new Area(0x7f00ff, 532109, 276.15f, 1, Blocks.tian.getState(), Blocks.spring_water.getState(), 63).setLightColor(0x07000f).setBlockColor(0xcf6fff), + new GeneratorData().setGenerator(new GeneratorPerlin(0.1F, 1.0F)) + .setReplacer(new ReplacerAltSimple(Blocks.tian_soil.getState(), Blocks.tian.getState())) + .setPopulator(new PopulatorTian()).addCaveGen(new MapGenBigCaves()).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) @@ -677,53 +728,57 @@ public abstract class UniverseRegistry extends DimensionRegistry { .addSpawn(EntityMouse.class, 10, 8, 8)); }); registerDomain("Digital", () -> { - registerArea("Cyberspace", new Area(0x000000, 16777216, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction() - .setFlatGen(Blocks.green_clay.getState(), 2)); + registerArea("Cyberspace", new Area(0x000000, 16777216, 293.15f, 15, Blocks.green_clay.getState(), Blocks.air.getState(), 2).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction(), + new GeneratorData().setGenerator(new GeneratorFlat())); }); registerDomain("hell", "Hölle", () -> { - 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()).setPopulator(PopulatorType.HELL) + registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2, Blocks.hellrock.getState(), Blocks.lava.getState(), 63).enableDenseFog(), + new GeneratorData().addCaveGen(new MapGenBigCaves()).addStructure(new MapGenBridge()) + .enableWorldCeiling() + .setGenerator(new GeneratorCavern()) + .setReplacer(new ReplacerAltSurface(Blocks.gravel.getState(), Blocks.soul_sand.getState())).setPopulator(new PopulatorHell()) .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) - .setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState()) + registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 86742970, 387.15f, 3, Blocks.hellrock.getState(), Blocks.lava.getState(), 64), + new GeneratorData().addCaveGen(new MapGenBigCaves()) + .setGenerator(new GeneratorSimple(true)) + .setReplacer(new ReplacerAltBiome(Blocks.obsidian.getState(), Blocks.soul_sand.getState())) .addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false) .addLiquid(Blocks.flowing_lava.getState(), 40, 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)); - registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 67028432, 467.15f, 15).enableLongCaves() - .setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63, 1.0F, 0.5F) - .setSimpleAltReplacer(Blocks.soul_sand.getState()) + registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 67028432, 467.15f, 15, Blocks.hellrock.getState(), Blocks.lava.getState(), 63), + new GeneratorData().addCaveGen(new MapGenBigCaves()) + .setGenerator(new GeneratorPerlin(1.0F, 0.5F)) + .setReplacer(new ReplacerAltSimple(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) .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) - .setSimpleAltReplacer(Blocks.soul_sand.getState()) + registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 54029584, 1067.15f, 15, Blocks.hellrock.getState(), Blocks.blood.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin(-0.2F, 0.1F)) + .setReplacer(new ReplacerAltSimple(Blocks.soul_sand.getState())) .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) - .setSimpleAltReplacer(Blocks.soul_sand.getState()) + registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 43293629, 1707.15f, 15, Blocks.hellrock.getState(), Blocks.magma.getState(), 63), + new GeneratorData().setGenerator(new GeneratorPerlin(-0.2F, 0.1F)) + .setReplacer(new ReplacerAltSimple(Blocks.soul_sand.getState())) .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) - .setSimpleAltReplacer(Blocks.ash.getState(), Blocks.rock.getState(), Blocks.ash.getState()) + registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 36291872, 2482.0f, 1, Blocks.rock.getState(), Blocks.magma.getState(), 63), + new GeneratorData().addCaveGen(new MapGenBigCaves()) + .setGenerator(new GeneratorPerlin(0.125F, 0.05F)) + .setReplacer(new ReplacerAltSimple(Blocks.ash.getState(), Blocks.rock.getState(), Blocks.ash.getState())) .addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(), 2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true) .addSpawn(EntityFireDemon.class, 50, 4, 4) diff --git a/common/src/main/java/common/rng/ImprovedGen.java b/server/src/main/java/server/rng/ImprovedGen.java similarity index 99% rename from common/src/main/java/common/rng/ImprovedGen.java rename to server/src/main/java/server/rng/ImprovedGen.java index d86559ba..8c62a43d 100755 --- a/common/src/main/java/common/rng/ImprovedGen.java +++ b/server/src/main/java/server/rng/ImprovedGen.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; class ImprovedGen { private static final double[] dir3X = new double[] { 1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, diff --git a/common/src/main/java/common/rng/ImprovedGenOld.java b/server/src/main/java/server/rng/ImprovedGenOld.java similarity index 95% rename from common/src/main/java/common/rng/ImprovedGenOld.java rename to server/src/main/java/server/rng/ImprovedGenOld.java index fb3c406b..8acfaa89 100755 --- a/common/src/main/java/common/rng/ImprovedGenOld.java +++ b/server/src/main/java/server/rng/ImprovedGenOld.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; class ImprovedGenOld { private final int permutations[]; diff --git a/common/src/main/java/common/rng/NoiseGen.java b/server/src/main/java/server/rng/NoiseGen.java similarity index 95% rename from common/src/main/java/common/rng/NoiseGen.java rename to server/src/main/java/server/rng/NoiseGen.java index 114d7f43..9de2afc4 100755 --- a/common/src/main/java/common/rng/NoiseGen.java +++ b/server/src/main/java/server/rng/NoiseGen.java @@ -1,4 +1,4 @@ -package common.rng; +package server.rng; public abstract class NoiseGen { public abstract void generate(double[] noise, int xoff, int yoff, int zoff, int xsize, int ysize, int zsize, double xscale, double yscale, diff --git a/common/src/main/java/common/rng/OctaveGen.java b/server/src/main/java/server/rng/OctaveGen.java similarity index 96% rename from common/src/main/java/common/rng/OctaveGen.java rename to server/src/main/java/server/rng/OctaveGen.java index 6e58b5a4..3d408b3b 100755 --- a/common/src/main/java/common/rng/OctaveGen.java +++ b/server/src/main/java/server/rng/OctaveGen.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; public class OctaveGen extends NoiseGen { private final ImprovedGen[] generators; diff --git a/common/src/main/java/common/rng/OctaveGenOld.java b/server/src/main/java/server/rng/OctaveGenOld.java similarity index 91% rename from common/src/main/java/common/rng/OctaveGenOld.java rename to server/src/main/java/server/rng/OctaveGenOld.java index f8a8787a..a4ac5a00 100755 --- a/common/src/main/java/common/rng/OctaveGenOld.java +++ b/server/src/main/java/server/rng/OctaveGenOld.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; public class OctaveGenOld extends NoiseGen { private final ImprovedGenOld generators[]; diff --git a/common/src/main/java/common/rng/PerlinGen.java b/server/src/main/java/server/rng/PerlinGen.java similarity index 95% rename from common/src/main/java/common/rng/PerlinGen.java rename to server/src/main/java/server/rng/PerlinGen.java index 0149806a..41ae7b44 100755 --- a/common/src/main/java/common/rng/PerlinGen.java +++ b/server/src/main/java/server/rng/PerlinGen.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; public class PerlinGen { private final SimplexGen[] generators; diff --git a/common/src/main/java/common/rng/PerlinGenOld.java b/server/src/main/java/server/rng/PerlinGenOld.java similarity index 91% rename from common/src/main/java/common/rng/PerlinGenOld.java rename to server/src/main/java/server/rng/PerlinGenOld.java index 02ff25b1..575c2d79 100755 --- a/common/src/main/java/common/rng/PerlinGenOld.java +++ b/server/src/main/java/server/rng/PerlinGenOld.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; public class PerlinGenOld { private final SimplexGenOld generators[]; diff --git a/common/src/main/java/common/rng/SimplexGen.java b/server/src/main/java/server/rng/SimplexGen.java similarity index 98% rename from common/src/main/java/common/rng/SimplexGen.java rename to server/src/main/java/server/rng/SimplexGen.java index a1f3b205..4bff93e3 100755 --- a/common/src/main/java/common/rng/SimplexGen.java +++ b/server/src/main/java/server/rng/SimplexGen.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; class SimplexGen { private static final int[][] DIRS = new int[][] { { 1, 1, 0 }, { -1, 1, 0 }, { 1, -1, 0 }, { -1, -1, 0 }, { 1, 0, 1 }, { -1, 0, 1 }, { 1, 0, -1 }, diff --git a/common/src/main/java/common/rng/SimplexGenOld.java b/server/src/main/java/server/rng/SimplexGenOld.java similarity index 95% rename from common/src/main/java/common/rng/SimplexGenOld.java rename to server/src/main/java/server/rng/SimplexGenOld.java index e5978952..6fc32a57 100755 --- a/common/src/main/java/common/rng/SimplexGenOld.java +++ b/server/src/main/java/server/rng/SimplexGenOld.java @@ -1,4 +1,6 @@ -package common.rng; +package server.rng; + +import common.rng.Random; class SimplexGenOld { private static final int DIRS[][] = { { 1, 1, 0 }, { -1, 1, 0 }, { 1, -1, 0 }, { -1, -1, 0 }, { 1, 0, 1 }, { -1, 0, 1 }, { 1, 0, -1 }, diff --git a/server/src/main/java/server/world/ChunkServer.java b/server/src/main/java/server/world/ChunkServer.java index 99c7f023..ce2e93fc 100644 --- a/server/src/main/java/server/world/ChunkServer.java +++ b/server/src/main/java/server/world/ChunkServer.java @@ -13,17 +13,16 @@ import common.util.BlockPos; import common.world.BlockArray; import common.world.Chunk; import common.world.State; -import common.world.World; public class ChunkServer extends Chunk { private long lastSave; private long inhabited; - public ChunkServer(World world, int x, int z) { + public ChunkServer(WorldServer world, int x, int z) { super(world, x, z); } - public ChunkServer(World world, char[] data, int height, boolean base, boolean ceil, Random rand, int x, int z) { + public ChunkServer(WorldServer world, char[] data, int height, boolean base, boolean ceil, Random rand, int x, int z) { this(world, x, z); boolean sky = world.dimension.hasSkyLight(); for(int bx = 0; bx < 16; ++bx) { @@ -43,7 +42,6 @@ public class ChunkServer extends Chunk { } } if(base) { - Block caves = world.dimension.getCaveFiller().getBlock(); BlockArray arr = this.getArray(0); if(arr == null) { arr = new BlockArray(0, sky, null); @@ -54,7 +52,7 @@ public class ChunkServer extends Chunk { for(int by = 0; by < 5; ++by) { if(by <= rand.zrange(5)) { Block block = arr.get(bx, by, bz).getBlock(); - if(block == Blocks.air || block.getMaterial().isLiquid() || block == caves) + if(block == Blocks.air || block.getMaterial().isLiquid()) arr.set(bx, by, bz, this.filler); } } diff --git a/server/src/main/java/server/world/Spawner.java b/server/src/main/java/server/world/Spawner.java index 01e5d380..e07e04b3 100755 --- a/server/src/main/java/server/world/Spawner.java +++ b/server/src/main/java/server/world/Spawner.java @@ -4,7 +4,6 @@ import java.util.Set; import common.block.Block; import common.collect.Sets; -import common.dimension.RngSpawn; import common.entity.npc.EntityNPC; import common.entity.npc.EntityWaterNPC; import common.entity.types.EntityLiving; @@ -16,6 +15,7 @@ import common.util.ChunkPos; import common.util.ExtMath; import common.world.World; import server.vars.SVars; +import server.worldgen.RngSpawn; public abstract class Spawner { private static final int MOB_COUNT_DIV = (int)Math.pow(17.0D, 2.0D); diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index afd65162..d3cdbec2 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -12,7 +12,6 @@ import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Predicate; -import common.biome.Biome; import common.block.Block; import common.block.BlockFalling; import common.block.ITileEntityProvider; @@ -20,6 +19,7 @@ import common.block.Material; import common.block.artificial.BlockDoor; import common.block.foliage.BlockFlower; import common.block.foliage.BlockSapling; +import common.block.foliage.LeavesType; import common.block.liquid.BlockLiquid; import common.block.natural.BlockSnow; import common.collect.Lists; @@ -27,11 +27,6 @@ import common.collect.Maps; import common.collect.Sets; import common.dimension.DimType; import common.dimension.Dimension; -import common.dimension.Dimension.GeneratorType; -import common.dimension.Lake; -import common.dimension.Liquid; -import common.dimension.Ore; -import common.dimension.RngSpawn; import common.entity.DamageSource; import common.entity.Entity; import common.entity.EntityTrackerEntry; @@ -51,11 +46,9 @@ import common.packet.SPacketSoundEffect; import common.packet.SPacketParticles; import common.packet.SPacketChangeGameState; import common.packet.SPacketSpawnGlobalEntity; -import common.packet.SPacketBlockBreakAnim; import common.packet.SPacketBlockChange; import common.packet.SPacketCelestials; import common.packet.SPacketMultiBlockChange; -import common.rng.PerlinGen; import common.rng.Random; import common.rng.WeightedList; import common.tags.TagObject; @@ -83,12 +76,13 @@ import common.world.World; import server.Server; import server.clipboard.ClipboardBlock; import server.dimension.Dimensions; +import server.dimension.GeneratorData; import server.init.TeleportRegistry; import server.init.UniverseRegistry; import server.network.Player; +import server.rng.PerlinGen; import server.vars.SVars; import server.village.VillageCollection; -import server.worldgen.BiomeGenPerlin; import server.worldgen.BiomeGenerator; import server.worldgen.BlockReplacer; import server.worldgen.ChunkGenerator; @@ -98,40 +92,13 @@ import server.worldgen.FeatureGenerator; import server.worldgen.FeatureLakes; import server.worldgen.FeatureLiquids; import server.worldgen.FeatureOres; -import server.worldgen.GeneratorCavern; import server.worldgen.GeneratorDestroyed; import server.worldgen.GeneratorFlat; -import server.worldgen.GeneratorIsland; -import server.worldgen.GeneratorPerlin; -import server.worldgen.GeneratorSimple; -import server.worldgen.MobConstants; -import server.worldgen.ReplacerAltSimple; -import server.worldgen.ReplacerAltBiome; -import server.worldgen.ReplacerAltSurface; -import server.worldgen.ReplacerMesa; -import server.worldgen.ReplacerTerranian; -import server.worldgen.ReplacerTopLayer; -import server.worldgen.caves.MapGenBigCaves; -import server.worldgen.caves.MapGenCaves; -import server.worldgen.caves.MapGenRavine; +import server.worldgen.RngSpawn; +import server.worldgen.caves.MapGenBase; 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; -import server.worldgen.structure.MapGenStronghold; +import server.worldgen.structure.MapGenStructure; import server.worldgen.structure.MapGenVillage; import server.worldgen.tree.WorldGenBaseTree; import server.worldgen.tree.WorldGenBigTree; @@ -168,20 +135,16 @@ public final class WorldServer extends AWorldServer { private final List dataList = Lists.newArrayList(); private final List toTick = Lists.newArrayList(); private final PerlinGen tempGen; + public final GeneratorData gen; - private MapGenCaves caveGen; - private MapGenBigCaves bigCaveGen; - private MapGenRavine ravineGen; - private MapGenStronghold strongholdGen; + private MapGenBase[] caveGens; + private MapGenStructure[] structures; private MapGenVillage villageGen; private VillageCollection villageStorage; - private MapGenMineshaft mineshaftGen; - private MapGenScatteredFeature scatteredGen; - private MapGenBridge bridgeGen; private ChunkGenerator generator; private BiomeGenerator biomeGen; private BlockReplacer replacer; - private FeatureDungeons dungeons; + private FeatureDungeons[] features; private Populator populator; private WeightedList mobs; private State liquid; @@ -231,149 +194,67 @@ public final class WorldServer extends AWorldServer { } } - private BiomeGenerator createBiomeGenerator(Random rand) { - return this.dimension.getBiomeSize() > 0 ? new BiomeGenerator(rand.longv(), this.dimension.getDefaultBiome(), this.dimension.isSemiFixed(), this.dimension.getBiomeSize(), this.dimension.getRiverSize(), - this.dimension.getSnowRarity(), this.dimension.getSeaRarity(), this.dimension.getAddBiomes() == null ? new Biome[0] : this.dimension.getAddBiomes(), this.dimension.getAddRarity(), - this.dimension.getHotBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getHotBiomes(), - this.dimension.getMediumBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getMediumBiomes(), - this.dimension.getColdBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getColdBiomes(), - this.dimension.getFrostBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getFrostBiomes()) : null; - } - - private ChunkGenerator createChunkGenerator(Random rand) { - switch(this.dimension.getGeneratorType()) { - case FLAT: - return this.dimension.getLayers() == null ? new GeneratorFlat(this.dimension.getSeaLevel(), this.dimension.getFiller()) : new GeneratorFlat(this.dimension.getLayers()); - case PERLIN: - default: - return this.biomeGen == null ? new GeneratorPerlin(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getNoiseGen(), this.dimension.getDepth(), this.dimension.getScale()) : - new GeneratorPerlin(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getNoiseGen()); - case SIMPLE: - return new GeneratorSimple(rand, this.dimension.getFiller(), this.dimension.getLiquid(), - this.biomeGen != null ? null : new BiomeGenPerlin(rand.longv())); - case ISLAND: - return new GeneratorIsland(rand, this.dimension.getFiller()); - case CAVERN: - return new GeneratorCavern(rand, this.dimension.getFiller(), this.dimension.getLiquid()); - case DESTROYED: - return new GeneratorDestroyed(this.dimension.getSeaLevel()); + private void initGenerator(boolean exterminated) { + this.dataList.clear(); + this.dataMap.clear(); + this.grng.setSeed(this.seed); + this.gen.init(this.dimension); + this.liquid = exterminated ? Blocks.air.getState() : this.dimension.getLiquid(); + this.biomeGen = exterminated ? null : this.gen.getBiomeGen(); + if(this.biomeGen != null) + this.biomeGen.init(this.grng.longv()); + this.generator = exterminated ? new GeneratorDestroyed() : (this.gen.getGenerator() == null ? new GeneratorFlat(new State[0]) : this.gen.getGenerator()); + this.generator.init(this.grng, this.dimension, this.gen); + this.replacer = exterminated ? null : this.gen.getReplacer(); + if(this.replacer != null) + this.replacer.init(this.grng, this.dimension, this.gen); + this.populator = exterminated ? null : this.gen.getPopulator(); + this.caveGens = exterminated || this.gen.getCaveGens().isEmpty() ? null : this.gen.getCaveGens().toArray(new MapGenBase[this.gen.getCaveGens().size()]); + if(this.caveGens != null) { + for(MapGenBase gen : this.caveGens) { + gen.init(this.dimension, this.gen); + } } - } - - private BlockReplacer createBlockReplacer(Random rand) { - switch(this.dimension.getReplacerType()) { - case TERRANIAN: - default: - return new ReplacerTerranian(rand, this.dimension.getSurface(), this.dimension.getTop(), this.dimension.getFiller(), this.dimension.getAlt1(), this.dimension.getAlt2(), this.dimension.getLiquid(), this.dimension.getSeaLevel()); - case MESARIAN: - return new ReplacerMesa(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getSeaLevel(), this.dimension.getSurface()); - case ALT_SIMPLE: - return new ReplacerAltSimple(rand, this.dimension.getSurface(), this.dimension.getTop(), this.dimension.getFiller(), this.dimension.getAlt1(), this.dimension.getLiquid(), this.dimension.getSeaLevel()); - case SIMPLE: - return new ReplacerAltBiome(rand, this.dimension.getSurface(), this.dimension.getTop(), this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getAlt2(), this.dimension.getAlt1()); - case ALTERNATE: - return new ReplacerAltSurface(rand, this.dimension.getFiller(), this.dimension.getAlt1(), this.dimension.getAlt2(), this.dimension.getLiquid()); - case TOPLAYER: - return new ReplacerTopLayer(this.dimension.getSurface(), this.dimension.getFiller().getBlock()); - case NONE: - return null; + this.base = !exterminated && this.dimension.getFiller().getBlock() != Blocks.air && !(this.generator instanceof GeneratorFlat); + this.ceil = !exterminated && this.gen.hasWorldCeiling(); + this.mobs = exterminated || this.gen.getSpawns().isEmpty() ? null : this.gen.getSpawns(); + this.snow = !exterminated && this.gen.hasSnow(); + this.structures = exterminated || this.gen.getStructures().isEmpty() ? null : this.gen.getStructures().toArray(new MapGenStructure[this.gen.getStructures().size()]); + this.seaLevel = this.dimension.getSeaLevel(); + this.ores = exterminated || this.gen.getOres().isEmpty() ? null : this.gen.getOres().toArray(new FeatureOres[this.gen.getOres().size()]); + this.lakes = exterminated || this.gen.getLakes().isEmpty() ? null : this.gen.getLakes().toArray(new FeatureLakes[this.gen.getLakes().size()]); + this.liquids = exterminated || this.gen.getLiquids().isEmpty() ? null : this.gen.getLiquids().toArray(new FeatureLiquids[this.gen.getLiquids().size()]); + this.features = exterminated || this.gen.getFeatures().isEmpty() ? null : this.gen.getFeatures().toArray(new FeatureDungeons[this.gen.getFeatures().size()]); + this.height = this.generator.getMaximumHeight(); + this.size = this.dimension.getSize() / 16; + this.villageGen = null; + this.villageStorage = null; + if(this.structures != null) { + for(MapGenStructure gen : this.structures) { + if(gen instanceof MapGenVillage village) { + this.villageGen = village; + TagObject tag = null; + try { + File dat = new File(this.chunkDir, "villages.cdt"); + if(dat.exists() && dat.isFile()) + tag = TagObject.readGZip(dat); + } + catch(Exception e) { + Log.IO.error(e, "Konnte Dorfliste nicht laden"); + } + this.villageStorage = new VillageCollection(tag); + break; + } + } } } - - private Populator createPopulator() { - switch(this.dimension.getPopulatorType()) { - case NONE: - return null; - case MESARIAN: - 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(); - } - } - - private FeatureDungeons createDungeonGenerator() { - return this.dimension.getDungeons() > 0 ? new FeatureDungeons(this.dimension.getDungeons()) : null; - } - - private MapGenCaves createCaveGenerator() { - return this.dimension.hasCaves() ? - (new MapGenCaves(this.dimension.getCaveFiller(), this.dimension.getFiller().getBlock(), this.dimension.getTop().getBlock(), - this.dimension.getSurface(), this.dimension.getAlt1().getBlock())) : null; - } - - private MapGenRavine createRavineGenerator() { - return this.dimension.hasRavines() ? - (new MapGenRavine(this.dimension.getCaveFiller(), this.dimension.getFiller().getBlock(), - this.dimension.getTop().getBlock(), this.dimension.getSurface())) : null; - } - - private MapGenBigCaves createBigCaveGenerator() { - return this.dimension.hasStrideCaves() ? - (new MapGenBigCaves(this.dimension.getFiller().getBlock(), - this.dimension.getTop().getBlock(), this.dimension.getSurface().getBlock())) : null; - } - - private FeatureOres[] createOres() { - if(this.dimension.getOres().isEmpty()) - return null; - FeatureOres[] gens = new FeatureOres[this.dimension.getOres().size()]; - for(int z = 0; z < gens.length; z++) { - Ore gen = this.dimension.getOres().get(z); - gens[z] = new FeatureOres(gen.state(), gen.count(), gen.more(), gen.size(), gen.min(), gen.max(), gen.dist()); - } - return gens; - } - - private FeatureLakes[] createLakes() { - if(this.dimension.getLakes().isEmpty()) - return null; - FeatureLakes[] gens = new FeatureLakes[this.dimension.getLakes().size()]; - for(int z = 0; z < gens.length; z++) { - Lake gen = this.dimension.getLakes().get(z); - gens[z] = new FeatureLakes(gen.state(), gen.filler(), gen.top(), gen.chance(), gen.minHeight(), gen.maxHeight(), gen.ratiod()); - } - return gens; - } - - private FeatureLiquids[] createLiquids() { - if(this.dimension.getLiquids().isEmpty()) - return null; - FeatureLiquids[] gens = new FeatureLiquids[this.dimension.getLiquids().size()]; - for(int z = 0; z < gens.length; z++) { - Liquid gen = this.dimension.getLiquids().get(z); - gens[z] = new FeatureLiquids(gen.state(), gen.chance(), gen.minHeight(), gen.maxHeight(), gen.lower()); - } - return gens; - } - public WorldServer(Server server, long dtime, Dimension dim) { + public WorldServer(Server server, long dtime, Dimension dim, GeneratorData gen) { super(dim); this.server = server; // this.time = time; this.daytime = dtime; + this.gen = gen; this.updateViewRadius(); this.chunkDir = new File(new File("chunk"), UniverseRegistry.getName(dim)); this.chunkDir.mkdirs(); @@ -416,7 +297,7 @@ public final class WorldServer extends AWorldServer { if(this.biomeGen != null) this.biomeGen.cleanupCache(); // this.profiler.start("mobSpawner"); - if((this.mobs != null || this.bridgeGen != null || this.scatteredGen != null) && Vars.mobs && SVars.tickSpawn) { + if(this.mobs != null && Vars.mobs && SVars.tickSpawn) { Spawner.spawn(this); } // this.profiler.next("chunkSource"); @@ -503,11 +384,6 @@ public final class WorldServer extends AWorldServer { } private WeightedList getSpawnTypes(BlockPos pos) { - if(this.bridgeGen != null && (this.bridgeGen.isPresent(pos) - || (this.bridgeGen.isPositionInStructure(this, pos) && this.getState(pos.down()).getBlock() == Blocks.blood_brick))) - return MobConstants.FORTRESS_MOBS; - else if(this.scatteredGen != null && this.scatteredGen.hasMageHut(pos)) - return MobConstants.MAGEHUT_MOBS; return this.mobs; } @@ -1250,20 +1126,10 @@ public final class WorldServer extends AWorldServer { ChunkServer chunk = Region.readChunk(this, x, z, tag); if(chunk != null) { chunk.setSaved(this.time); - if(this.mineshaftGen != null) { - this.mineshaftGen.generate(this, x, z, null); - } - if(this.villageGen != null) { - this.villageGen.generate(this, x, z, null); - } - if(this.strongholdGen != null) { - this.strongholdGen.generate(this, x, z, null); - } - if(this.scatteredGen != null) { - this.scatteredGen.generate(this, x, z, null); - } - if(this.bridgeGen != null) { - this.bridgeGen.generate(this, x, z, null); + if(this.structures != null) { + for(MapGenStructure gen : this.structures) { + gen.generate(this, x, z, null); + } } } return chunk; @@ -1400,28 +1266,24 @@ public final class WorldServer extends AWorldServer { this.grng.setSeed((long)x * sx + (long)z * sz ^ this.seed); boolean lakes = true; ChunkPos coord = new ChunkPos(x, z); - if(this.bridgeGen != null) { - this.bridgeGen.generateStructure(this, this.grng, coord); - } - if(this.mineshaftGen != null) { - this.mineshaftGen.generateStructure(this, this.grng, coord); - } - if(this.villageGen != null) { - lakes = !this.villageGen.generateStructure(this, this.grng, coord); - } - if(this.strongholdGen != null) { - this.strongholdGen.generateStructure(this, this.grng, coord); - } - if(this.scatteredGen != null) { - this.scatteredGen.generateStructure(this, this.grng, coord); + if(this.structures != null) { + for(MapGenStructure gen : this.structures) { + if(gen == this.villageGen) + lakes = !gen.generateStructure(this, this.grng, coord); + else + gen.generateStructure(this, this.grng, coord); + } + // TODO: check id lakes check on village is really necessary } if(lakes && this.lakes != null && (this.populator == null || this.populator.canGenerateLakes())) { for(FeatureLakes lake : this.lakes) { lake.generate(this, this.grng, pos); } } - if(this.dungeons != null) { - this.dungeons.generate(this, this.grng, pos); + if(this.features != null) { + for(FeatureDungeons feat : this.features) { + feat.generate(this, this.grng, pos); + } } if(this.ores != null) { for(FeatureOres ore : this.ores) { @@ -1471,29 +1333,15 @@ public final class WorldServer extends AWorldServer { if(this.replacer != null) { this.replacer.replaceBlocks(this, x, z, primer, this.grng); } - if(this.caveGen != null) { - this.caveGen.generate(this, x, z, primer); + if(this.caveGens != null) { + for(MapGenBase gen : this.caveGens) { + gen.generate(this, x, z, primer); + } } - if(this.bigCaveGen != null) { - this.bigCaveGen.generate(this, x, z, primer); - } - if(this.ravineGen != null) { - this.ravineGen.generate(this, x, z, primer); - } - if(this.bridgeGen != null) { - this.bridgeGen.generate(this, x, z, primer); - } - if(this.mineshaftGen != null) { - this.mineshaftGen.generate(this, x, z, primer); - } - if(this.villageGen != null) { - this.villageGen.generate(this, x, z, primer); - } - if(this.strongholdGen != null) { - this.strongholdGen.generate(this, x, z, primer); - } - if(this.scatteredGen != null) { - this.scatteredGen.generate(this, x, z, primer); + if(this.structures != null) { + for(MapGenStructure gen : this.structures) { + gen.generate(this, x, z, null); + } } return new ChunkServer(this, primer.getData(), primer.height, this.base, this.ceil, this.grng, x, z); } @@ -1629,49 +1477,6 @@ public final class WorldServer extends AWorldServer { } } - private void initGenerator(boolean exterminated) { - this.grng.setSeed(this.seed); - this.liquid = exterminated ? Blocks.air.getState() : this.dimension.getLiquid(); - this.biomeGen = exterminated ? null : this.createBiomeGenerator(this.grng); - this.generator = exterminated ? new GeneratorDestroyed(this.dimension.getSeaLevel()) : this.createChunkGenerator(this.grng); - this.replacer = exterminated ? null : this.createBlockReplacer(this.grng); - this.populator = exterminated ? null : this.createPopulator(); - this.caveGen = exterminated ? null : this.createCaveGenerator(); - this.bigCaveGen = exterminated ? null : this.createBigCaveGenerator(); - this.ravineGen = exterminated ? null : this.createRavineGenerator(); - this.base = !exterminated && this.dimension.getFiller().getBlock() != Blocks.air && this.dimension.getGeneratorType() != GeneratorType.FLAT; - this.ceil = !exterminated && this.dimension.hasWorldCeiling(); - this.mobs = exterminated || this.dimension.getSpawns().isEmpty() ? null : this.dimension.getSpawns(); - this.snow = !exterminated && this.dimension.hasSnow(); - this.strongholdGen = !exterminated && this.dimension.hasStrongholds() ? new MapGenStronghold() : null; - this.villageGen = !exterminated && this.dimension.hasVillages() ? new MapGenVillage() : null; - this.mineshaftGen = !exterminated && this.dimension.hasMineshafts() ? new MapGenMineshaft() : null; - this.scatteredGen = !exterminated && this.dimension.hasScattered() ? new MapGenScatteredFeature() : null; - this.bridgeGen = !exterminated && this.dimension.hasFortresses() ? new MapGenBridge() : null; - this.seaLevel = this.dimension.getSeaLevel(); - this.ores = exterminated ? null : this.createOres(); - this.lakes = exterminated ? null : this.createLakes(); - this.liquids = exterminated ? null : this.createLiquids(); - this.dungeons = exterminated ? null : this.createDungeonGenerator(); - this.height = this.generator.getMaximumHeight(); - this.size = this.dimension.getSize() / 16; - if(this.villageGen != null) { - TagObject tag = null; - try { - File dat = new File(this.chunkDir, "villages.cdt"); - if(dat.exists() && dat.isFile()) - tag = TagObject.readGZip(dat); - } - catch(Exception e) { - Log.IO.error(e, "Konnte Dorfliste nicht laden"); - } - this.villageStorage = new VillageCollection(tag); - } - else { - this.villageStorage = null; - } - } - public static String getLoadedInfo(Server server) { int chunks = 0; int entities = 0; @@ -2391,6 +2196,12 @@ public final class WorldServer extends AWorldServer { public float getGenHumidity(int x, int z) { return this.biomeGen == null ? 50.0f : this.biomeGen.getBiomeAt(x, z).humidity; } + + public LeavesType getLeavesGen(BlockPos pos) { + return this.canFreezeAt(pos) ? LeavesType.SNOWY : (!this.dimension.hasSeasons() ? + this.gen.getLeavesType() : LeavesType.values()[(int)((this.daytime % + this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]); + } // public boolean canBlockSeeSky(BlockPos pos) { // if(pos.getY() >= this.getSeaLevel()) { diff --git a/common/src/main/java/common/biome/Biome.java b/server/src/main/java/server/worldgen/Biome.java similarity index 84% rename from common/src/main/java/common/biome/Biome.java rename to server/src/main/java/server/worldgen/Biome.java index bb994953..5af15db4 100644 --- a/common/src/main/java/common/biome/Biome.java +++ b/server/src/main/java/server/worldgen/Biome.java @@ -1,4 +1,4 @@ -package common.biome; +package server.worldgen; public final class Biome { public final float temperature; @@ -24,4 +24,8 @@ public final class Biome { public Biome(float temperature, float humidity) { this(temperature, humidity, Scaling.VARYING_LOW); } + + public Biome copy() { + return new Biome(this.temperature, this.humidity, this.depth, this.scale); + } } diff --git a/server/src/main/java/server/worldgen/BiomeGenPerlin.java b/server/src/main/java/server/worldgen/BiomeGenPerlin.java index 3cde62c7..48f42e6b 100755 --- a/server/src/main/java/server/worldgen/BiomeGenPerlin.java +++ b/server/src/main/java/server/worldgen/BiomeGenPerlin.java @@ -1,7 +1,7 @@ package server.worldgen; -import common.rng.PerlinGenOld; import common.rng.Random; +import server.rng.PerlinGenOld; public class BiomeGenPerlin { private final PerlinGenOld tempNoiseGen; diff --git a/server/src/main/java/server/worldgen/BiomeGenerator.java b/server/src/main/java/server/worldgen/BiomeGenerator.java index 9f629581..11c26e4f 100755 --- a/server/src/main/java/server/worldgen/BiomeGenerator.java +++ b/server/src/main/java/server/worldgen/BiomeGenerator.java @@ -1,8 +1,7 @@ package server.worldgen; import java.util.List; -import common.biome.Biome; -import common.biome.Scaling; + import common.collect.Lists; import common.util.BlockPos; import common.util.LongHashMap; @@ -55,10 +54,21 @@ public class BiomeGenerator { private final Biome defBiome; private long lastCleanupTime; - 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) { + public BiomeGenerator(Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity) { + this(def, fixed, biomeSize, riverSize, snowRarity, seaRarity, new Biome[0], 1, new Biome[] {def.copy()}, new Biome[] {def.copy()}, new Biome[] {def.copy()}, new Biome[] {def.copy()}); + } + + public BiomeGenerator(Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity, Biome[] add, int addRarity) { + this(def, fixed, biomeSize, riverSize, snowRarity, seaRarity, add, addRarity, new Biome[] {def.copy()}, new Biome[] {def.copy()}, new Biome[] {def.copy()}, new Biome[] {def.copy()}); + } + + public BiomeGenerator(Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity, Biome[] hot, Biome[] medium, Biome[] cold, Biome[] frost) { + this(def, fixed, biomeSize, riverSize, snowRarity, seaRarity, new Biome[0], 1, hot, medium, cold, frost); + } + + public BiomeGenerator(Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity, Biome[] add, int addRarity, Biome[] hot, Biome[] medium, Biome[] cold, Biome[] frost) { this.biomes = new Biome[6 + hot.length + medium.length + cold.length + frost.length + add.length]; - this.biomes[GenLayer.NONE] = new Biome(def.temperature, def.humidity, def.depth, def.scale); + this.biomes[GenLayer.NONE] = def.copy(); 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); @@ -122,13 +132,16 @@ public class BiomeGenerator { GenLayerRiverMix layerOut = new GenLayerRiverMix(100L, layer25n, layer24a, def, frost); GenLayer layerIndex = // perlinGen ? new GenLayerRiverMix(100L, layer25n, layer24a) : new GenLayerVoronoiZoom(10L, layerOut); - layerOut.initWorldGenSeed(seed); - layerIndex.initWorldGenSeed(seed); // return new GenLayer[] {layerOut, layerIndex}; this.genBiomes = layerOut; this.biomeIndexLayer = layerIndex; } + public void init(long seed) { + this.genBiomes.initWorldGenSeed(seed); + this.biomeIndexLayer.initWorldGenSeed(seed); + } + private CacheBlock getBiomeCacheBlock(int x, int z) { x = x >> 4; diff --git a/server/src/main/java/server/worldgen/BlockReplacer.java b/server/src/main/java/server/worldgen/BlockReplacer.java index b51db465..4cc6dc6b 100755 --- a/server/src/main/java/server/worldgen/BlockReplacer.java +++ b/server/src/main/java/server/worldgen/BlockReplacer.java @@ -1,8 +1,18 @@ package server.worldgen; +import common.dimension.Dimension; import common.rng.Random; +import common.world.State; +import server.dimension.GeneratorData; import server.world.WorldServer; public interface BlockReplacer { - public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand); + void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand); + void init(Random rand, Dimension dim, GeneratorData gen); + default State getTop() { + return null; + } + default State getSurface() { + return null; + } } diff --git a/server/src/main/java/server/worldgen/ChunkGenerator.java b/server/src/main/java/server/worldgen/ChunkGenerator.java index fd6f6856..032ac12d 100755 --- a/server/src/main/java/server/worldgen/ChunkGenerator.java +++ b/server/src/main/java/server/worldgen/ChunkGenerator.java @@ -1,8 +1,12 @@ package server.worldgen; +import common.dimension.Dimension; +import common.rng.Random; +import server.dimension.GeneratorData; import server.world.WorldServer; public interface ChunkGenerator { public void generateChunk(WorldServer world, int x, int z, ChunkPrimer primer); public int getMaximumHeight(); + public void init(Random rand, Dimension dim, GeneratorData gen); } diff --git a/server/src/main/java/server/worldgen/FeatureLakes.java b/server/src/main/java/server/worldgen/FeatureLakes.java index bb94eb1f..f31d5bcf 100755 --- a/server/src/main/java/server/worldgen/FeatureLakes.java +++ b/server/src/main/java/server/worldgen/FeatureLakes.java @@ -108,7 +108,7 @@ public class FeatureLakes } } - Block replace = this.top != null ? worldIn.dimension.getSurface().getBlock() : null; + Block replace = this.top != null ? worldIn.gen.getSurface().getBlock() : null; boolean useTop = false; for (int k1 = 0; k1 < 16; ++k1) @@ -156,7 +156,7 @@ public class FeatureLakes } if(useTop) { - replace = worldIn.dimension.getTop().getBlock(); + replace = worldIn.gen.getTop().getBlock(); for (int i2 = 0; i2 < 16; ++i2) { for (int j3 = 0; j3 < 16; ++j3) diff --git a/server/src/main/java/server/worldgen/GeneratorCavern.java b/server/src/main/java/server/worldgen/GeneratorCavern.java index 12f221bd..82e06070 100755 --- a/server/src/main/java/server/worldgen/GeneratorCavern.java +++ b/server/src/main/java/server/worldgen/GeneratorCavern.java @@ -1,43 +1,34 @@ package server.worldgen; -import common.rng.OctaveGen; +import common.dimension.Dimension; import common.rng.Random; import common.util.ExtMath; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.OctaveGen; import server.world.WorldServer; public class GeneratorCavern implements ChunkGenerator { - private final OctaveGen noiseGen2; - private final OctaveGen noiseGen3; - private final OctaveGen noiseGen1; -// private final OctaveGen noiseGen4; -// private final OctaveGen noiseGen5; + private OctaveGen noiseGen2; + private OctaveGen noiseGen3; + private OctaveGen noiseGen1; private final double[] noiseField = new double[425]; private final double[] noiseData1 = new double[425]; private final double[] noiseData2 = new double[425]; private final double[] noiseData3 = new double[425]; -// private final double[] noiseData4 = new double[25]; -// private final double[] noiseData5 = new double[25]; - private final State filler; - private final State liquid; + private State filler; + private State liquid; -// public GeneratorCavern(Dimension dim, Random rand) { -// this(rand); -// } - - public GeneratorCavern(Random rand, State filler, State liquid) - { + public void init(Random rand, Dimension dim, GeneratorData gen) { this.noiseGen2 = new OctaveGen(rand, 16); this.noiseGen3 = new OctaveGen(rand, 16); this.noiseGen1 = new OctaveGen(rand, 8); -// this.noiseGen4 = new OctaveGen(rand, 10); -// this.noiseGen5 = new OctaveGen(rand, 16); - this.filler = filler; - this.liquid = liquid; - } + this.filler = dim.getFiller(); + this.liquid = dim.getLiquid(); + } public int getMaximumHeight() { return 128; diff --git a/server/src/main/java/server/worldgen/GeneratorDestroyed.java b/server/src/main/java/server/worldgen/GeneratorDestroyed.java index cfaf3191..28527400 100755 --- a/server/src/main/java/server/worldgen/GeneratorDestroyed.java +++ b/server/src/main/java/server/worldgen/GeneratorDestroyed.java @@ -1,8 +1,10 @@ package server.worldgen; +import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; import server.world.WorldServer; public class GeneratorDestroyed implements ChunkGenerator @@ -12,12 +14,12 @@ public class GeneratorDestroyed implements ChunkGenerator private final State gap = Blocks.air.getState(); private final State liquid = Blocks.lava.getState(); private final State top = Blocks.obsidian.getState(); - private final int height; + private int height; private final Random rand = new Random(); // NON-DETERMINISTIC!! - public GeneratorDestroyed(int height) { - this.height = height; - } + public void init(Random rand, Dimension dim, GeneratorData gen) { + this.height = dim.getSeaLevel(); + } public int getMaximumHeight() { return this.height; diff --git a/server/src/main/java/server/worldgen/GeneratorFlat.java b/server/src/main/java/server/worldgen/GeneratorFlat.java index 668e6518..82485745 100755 --- a/server/src/main/java/server/worldgen/GeneratorFlat.java +++ b/server/src/main/java/server/worldgen/GeneratorFlat.java @@ -1,12 +1,20 @@ package server.worldgen; import java.util.Arrays; +import java.util.List; +import common.collect.Lists; +import common.dimension.Dimension; +import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; import server.world.WorldServer; public class GeneratorFlat implements ChunkGenerator { - private final State[] layers; + private State[] layers; + + public GeneratorFlat() { + } public GeneratorFlat(State ... layers) { this.layers = layers; @@ -16,22 +24,33 @@ public class GeneratorFlat implements ChunkGenerator { this.layers = new State[height]; Arrays.fill(this.layers, layer); } - -// public GeneratorFlat(GeneratorSettings settings) -// { -// int layers = 0; -// for(FlatSettings layer : settings.flatLayers) { -// layers += layer.height; -// } -// layers = layers > 512 ? 512 : layers; -// this.flatLayers = new IBlockState[layers]; -// int pos = 0; -// for(FlatSettings layer : settings.flatLayers) { -// for(int z = 0; z < layer.height; z++) { -// this.flatLayers[pos++] = layer.state; -// } -// } -// } + + public GeneratorFlat(Object ... data) { + List states = Lists.newArrayList(); + int height = 1; + for(Object obj : data) { + if(obj instanceof Integer) + height = (Integer)obj; + else if(obj instanceof State) { + for(int z = 0; z < height; z++) { + states.add((State)obj); + } + height = 1; + } + else + throw new IllegalArgumentException("Argument muss Integer oder State sein"); + } + if(states.size() > 512) + throw new IllegalArgumentException("Es können höchstens 512 Schichten definiert werden"); + this.layers = states.toArray(new State[states.size()]); + } + + public void init(Random rand, Dimension dim, GeneratorData gen) { + if(this.layers == null) { + this.layers = new State[dim.getSeaLevel()]; + Arrays.fill(this.layers, dim.getFiller()); + } + } public int getMaximumHeight() { return this.layers.length; diff --git a/server/src/main/java/server/worldgen/GeneratorIsland.java b/server/src/main/java/server/worldgen/GeneratorIsland.java index 639b28ea..7bc89589 100755 --- a/server/src/main/java/server/worldgen/GeneratorIsland.java +++ b/server/src/main/java/server/worldgen/GeneratorIsland.java @@ -1,18 +1,20 @@ package server.worldgen; -import common.rng.OctaveGen; +import common.dimension.Dimension; import common.rng.Random; import common.util.ExtMath; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.OctaveGen; import server.world.WorldServer; public class GeneratorIsland implements ChunkGenerator { - private final OctaveGen noiseGen1; - private final OctaveGen noiseGen2; - private final OctaveGen noiseGen3; - private final OctaveGen noiseGen4; - private final OctaveGen noiseGen5; + private OctaveGen noiseGen1; + private OctaveGen noiseGen2; + private OctaveGen noiseGen3; + private OctaveGen noiseGen4; + private OctaveGen noiseGen5; private final double[] densities = new double[297]; private final double[] noiseData1 = new double[297]; @@ -21,21 +23,16 @@ public class GeneratorIsland implements ChunkGenerator private final double[] noiseData4 = new double[9]; private final double[] noiseData5 = new double[9]; - private final State filler; + private State filler; -// public GeneratorIsland(Dimension dim, Random rand) { -// this(rand, dim.getFiller()); -// } - - public GeneratorIsland(Random rand, State filler) - { + public void init(Random rand, Dimension dim, GeneratorData gen) { this.noiseGen1 = new OctaveGen(rand, 16); this.noiseGen2 = new OctaveGen(rand, 16); this.noiseGen3 = new OctaveGen(rand, 8); this.noiseGen4 = new OctaveGen(rand, 10); this.noiseGen5 = new OctaveGen(rand, 16); - this.filler = filler; - } + this.filler = dim.getFiller(); + } public int getMaximumHeight() { return 128; diff --git a/server/src/main/java/server/worldgen/GeneratorPerlin.java b/server/src/main/java/server/worldgen/GeneratorPerlin.java index c916cc77..3bff3ba8 100755 --- a/server/src/main/java/server/worldgen/GeneratorPerlin.java +++ b/server/src/main/java/server/worldgen/GeneratorPerlin.java @@ -3,11 +3,12 @@ package server.worldgen; import java.util.Arrays; import common.dimension.Dimension; -import common.rng.NoiseGen; -import common.rng.OctaveGen; import common.rng.Random; import common.util.ExtMath; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.NoiseGen; +import server.rng.OctaveGen; import server.world.WorldServer; public class GeneratorPerlin implements ChunkGenerator @@ -24,13 +25,14 @@ public class GeneratorPerlin implements ChunkGenerator } } } - - private final NoiseGen lowerNoiseGen; - private final NoiseGen upperNoiseGen; - private final NoiseGen mainNoiseGen; - private final NoiseGen depthNoiseGen; - private final State block; - private final State liquid; + + private final boolean biomes; + private NoiseGen lowerNoiseGen; + private NoiseGen upperNoiseGen; + private NoiseGen mainNoiseGen; + private NoiseGen depthNoiseGen; + private State block; + private State liquid; private final float coordinateScale; private final float heightScale; private final float upperLimitScale; @@ -54,43 +56,41 @@ public class GeneratorPerlin implements ChunkGenerator private final double[] depthNoise = new double[25]; private final float[] depths = new float[100]; private final float[] scales = new float[100]; - -// public GeneratorNew(Random rand, GeneratorSettings settings) -// { -// this(rand, settings.farlands, settings.seaLevel, Blocks.stone.getDefaultState(), -// settings.useLavaSeas ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(), -// settings.coordinateScale, settings.heightScale, settings.upperLimitScale, settings.lowerLimitScale, -// settings.depthNoiseScaleX, settings.depthNoiseScaleZ, settings.amplification, settings.mainNoiseScaleX, -// settings.mainNoiseScaleY, settings.mainNoiseScaleZ, settings.baseSize, settings.stretchY, settings.biomeDepthWeight, -// settings.biomeDepthOffset, settings.biomeScaleWeight, settings.biomeScaleOffset); -// } - public GeneratorPerlin(Random rand, State block, State liquid, Dimension.GeneratorSettings settings, float depth, float scale) { - this(rand, block, liquid, settings); + public GeneratorPerlin(float depth, float scale) { + this(new GeneratorSettings(), depth, scale); + } + + public GeneratorPerlin() { + this(new GeneratorSettings(), 0.1f, 0.2f); + } + + public GeneratorPerlin(boolean biomes) { + this(biomes, new GeneratorSettings()); + } + + public GeneratorPerlin(GeneratorSettings settings, float depth, float scale) { + this(false, settings); Arrays.fill(this.depths, depth); Arrays.fill(this.scales, scale); } - public GeneratorPerlin(Random rand, State block, State liquid, Dimension.GeneratorSettings settings) { - this(rand, /* dim.hasFarLands(), dim.getSeaLevel(), */ block, liquid, - settings.coordinateScale, settings.heightScale, settings.upperLimitScale, settings.lowerLimitScale, + public GeneratorPerlin(GeneratorSettings settings) { + this(true, settings); + } + + public GeneratorPerlin(boolean biomes, GeneratorSettings settings) { + this(biomes, settings.coordinateScale, settings.heightScale, settings.upperLimitScale, settings.lowerLimitScale, settings.depthNoiseScaleX, settings.depthNoiseScaleZ, settings.amplification, settings.mainNoiseScaleX, settings.mainNoiseScaleY, settings.mainNoiseScaleZ, settings.baseSize, settings.stretchY, settings.biomeDepthWeight, settings.biomeDepthOffset, settings.biomeScaleWeight, settings.biomeScaleOffset); -// 684.412F, 684.412F, 512.0F, 512.0F, 200.0F, 200.0F, 0.0F, 80.0F, 160.0F, 80.0F, 8.5F, 12.0F, 1.0F, 0.0F, 1.0F, 0.0F); } - private GeneratorPerlin(Random rand, /* boolean farlands, int seaLevel, */ State block, State liquid, - float coordinateScale, float heightScale, float upperLimitScale, float lowerLimitScale, float depthNoiseScaleX, + private GeneratorPerlin(boolean biomes, float coordinateScale, float heightScale, float upperLimitScale, float lowerLimitScale, float depthNoiseScaleX, float depthNoiseScaleZ, float amplification, float mainNoiseScaleX, float mainNoiseScaleY, float mainNoiseScaleZ, float baseSize, float stretchY, float biomeDepthWeight, float biomeDepthOffset, float biomeScaleWeight, float biomeScaleOffset) - { - this.lowerNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); - this.upperNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); - this.mainNoiseGen = /* farlands ? new OctaveGenOld(rand, 8) : */ new OctaveGen(rand, 8); - this.depthNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); - this.liquid = liquid; - this.block = block; + { + this.biomes = biomes; this.coordinateScale = coordinateScale; this.heightScale = heightScale; this.upperLimitScale = upperLimitScale; @@ -109,6 +109,15 @@ public class GeneratorPerlin implements ChunkGenerator this.biomeScaleOffset = biomeScaleOffset; } + public void init(Random rand, Dimension dim, GeneratorData gen) { + this.lowerNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); + this.upperNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); + this.mainNoiseGen = /* farlands ? new OctaveGenOld(rand, 8) : */ new OctaveGen(rand, 8); + this.depthNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); + this.block = dim.getFiller(); + this.liquid = dim.getLiquid(); + } + public int getMaximumHeight() { return 256; } @@ -116,7 +125,7 @@ public class GeneratorPerlin implements ChunkGenerator public void generateChunk(WorldServer world, int x, int z, ChunkPrimer primer) { int sea = world.getSeaLevel(); - if(world.getBiomeGenerator() != null) + if(this.biomes && world.getBiomeGenerator() != null) world.getBiomeGenerator().genScaling(this.depths, this.scales, x * 4 - 2, z * 4 - 2, 10, 10); this.genNoisemap(x * 4, 0, z * 4); diff --git a/server/src/main/java/server/worldgen/GeneratorSettings.java b/server/src/main/java/server/worldgen/GeneratorSettings.java new file mode 100644 index 00000000..b205497f --- /dev/null +++ b/server/src/main/java/server/worldgen/GeneratorSettings.java @@ -0,0 +1,20 @@ +package server.worldgen; + +public class GeneratorSettings { + public float coordinateScale = 684.412F; + public float heightScale = 684.412F; + public float upperLimitScale = 512.0F; + public float lowerLimitScale = 512.0F; + public float depthNoiseScaleX = 200.0F; + public float depthNoiseScaleZ = 200.0F; + public float amplification = 0.0F; + public float mainNoiseScaleX = 80.0F; + public float mainNoiseScaleY = 160.0F; + public float mainNoiseScaleZ = 80.0F; + public float baseSize = 8.5F; + public float stretchY = 12.0F; + public float biomeDepthWeight = 1.0F; + public float biomeDepthOffset = 0.0F; + public float biomeScaleWeight = 1.0F; + public float biomeScaleOffset = 0.0F; +} \ No newline at end of file diff --git a/server/src/main/java/server/worldgen/GeneratorSimple.java b/server/src/main/java/server/worldgen/GeneratorSimple.java index 8f51cdfa..f51b9267 100755 --- a/server/src/main/java/server/worldgen/GeneratorSimple.java +++ b/server/src/main/java/server/worldgen/GeneratorSimple.java @@ -1,24 +1,25 @@ package server.worldgen; -import java.util.Arrays; - -import common.rng.NoiseGen; -import common.rng.OctaveGen; +import common.dimension.Dimension; import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.NoiseGen; +import server.rng.OctaveGen; import server.world.WorldServer; public class GeneratorSimple implements ChunkGenerator { - private final BiomeGenPerlin biomeGen; - private final NoiseGen lowerNoiseGen; - private final NoiseGen upperNoiseGen; - private final NoiseGen mainNoiseGen; - private final NoiseGen biomeNoiseGen; - private final NoiseGen depthNoiseGen; + private final boolean biomes; + private BiomeGenPerlin biomeGen; + private NoiseGen lowerNoiseGen; + private NoiseGen upperNoiseGen; + private NoiseGen mainNoiseGen; + private NoiseGen biomeNoiseGen; + private NoiseGen depthNoiseGen; - private final State filler; - private final State liquid; + private State filler; + private State liquid; private final double noiseTable[] = new double[425]; private final double mainNoise[] = new double[425]; private final double lowerNoise[] = new double[425]; @@ -26,31 +27,22 @@ public class GeneratorSimple implements ChunkGenerator private final double biomeNoise[] = new double[25]; private final double depthNoise[] = new double[25]; private final double[] factors = new double[256]; - -// public GeneratorSimple(long seed, Random rand, GeneratorSettings settings) -// { -// this(rand, settings.farlands, Blocks.stone.getDefaultState(), -// settings.useLavaSeas ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(), -// settings.biomeMode == 2 ? new BiomeGenPerlin(seed) : null); -// } - -// public GeneratorSimple(Dimension dim, Random rand) -// { -// this(rand, /* dim.hasFarLands(), */ dim.getFiller(), dim.getLiquid(), -// dim.hasBiomes() ? null : new BiomeGenPerlin(rand.longv())); -// } - public GeneratorSimple(Random rand, /* boolean farlands, */ State filler, State liquid, BiomeGenPerlin biomeGen) + public GeneratorSimple(boolean biomes) { + this.biomes = biomes; + } + + public void init(Random rand, Dimension dim, GeneratorData gen) { + this.biomeGen = this.biomes ? new BiomeGenPerlin(rand.longv()) : null; this.lowerNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); this.upperNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); this.mainNoiseGen = /* farlands ? new OctaveGenOld(rand, 8) : */ new OctaveGen(rand, 8); this.biomeNoiseGen = /* farlands ? new OctaveGenOld(rand, 10) : */ new OctaveGen(rand, 10); this.depthNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16); - this.filler = filler; - this.liquid = liquid; - this.biomeGen = biomeGen; - } + this.filler = dim.getFiller(); + this.liquid = dim.getLiquid(); + } public int getMaximumHeight() { return 128; diff --git a/server/src/main/java/server/worldgen/MobConstants.java b/server/src/main/java/server/worldgen/MobConstants.java deleted file mode 100644 index cccc71ce..00000000 --- a/server/src/main/java/server/worldgen/MobConstants.java +++ /dev/null @@ -1,14 +0,0 @@ -package server.worldgen; - -import common.dimension.RngSpawn; -import common.entity.npc.EntityDarkMage; -import common.entity.npc.EntityMage; -import common.entity.npc.EntityTiefling; -import common.entity.npc.EntityUndead; -import common.rng.WeightedList; - -public abstract class MobConstants { - public static final WeightedList MAGEHUT_MOBS = new WeightedList(new RngSpawn(EntityMage.class, 1, 1, 1)); - public static final WeightedList FORTRESS_MOBS = new WeightedList(new RngSpawn(EntityDarkMage.class, 10, 2, 3), - new RngSpawn(EntityTiefling.class, 5, 4, 4), new RngSpawn(EntityUndead.class, 10, 4, 4)); -} diff --git a/server/src/main/java/server/worldgen/ReplacerAltBiome.java b/server/src/main/java/server/worldgen/ReplacerAltBiome.java index 2321318d..852d4905 100755 --- a/server/src/main/java/server/worldgen/ReplacerAltBiome.java +++ b/server/src/main/java/server/worldgen/ReplacerAltBiome.java @@ -1,54 +1,71 @@ package server.worldgen; import common.block.Block; +import common.dimension.Dimension; import common.init.Blocks; -import common.rng.NoiseGen; -import common.rng.OctaveGen; import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.NoiseGen; +import server.rng.OctaveGen; import server.world.WorldServer; public class ReplacerAltBiome implements BlockReplacer -{ - private final NoiseGen altNoiseGen; - private final NoiseGen exclNoiseGen; +{ + private final boolean useFiller; + private NoiseGen altNoiseGen; + private NoiseGen exclNoiseGen; - private final State filler; - private final State top; - private final State surface; - private final State liquid; + private State filler; + private State top; + private State surface; + private State liquid; private final State alt1; private final State alt2; - private final Block block; + private Block block; private final double alt2Noise[] = new double[256]; private final double alt1Noise[] = new double[256]; private final double exclNoise[] = new double[256]; - -// public ReplacerAltBiome(Random rand, GeneratorSettings settings) -// { -// this(rand, settings.farlands, Blocks.stone.getDefaultState(), -// settings.useLavaSeas ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(), -// Blocks.sand.getDefaultState(), Blocks.gravel.getDefaultState()); -// } - -// public ReplacerAltBiome(Dimension dim, Random rand) -// { -// this(rand, /* dim.hasFarLands(), */ dim.getFiller(), dim.getLiquid(), dim.getAltFiller2(), dim.getAltFiller1()); -// } - public ReplacerAltBiome(Random rand, /* boolean farlands, */ State surface, State top, State filler, State liquid, State alt1, State alt2) +// this.altNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4); +// this.exclNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4); + + public ReplacerAltBiome(State surface, State top, State alt1, State alt2) { - this.altNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4); - this.exclNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4); - this.filler = filler; - this.liquid = liquid; + this.useFiller = false; this.alt1 = alt1; this.alt2 = alt2; - this.block = filler.getBlock(); this.surface = surface; this.top = top; } + public ReplacerAltBiome(State alt1, State alt2) + { + this.useFiller = true; + this.alt1 = alt1; + this.alt2 = alt2; + } + + public State getTop() { + return this.useFiller ? null : this.top; + } + + public State getSurface() { + return this.useFiller ? null : this.surface; + } + + public void init(Random rand, Dimension dim, GeneratorData gen) { + this.altNoiseGen = new OctaveGen(rand, 4); + this.exclNoiseGen = new OctaveGen(rand, 4); + this.filler = dim.getFiller(); + this.liquid = dim.getLiquid(); + this.block = this.filler.getBlock(); + if(this.useFiller) { + this.surface = dim.getFiller(); + this.top = dim.getFiller(); + } + } + public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand) { int seaLevel = world.getSeaLevel(); diff --git a/server/src/main/java/server/worldgen/ReplacerAltSimple.java b/server/src/main/java/server/worldgen/ReplacerAltSimple.java index 06874629..ec3586dd 100644 --- a/server/src/main/java/server/worldgen/ReplacerAltSimple.java +++ b/server/src/main/java/server/worldgen/ReplacerAltSimple.java @@ -1,25 +1,61 @@ package server.worldgen; +import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; import common.util.BlockPos; import common.world.State; -import common.world.World; +import server.dimension.GeneratorData; import server.world.WorldServer; public class ReplacerAltSimple extends ReplacerBiome { - protected final State alt; - protected final State surface; - protected final State top; - - public ReplacerAltSimple(Random rand, State surface, State top, State filler, State alt, State liquid, int seaLevel) + private final boolean useFiller; + protected State alt; + protected State surface; + protected State top; + + public ReplacerAltSimple(State surface, State top, State alt) { - super(rand, filler, liquid, seaLevel); - this.alt = alt; + this.useFiller = false; this.surface = surface; this.top = top; + this.alt = alt; } + + public ReplacerAltSimple(State surface, State top) + { + this(surface, top, null); + } + + public ReplacerAltSimple(State alt) + { + this.useFiller = true; + this.alt = alt; + } + + public ReplacerAltSimple() + { + this(null); + } + + public State getTop() { + return this.useFiller ? null : this.top; + } + + public State getSurface() { + return this.useFiller ? null : this.surface; + } + + public void init(Random rand, Dimension dim, GeneratorData gen) { + super.init(rand, dim, gen); + if(this.alt == null) + this.alt = dim.getFiller(); + if(this.useFiller) { + this.top = dim.getFiller(); + this.surface = dim.getFiller(); + } + } public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise) { this.genTerrainBlocks(world, rand, primer, x, z, noise, this.surface, this.top); diff --git a/server/src/main/java/server/worldgen/ReplacerAltSurface.java b/server/src/main/java/server/worldgen/ReplacerAltSurface.java index 0c107a22..bbcaa777 100755 --- a/server/src/main/java/server/worldgen/ReplacerAltSurface.java +++ b/server/src/main/java/server/worldgen/ReplacerAltSurface.java @@ -1,42 +1,47 @@ package server.worldgen; import common.block.Block; +import common.dimension.Dimension; import common.init.Blocks; -import common.rng.OctaveGen; import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.OctaveGen; import server.world.WorldServer; public class ReplacerAltSurface implements BlockReplacer { - private final OctaveGen altNoiseGen; - private final OctaveGen exclNoiseGen; + private OctaveGen altNoiseGen; + private OctaveGen exclNoiseGen; private final double[] alt2Noise = new double[256]; private final double[] alt1Noise = new double[256]; private final double[] exclNoise = new double[256]; - private final State filler; + private State filler; private final State alt1; private final State alt2; - private final State liquid; - private final Block fillerBlock; + private State liquid; + private Block fillerBlock; // public ReplacerAltSurface(Dimension dim, Random rand) { // this(rand, dim.getFiller(), dim.getAltFiller1(), dim.getAltFiller2(), dim.getLiquid()); // } - public ReplacerAltSurface(Random rand, State filler, State alt1, State alt2, State liquid) + public ReplacerAltSurface(State alt1, State alt2) { - this.altNoiseGen = new OctaveGen(rand, 4); - this.exclNoiseGen = new OctaveGen(rand, 4); - this.filler = filler; this.alt1 = alt1; this.alt2 = alt2; - this.liquid = liquid; - this.fillerBlock = filler.getBlock(); } + public void init(Random rand, Dimension dim, GeneratorData gen) { + this.altNoiseGen = new OctaveGen(rand, 4); + this.exclNoiseGen = new OctaveGen(rand, 4); + this.filler = dim.getFiller(); + this.liquid = dim.getLiquid(); + this.fillerBlock = this.filler.getBlock(); + } + public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand) { int i = world.getSeaLevel() + 1; diff --git a/server/src/main/java/server/worldgen/ReplacerBiome.java b/server/src/main/java/server/worldgen/ReplacerBiome.java index e0d140ed..f186aebc 100755 --- a/server/src/main/java/server/worldgen/ReplacerBiome.java +++ b/server/src/main/java/server/worldgen/ReplacerBiome.java @@ -2,30 +2,31 @@ package server.worldgen; import common.block.Block; import common.block.Material; -import common.rng.PerlinGen; +import common.dimension.Dimension; import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.PerlinGen; import server.world.WorldServer; public abstract class ReplacerBiome implements BlockReplacer { - private final PerlinGen stoneNoiseGen; + private PerlinGen stoneNoiseGen; private final double[] stoneNoise = new double[256]; - protected final int seaLevel; - protected final State filler; - protected final Block fillerBlock; - protected final State liquid; - protected final boolean freeze; - - public ReplacerBiome(Random rand, State filler, State liquid, int seaLevel) - { - this.stoneNoiseGen = new PerlinGen(rand, 4); - this.seaLevel = seaLevel; - this.filler = filler; - this.fillerBlock = filler.getBlock(); - this.liquid = liquid; - this.freeze = liquid.getBlock().getMaterial() == Material.WATER; - } + protected int seaLevel; + protected State filler; + protected Block fillerBlock; + protected State liquid; + protected boolean freeze; + + public void init(Random rand, Dimension dim, GeneratorData gen) { + this.stoneNoiseGen = new PerlinGen(rand, 4); + this.seaLevel = dim.getSeaLevel(); + this.filler = dim.getFiller(); + this.liquid = dim.getLiquid(); + this.fillerBlock = this.filler.getBlock(); + this.freeze = this.liquid.getBlock().getMaterial() == Material.WATER; + } public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand) { diff --git a/server/src/main/java/server/worldgen/ReplacerMesa.java b/server/src/main/java/server/worldgen/ReplacerMesa.java index a40ffa28..4993ae52 100644 --- a/server/src/main/java/server/worldgen/ReplacerMesa.java +++ b/server/src/main/java/server/worldgen/ReplacerMesa.java @@ -2,34 +2,48 @@ package server.worldgen; import java.util.Arrays; +import common.block.Material; import common.block.natural.BlockColoredClay; +import common.dimension.Dimension; import common.init.Blocks; -import common.rng.PerlinGen; import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.PerlinGen; import server.world.WorldServer; public class ReplacerMesa extends ReplacerBiome { private final State[] layers; - private final PerlinGen baseBryceGen; - private final PerlinGen highBryceGen; - private final PerlinGen clayColorGen; - private final PerlinGen soilGen; - private final PerlinGen peakGen; + private PerlinGen baseBryceGen; + private PerlinGen highBryceGen; + private PerlinGen clayColorGen; + private PerlinGen soilGen; + private PerlinGen peakGen; private final State surface; - public ReplacerMesa(Random rand, State filler, State liquid, int seaLevel, State surface) { - super(rand, filler, liquid, seaLevel); + public ReplacerMesa(State surface) { this.layers = new State[64]; Arrays.fill(this.layers, Blocks.hardened_clay.getState()); + this.surface = surface; + } + + public State getTop() { + return Blocks.dirt.getState(); + } + + public State getSurface() { + return this.surface; + } + + public void init(Random rand, Dimension dim, GeneratorData gen) { + super.init(rand, dim, gen); this.clayColorGen = new PerlinGen(rand, 1); this.baseBryceGen = new PerlinGen(rand, 4); this.highBryceGen = new PerlinGen(rand, 1); this.soilGen = new PerlinGen(rand, 8); this.peakGen = new PerlinGen(rand, 8); this.setupLayers(rand); - this.surface = surface; } private State getBlockAt(int x, int y, int z) diff --git a/server/src/main/java/server/worldgen/ReplacerTerranian.java b/server/src/main/java/server/worldgen/ReplacerTerranian.java index 2cabeec2..34aef815 100644 --- a/server/src/main/java/server/worldgen/ReplacerTerranian.java +++ b/server/src/main/java/server/worldgen/ReplacerTerranian.java @@ -1,22 +1,28 @@ package server.worldgen; import common.block.foliage.BlockLilyPad; +import common.dimension.Dimension; import common.init.Blocks; -import common.rng.PerlinGen; import common.rng.Random; import common.util.Facing; import common.world.State; +import server.dimension.GeneratorData; +import server.rng.PerlinGen; import server.world.WorldServer; public class ReplacerTerranian extends ReplacerAltSimple { - private final PerlinGen grassNoiseGen; + private PerlinGen grassNoiseGen; private final State dry; - 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); - this.grassNoiseGen = new PerlinGen(rand, 1); + public ReplacerTerranian(State surface, State top, State alt, State dry) { + super(surface, top, alt); this.dry = dry; } + + public void init(Random rand, Dimension dim, GeneratorData gen) { + super.init(rand, dim, gen); + this.grassNoiseGen = new PerlinGen(rand, 1); + } protected State adjust(State current) { return current.getBlock() == Blocks.sand ? Blocks.sandstone.getState() : current; diff --git a/server/src/main/java/server/worldgen/ReplacerTopLayer.java b/server/src/main/java/server/worldgen/ReplacerTopLayer.java index 681f3d00..8cef0914 100755 --- a/server/src/main/java/server/worldgen/ReplacerTopLayer.java +++ b/server/src/main/java/server/worldgen/ReplacerTopLayer.java @@ -1,23 +1,28 @@ package server.worldgen; import common.block.Block; +import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; import common.world.State; +import server.dimension.GeneratorData; import server.world.WorldServer; public class ReplacerTopLayer implements BlockReplacer { - private final State filler; - private final Block replace; + private final State surface; + private Block replace; -// public ReplacerTopLayer(Dimension dim) { -// this(dim.getSurface(), dim.getFiller().getBlock()); -// } - - public ReplacerTopLayer(State filler, Block replace) { - this.filler = filler; - this.replace = replace; + public ReplacerTopLayer(State surface) { + this.surface = surface; + } + + public State getSurface() { + return this.surface; + } + + public void init(Random rand, Dimension dim, GeneratorData gen) { + this.replace = dim.getFiller().getBlock(); } public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand) @@ -28,8 +33,8 @@ public class ReplacerTopLayer implements BlockReplacer { int k = 1; int l = -1; - State iblockstate = this.filler; - State iblockstate1 = this.filler; + State iblockstate = this.surface; + State iblockstate1 = this.surface; for (int i1 = primer.height - 1; i1 >= 0; --i1) { @@ -46,7 +51,7 @@ public class ReplacerTopLayer implements BlockReplacer if (k <= 0) { iblockstate = Blocks.air.getState(); - iblockstate1 = this.filler; + iblockstate1 = this.surface; } l = k; diff --git a/common/src/main/java/common/dimension/RngSpawn.java b/server/src/main/java/server/worldgen/RngSpawn.java similarity index 93% rename from common/src/main/java/common/dimension/RngSpawn.java rename to server/src/main/java/server/worldgen/RngSpawn.java index 82d2d54d..99809f67 100644 --- a/common/src/main/java/common/dimension/RngSpawn.java +++ b/server/src/main/java/server/worldgen/RngSpawn.java @@ -1,4 +1,4 @@ -package common.dimension; +package server.worldgen; import common.entity.types.EntityLiving; import common.rng.RngItem; diff --git a/common/src/main/java/common/biome/Scaling.java b/server/src/main/java/server/worldgen/Scaling.java similarity index 96% rename from common/src/main/java/common/biome/Scaling.java rename to server/src/main/java/server/worldgen/Scaling.java index 1518b574..e32c1759 100644 --- a/common/src/main/java/common/biome/Scaling.java +++ b/server/src/main/java/server/worldgen/Scaling.java @@ -1,4 +1,4 @@ -package common.biome; +package server.worldgen; public enum Scaling { VARYING_LOW(0.1F, 0.2F), diff --git a/server/src/main/java/server/worldgen/caves/MapGenBase.java b/server/src/main/java/server/worldgen/caves/MapGenBase.java index a16f947c..c0598313 100755 --- a/server/src/main/java/server/worldgen/caves/MapGenBase.java +++ b/server/src/main/java/server/worldgen/caves/MapGenBase.java @@ -1,6 +1,8 @@ package server.worldgen.caves; +import common.dimension.Dimension; import common.rng.Random; +import server.dimension.GeneratorData; import server.world.WorldServer; import server.worldgen.ChunkPrimer; @@ -14,6 +16,9 @@ public class MapGenBase /** This world object. */ protected WorldServer worldObj; + + public void init(Dimension dim, GeneratorData gen) { + } public void generate(WorldServer worldIn, int x, int z, ChunkPrimer chunkPrimerIn) { diff --git a/server/src/main/java/server/worldgen/caves/MapGenBigCaves.java b/server/src/main/java/server/worldgen/caves/MapGenBigCaves.java index 00cd451a..6eca8433 100755 --- a/server/src/main/java/server/worldgen/caves/MapGenBigCaves.java +++ b/server/src/main/java/server/worldgen/caves/MapGenBigCaves.java @@ -1,24 +1,26 @@ package server.worldgen.caves; import common.block.Block; +import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; import common.util.ExtMath; import common.world.State; +import server.dimension.GeneratorData; import server.world.WorldServer; import server.worldgen.ChunkPrimer; public class MapGenBigCaves extends MapGenBase { - private final Block replace; - private final Block top; - private final Block surface; - - public MapGenBigCaves(Block replace, Block top, Block surface) { - this.replace = replace; - this.top = top; - this.surface = surface; - } + private Block replace; + private Block top; + private Block surface; + + public void init(Dimension dim, GeneratorData gen) { + this.replace = dim.getFiller().getBlock(); + this.top = gen.getTop().getBlock(); + this.surface = gen.getSurface().getBlock(); + } protected void func_180705_a(long p_180705_1_, int p_180705_3_, int p_180705_4_, ChunkPrimer p_180705_5_, double p_180705_6_, double p_180705_8_, double p_180705_10_) { diff --git a/server/src/main/java/server/worldgen/caves/MapGenCaves.java b/server/src/main/java/server/worldgen/caves/MapGenCaves.java index 01a44bc0..e4180ab4 100755 --- a/server/src/main/java/server/worldgen/caves/MapGenCaves.java +++ b/server/src/main/java/server/worldgen/caves/MapGenCaves.java @@ -2,31 +2,35 @@ package server.worldgen.caves; import common.block.Block; import common.block.natural.BlockColoredClay; +import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; import common.world.State; +import server.dimension.GeneratorData; import server.world.WorldServer; import server.worldgen.ChunkPrimer; public class MapGenCaves extends MapGenBase { private final State filler; - private final Block replace; - private final Block top; - private final State surface; - private final Block surfaceBlock; - private final Block alt; - public MapGenCaves(State filler, Block replace, Block top, State surface, Block alt) { + private Block replace; + private Block top; + private State surface; + private Block surfaceBlock; + + public MapGenCaves(State filler) { this.filler = filler; - this.replace = replace; - this.top = top; - this.surface = surface; - this.surfaceBlock = surface.getBlock(); - this.alt = alt; } + + public void init(Dimension dim, GeneratorData gen) { + this.replace = dim.getFiller().getBlock(); + this.top = gen.getTop().getBlock(); + this.surface = gen.getSurface(); + this.surfaceBlock = this.surface.getBlock(); + } protected void func_180703_a(long p_180703_1_, int p_180703_3_, int p_180703_4_, ChunkPrimer p_180703_5_, double p_180703_6_, double p_180703_8_, double p_180703_10_) { @@ -249,7 +253,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() == Blocks.red_sand || state.getBlock() == this.alt) && !above.getBlock().getMaterial().isColdLiquid()))))))); // ); + : (state.getBlock() == Blocks.sand || state.getBlock() == Blocks.red_sand || state.getBlock() == Blocks.gravel) && !above.getBlock().getMaterial().isColdLiquid()))))))); // ); } /** diff --git a/server/src/main/java/server/worldgen/caves/MapGenRavine.java b/server/src/main/java/server/worldgen/caves/MapGenRavine.java index 1c7cd95e..c595268a 100755 --- a/server/src/main/java/server/worldgen/caves/MapGenRavine.java +++ b/server/src/main/java/server/worldgen/caves/MapGenRavine.java @@ -1,31 +1,37 @@ package server.worldgen.caves; import common.block.Block; +import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; import common.world.State; +import server.dimension.GeneratorData; import server.world.WorldServer; import server.worldgen.ChunkPrimer; public class MapGenRavine extends MapGenBase { private final State filler; - private final Block replace; - private final Block top; - private final State surface; - private final Block surfaceBlock; + + private Block replace; + private Block top; + private State surface; + private Block surfaceBlock; private float[] field_75046_d = new float[1024]; - public MapGenRavine(State filler, Block replace, Block top, State surface) { + public MapGenRavine(State filler) { this.filler = filler; - this.replace = replace; - this.top = top; - this.surface = surface; - this.surfaceBlock = surface.getBlock(); } + + public void init(Dimension dim, GeneratorData gen) { + this.replace = dim.getFiller().getBlock(); + this.top = gen.getTop().getBlock(); + this.surface = gen.getSurface(); + this.surfaceBlock = this.surface.getBlock(); + } protected void func_180707_a(long p_180707_1_, int p_180707_3_, int p_180707_4_, ChunkPrimer p_180707_5_, double p_180707_6_, double p_180707_8_, double p_180707_10_, float p_180707_12_, float p_180707_13_, float p_180707_14_, int p_180707_15_, int p_180707_16_, double p_180707_17_) { diff --git a/server/src/main/java/server/worldgen/layer/GenLayerAddExtra.java b/server/src/main/java/server/worldgen/layer/GenLayerAddExtra.java index 54a1d4ae..70ca5f5c 100755 --- a/server/src/main/java/server/worldgen/layer/GenLayerAddExtra.java +++ b/server/src/main/java/server/worldgen/layer/GenLayerAddExtra.java @@ -1,6 +1,6 @@ package server.worldgen.layer; -import common.biome.Biome; +import server.worldgen.Biome; public class GenLayerAddExtra extends GenLayer { diff --git a/server/src/main/java/server/worldgen/layer/GenLayerBiome.java b/server/src/main/java/server/worldgen/layer/GenLayerBiome.java index a61c14f6..2cef5567 100755 --- a/server/src/main/java/server/worldgen/layer/GenLayerBiome.java +++ b/server/src/main/java/server/worldgen/layer/GenLayerBiome.java @@ -1,6 +1,6 @@ package server.worldgen.layer; -import common.biome.Biome; +import server.worldgen.Biome; public class GenLayerBiome extends GenLayer { diff --git a/server/src/main/java/server/worldgen/layer/GenLayerRiverMix.java b/server/src/main/java/server/worldgen/layer/GenLayerRiverMix.java index 14bede6f..3e1e2070 100755 --- a/server/src/main/java/server/worldgen/layer/GenLayerRiverMix.java +++ b/server/src/main/java/server/worldgen/layer/GenLayerRiverMix.java @@ -2,8 +2,8 @@ package server.worldgen.layer; import java.util.Set; -import common.biome.Biome; import common.collect.Sets; +import server.worldgen.Biome; public class GenLayerRiverMix extends GenLayer { diff --git a/server/src/main/java/server/worldgen/populator/PopulatorBasic.java b/server/src/main/java/server/worldgen/populator/PopulatorBasic.java index c9c9f44d..27da49a4 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorBasic.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorBasic.java @@ -2,9 +2,9 @@ package server.worldgen.populator; import common.block.foliage.BlockFlower; import common.init.Blocks; -import common.rng.PerlinGen; import common.rng.Random; import common.util.BlockPos; +import server.rng.PerlinGen; import server.world.WorldServer; import server.worldgen.FeatureGenerator; import server.worldgen.feature.WorldGenClay; diff --git a/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java b/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java index 70864642..a9cb4b6d 100755 --- a/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java +++ b/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java @@ -3,10 +3,10 @@ package server.worldgen.structure; import java.util.Arrays; import java.util.List; -import common.biome.Biome; import common.rng.Random; import common.util.BlockPos; import server.world.WorldServer; +import server.worldgen.Biome; public class MapGenScatteredFeature extends MapGenStructure { diff --git a/server/src/main/java/server/worldgen/structure/MapGenVillage.java b/server/src/main/java/server/worldgen/structure/MapGenVillage.java index 3b5b4616..da08c5f6 100755 --- a/server/src/main/java/server/worldgen/structure/MapGenVillage.java +++ b/server/src/main/java/server/worldgen/structure/MapGenVillage.java @@ -3,11 +3,11 @@ package server.worldgen.structure; import java.util.List; import java.util.Set; -import common.biome.Biome; import common.collect.Sets; import common.rng.Random; import common.tags.TagObject; import server.world.WorldServer; +import server.worldgen.Biome; public class MapGenVillage extends MapGenStructure { diff --git a/server/src/main/java/server/worldgen/structure/StructureVillage.java b/server/src/main/java/server/worldgen/structure/StructureVillage.java index 5f57c904..1b51897b 100755 --- a/server/src/main/java/server/worldgen/structure/StructureVillage.java +++ b/server/src/main/java/server/worldgen/structure/StructureVillage.java @@ -3,7 +3,6 @@ package server.worldgen.structure; import java.util.Iterator; import java.util.List; -import common.biome.Biome; import common.block.artificial.BlockDoor; import common.block.artificial.BlockLadder; import common.block.artificial.BlockStairs; @@ -22,6 +21,7 @@ import common.vars.Vars; import common.world.State; import server.vars.SVars; import server.world.WorldServer; +import server.worldgen.Biome; import server.worldgen.BiomeGenerator; import server.worldgen.LootConstants; diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTree.java b/server/src/main/java/server/worldgen/tree/WorldGenTree.java index c61c54b3..5d64b252 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTree.java @@ -33,9 +33,9 @@ public abstract class WorldGenTree extends FeatureGenerator protected void setBaseBlock(WorldServer worldIn, BlockPos pos) { - if (worldIn.getState(pos) != worldIn.dimension.getTop()) + if (worldIn.getState(pos) != worldIn.gen.getTop()) { - this.setBlockAndNotifyAdequately(worldIn, pos, worldIn.dimension.getTop()); // Blocks.dirt.getDefaultState()); + this.setBlockAndNotifyAdequately(worldIn, pos, worldIn.gen.getTop()); // Blocks.dirt.getDefaultState()); } } }