From cc5c3c48d5c24b8ec5c1a4a5680fba98f4936987 Mon Sep 17 00:00:00 2001 From: dags- Date: Thu, 14 May 2020 21:40:55 +0100 Subject: [PATCH] tweaks to swamp surface --- src/main/java/com/terraforged/TerraWorld.java | 1 + .../com/terraforged/api/chunk/surface/SurfaceContext.java | 2 -- .../com/terraforged/api/chunk/surface/builder/Delegate.java | 2 +- src/main/java/com/terraforged/biome/surface/SwampSurface.java | 4 ++-- .../com/terraforged/chunk/generator/TerrainGenerator.java | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/terraforged/TerraWorld.java b/src/main/java/com/terraforged/TerraWorld.java index 7e1889a..27d96da 100644 --- a/src/main/java/com/terraforged/TerraWorld.java +++ b/src/main/java/com/terraforged/TerraWorld.java @@ -73,6 +73,7 @@ public class TerraWorld extends WorldType { if (world.getDimension().getType() == DimensionType.OVERWORLD) { WorldInfo info = world.getWorldInfo(); TerraSettings settings = SettingsHelper.getSettings(info); + settings.world.seed = world.getSeed(); settings.dimensions.dimensions.apply(world.getWorldInfo()); Terrains terrains = Terrains.create(settings); diff --git a/src/main/java/com/terraforged/api/chunk/surface/SurfaceContext.java b/src/main/java/com/terraforged/api/chunk/surface/SurfaceContext.java index 684ff89..c9ec75e 100644 --- a/src/main/java/com/terraforged/api/chunk/surface/SurfaceContext.java +++ b/src/main/java/com/terraforged/api/chunk/surface/SurfaceContext.java @@ -35,7 +35,6 @@ import net.minecraft.world.gen.GenerationSettings; public class SurfaceContext extends DecoratorContext { public final long seed; - public final int seaLevel; public final BlockState solid; public final BlockState fluid; public final ChunkSurfaceBuffer buffer; @@ -48,7 +47,6 @@ public class SurfaceContext extends DecoratorContext { this.solid = settings.getDefaultBlock(); this.fluid = settings.getDefaultFluid(); this.buffer = buffer; - this.seaLevel = levels.waterLevel; this.seed = seed; } } diff --git a/src/main/java/com/terraforged/api/chunk/surface/builder/Delegate.java b/src/main/java/com/terraforged/api/chunk/surface/builder/Delegate.java index 2f9034d..47d8814 100644 --- a/src/main/java/com/terraforged/api/chunk/surface/builder/Delegate.java +++ b/src/main/java/com/terraforged/api/chunk/surface/builder/Delegate.java @@ -60,7 +60,7 @@ public class Delegate implements Surface { context.noise, context.solid, context.fluid, - context.seaLevel, + context.levels.waterLevel, context.seed ); } diff --git a/src/main/java/com/terraforged/biome/surface/SwampSurface.java b/src/main/java/com/terraforged/biome/surface/SwampSurface.java index babc80b..8869bba 100644 --- a/src/main/java/com/terraforged/biome/surface/SwampSurface.java +++ b/src/main/java/com/terraforged/biome/surface/SwampSurface.java @@ -22,13 +22,13 @@ public class SwampSurface implements Surface { continue; } - if (y == ctx.seaLevel && ctx.buffer.getBlockState(ctx.pos).getBlock() != ctx.fluid.getBlock()) { + if (y == ctx.levels.waterY && ctx.buffer.getBlockState(ctx.pos).getBlock() != ctx.fluid.getBlock()) { ctx.buffer.setBlockState(ctx.pos, ctx.fluid, false); } break; } } - SurfaceBuilder.DEFAULT.buildSurface(ctx.random, ctx.buffer, ctx.biome, x, z, height, noise, ctx.solid, ctx.fluid, ctx.seaLevel, ctx.seed, config); + SurfaceBuilder.DEFAULT.buildSurface(ctx.random, ctx.buffer, ctx.biome, x, z, height, noise, ctx.solid, ctx.fluid, ctx.levels.waterLevel, ctx.seed, config); } } diff --git a/src/main/java/com/terraforged/chunk/generator/TerrainGenerator.java b/src/main/java/com/terraforged/chunk/generator/TerrainGenerator.java index 69772e9..65a7d12 100644 --- a/src/main/java/com/terraforged/chunk/generator/TerrainGenerator.java +++ b/src/main/java/com/terraforged/chunk/generator/TerrainGenerator.java @@ -59,7 +59,7 @@ public class TerrainGenerator { container.getChunkReader().iterate(context, (cell, dx, dz, ctx) -> { int px = ctx.blockX + dx; int pz = ctx.blockZ + dz; - int top = ctx.chunk.getTopBlockY(Heightmap.Type.WORLD_SURFACE_WG, dx, dz) + 1; + int top = ctx.chunk.getTopBlockY(Heightmap.Type.WORLD_SURFACE_WG, dx, dz); ctx.buffer.setSurfaceLevel(top);