make worldgen classes server side

This commit is contained in:
Sen 2025-07-24 22:49:22 +02:00
parent 4de4f41a5d
commit d56f28e6d2
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
69 changed files with 1018 additions and 1809 deletions

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

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

View file

@ -1,6 +0,0 @@
package common.dimension;
import common.world.State;
public record Liquid(State state, int chance, int minHeight, int maxHeight, boolean lower) {
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,6 @@
package common.dimension;
package server.dimension;
import common.dimension.Section;
public final class Domain extends Section {
public Domain(boolean custom) {

View file

@ -1,4 +1,6 @@
package common.dimension;
package server.dimension;
import common.dimension.Section;
public final class Galaxy extends Section {
public Galaxy(boolean custom) {

View file

@ -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<MapGenBase> caves = Lists.newArrayList();
private final List<FeatureDungeons> features = Lists.newArrayList();
private final List<MapGenStructure> structures = Lists.newArrayList();
private final List<FeatureOres> ores = Lists.newArrayList();
private final List<FeatureLakes> lakes = Lists.newArrayList();
private final List<FeatureLiquids> liquids = Lists.newArrayList();
private final WeightedList<RngSpawn> spawns = new WeightedList<RngSpawn>();
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<? extends EntityLiving> 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<MapGenStructure> getStructures() {
return this.structures;
}
public List<FeatureDungeons> getFeatures() {
return this.features;
}
public List<MapGenBase> getCaveGens() {
return this.caves;
}
public List<FeatureOres> getOres() {
return this.ores;
}
public List<FeatureLakes> getLakes() {
return this.lakes;
}
public List<FeatureLiquids> getLiquids() {
return this.liquids;
}
public WeightedList<RngSpawn> getSpawns() {
return this.spawns;
}
}

View file

@ -1,4 +1,6 @@
package common.dimension;
package server.dimension;
import common.dimension.Section;
public final class Sector extends Section {
public Sector(boolean custom) {

View file

@ -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;
@ -74,6 +102,8 @@ public abstract class UniverseRegistry extends DimensionRegistry {
private static final Map<Domain, List<Area>> DOMAIN_AREAS = Maps.newHashMap();
private static final Set<Semi> SEMI = Sets.newHashSet();
private static final Map<Dimension, GeneratorData> GEN_MAP = Maps.newHashMap();
public static List<Section> 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);
@ -457,23 +497,30 @@ public abstract class UniverseRegistry extends DimensionRegistry {
// Biome.SWAMP, Biome.TROPIC)
// .setHotBiomes(Biome.DESERT, Biome.DESERT, Biome.DESERT, Biome.SAVANNA, Biome.SAVANNA, Biome.PLAIN)
// public static final WeightedList<RngSpawn> MAGEHUT_MOBS = new WeightedList<RngSpawn>(new RngSpawn(EntityMage.class, 1, 1, 1));
// public static final WeightedList<RngSpawn> FORTRESS_MOBS = new WeightedList<RngSpawn>(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<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
if(EntityLiving.class.isAssignableFrom(clazz))
warp.addSpawn((Class<? extends EntityLiving>)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)

View file

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

View file

@ -1,4 +1,6 @@
package common.rng;
package server.rng;
import common.rng.Random;
class ImprovedGenOld {
private final int permutations[];

View file

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

View file

@ -1,4 +1,6 @@
package common.rng;
package server.rng;
import common.rng.Random;
public class OctaveGen extends NoiseGen {
private final ImprovedGen[] generators;

View file

@ -1,4 +1,6 @@
package common.rng;
package server.rng;
import common.rng.Random;
public class OctaveGenOld extends NoiseGen {
private final ImprovedGenOld generators[];

View file

@ -1,4 +1,6 @@
package common.rng;
package server.rng;
import common.rng.Random;
public class PerlinGen {
private final SimplexGen[] generators;

View file

@ -1,4 +1,6 @@
package common.rng;
package server.rng;
import common.rng.Random;
public class PerlinGenOld {
private final SimplexGenOld generators[];

View file

@ -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 },

View file

@ -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 },

View file

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

View file

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

View file

@ -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<WorldSavedData> dataList = Lists.<WorldSavedData>newArrayList();
private final List<BlockArray> 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<RngSpawn> 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 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);
}
}
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 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 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;
}
}
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<RngSpawn> 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.structures != null) {
for(MapGenStructure gen : this.structures) {
gen.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);
}
}
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.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);
}
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);
// 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.structures != null) {
for(MapGenStructure gen : this.structures) {
gen.generate(this, x, z, null);
}
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);
}
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;
@ -2392,6 +2197,12 @@ public final class WorldServer extends AWorldServer {
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()) {
// return this.canSeeSky(pos);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,42 +1,33 @@
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() {

View file

@ -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,11 +14,11 @@ 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() {

View file

@ -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;
@ -17,21 +25,32 @@ public class GeneratorFlat implements ChunkGenerator {
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<State> 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;

View file

@ -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,20 +23,15 @@ 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() {

View file

@ -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
@ -25,12 +26,13 @@ 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;
@ -55,42 +57,40 @@ public class GeneratorPerlin implements ChunkGenerator
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(float depth, float scale) {
this(new GeneratorSettings(), depth, scale);
}
public GeneratorPerlin(Random rand, State block, State liquid, Dimension.GeneratorSettings settings, float depth, float scale) {
this(rand, block, liquid, settings);
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);

View file

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

View file

@ -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];
@ -27,29 +28,20 @@ public class GeneratorSimple implements ChunkGenerator
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() {

View file

@ -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<RngSpawn> MAGEHUT_MOBS = new WeightedList<RngSpawn>(new RngSpawn(EntityMage.class, 1, 1, 1));
public static final WeightedList<RngSpawn> FORTRESS_MOBS = new WeightedList<RngSpawn>(new RngSpawn(EntityDarkMage.class, 10, 2, 3),
new RngSpawn(EntityTiefling.class, 5, 4, 4), new RngSpawn(EntityUndead.class, 10, 4, 4));
}

View file

@ -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());
// }
// this.altNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4);
// this.exclNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4);
// 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)
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();

View file

@ -1,24 +1,60 @@
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;
private final boolean useFiller;
protected State alt;
protected State surface;
protected State top;
public ReplacerAltSimple(Random rand, State surface, State top, State filler, State alt, State liquid, int seaLevel)
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) {

View file

@ -1,40 +1,45 @@
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)

View file

@ -2,29 +2,30 @@ 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;
protected int seaLevel;
protected State filler;
protected Block fillerBlock;
protected State liquid;
protected boolean freeze;
public ReplacerBiome(Random rand, State filler, State liquid, int seaLevel)
{
public void init(Random rand, Dimension dim, GeneratorData gen) {
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;
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)

View file

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

View file

@ -1,23 +1,29 @@
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;
}

View file

@ -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 surface) {
this.surface = surface;
}
public ReplacerTopLayer(State filler, Block replace) {
this.filler = filler;
this.replace = replace;
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;

View file

@ -1,4 +1,4 @@
package common.dimension;
package server.worldgen;
import common.entity.types.EntityLiving;
import common.rng.RngItem;

View file

@ -1,4 +1,4 @@
package common.biome;
package server.worldgen;
public enum Scaling {
VARYING_LOW(0.1F, 0.2F),

View file

@ -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;
@ -15,6 +17,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)
{
int i = this.range;

View file

@ -1,23 +1,25 @@
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;
private Block replace;
private Block top;
private Block surface;
public MapGenBigCaves(Block replace, Block top, Block surface) {
this.replace = replace;
this.top = top;
this.surface = 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_)

View file

@ -2,30 +2,34 @@ 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()))))))); // );
}
/**

View file

@ -1,30 +1,36 @@
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_)

View file

@ -1,6 +1,6 @@
package server.worldgen.layer;
import common.biome.Biome;
import server.worldgen.Biome;
public class GenLayerAddExtra extends GenLayer
{

View file

@ -1,6 +1,6 @@
package server.worldgen.layer;
import common.biome.Biome;
import server.worldgen.Biome;
public class GenLayerBiome extends GenLayer
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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