Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override public void registerWorldGen(ICubicWorldServer world, GeneratorPipeline pipeline) {
- ServerCubeCache cubeCache = world.getCubeCache();
- ChunkProviderOverworld vanillaGen = new ChunkProviderOverworld((World) world, world.getSeed(), true, "");
- // init the worldgen pipeline
- GeneratorStage terrain = new VanillaStage("terrain", new Vec3i(0, 0, 0), new Vec3i(0, 15, 0), null);
- GeneratorStage lighting = new VanillaStage("lighting", new Vec3i(0, 0, 0), new Vec3i(0, 15, 0),
- new RegionDependency(lighting, /*whatever*/));
- GeneratorStage population = new VanillaStage("population", new Vec3i(0, 0, 0), new Vec3i(0, 15, 0), null);
- pipeline.addStage(terrain, new VanillaTerrainProcessor(lighting, world, vanillaGen, 5));
- pipeline.addStage(lighting, new VanillaFirstLightProcessor(lighting, population, cubeCache, 5));
- pipeline.addStage(population, new VanillaPopulationProcessor(population, world, vanillaGen, 5));
- }
- public static void create() {
- new VanillaCubicChunksWorldType();
- }
- private static class VanillaStage extends GeneratorStage {
- private final CubeDependency[] depsForHeight = new CubeDependency[16];
- private CubeDependency normal;
- private VanillaStage(String name, Vec3i depStart, Vec3i depEnd, @Nullable CubeDependency normal) {
- super(name);
- this.normal = normal;
- for (int y = 0; y < 16; y++) {
- //each cube requires cubes from y=0 to y=15
- //but relative to them, these positions are different
- //relative coords: requiredCubePos - currentCubePos
- int startY = depStart.getY() - y;
- int endY = depEnd.getY() - y;
- Vec3i start = new Vec3i(depStart.getX(), startY, depStart.getZ());
- Vec3i end = new Vec3i(depEnd.getX(), endY, depEnd.getZ());
- CubeDependency dep = new RegionDependency(this, start, end);
- depsForHeight[y] = dep;
- }
- }
- @Nullable @Override public CubeDependency getCubeDependency(@Nonnull Cube cube) {
- if (cube.getY() < 0 || cube.getY() >= depsForHeight.length) {
- return normal;
- }
- return depsForHeight[cube.getY()];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment