From 7dcf8169a37e68f66d69aa5a78770a8e7af8e3fa Mon Sep 17 00:00:00 2001 From: WhichOnesPink Date: Fri, 14 Jul 2017 21:57:49 +0100 Subject: [PATCH] Minor API tweaks & refactoring. --- .../rtg/api/world/biome/IRealisticBiome.java | 17 ++++++++++++++++- .../biome/realistic/RealisticBiomeBase.java | 13 +++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/main/java/rtg/api/world/biome/IRealisticBiome.java b/src/main/java/rtg/api/world/biome/IRealisticBiome.java index e74f9bc15..612722320 100644 --- a/src/main/java/rtg/api/world/biome/IRealisticBiome.java +++ b/src/main/java/rtg/api/world/biome/IRealisticBiome.java @@ -38,7 +38,10 @@ public interface IRealisticBiome { void initConfig(); boolean hasConfig(); TerrainBase initTerrain(); + TerrainBase terrain(); SurfaceBase initSurface(); + SurfaceBase surface(); + SurfaceBase surfaceGeneric(); void initDecos(); ArrayList getDecos(); ArrayList getTrees(); @@ -67,7 +70,19 @@ default int lavaSurfaceLakeChance() { return 0; // Lower equals more frequent. } - void rReplace(ChunkPrimer primer, int i, int j, int x, int y, int depth, IRTGWorld rtgWorld, float[] noise, float river, Biome[] base); + default void rReplace(ChunkPrimer primer, int i, int j, int x, int y, int depth, IRTGWorld rtgWorld, float[] noise, float river, Biome[] base) { + + float riverRegion = !this.getConfig().ALLOW_RIVERS.get() ? 0f : river; + + if (rtgConfig.ENABLE_RTG_BIOME_SURFACES.get() && this.getConfig().USE_RTG_SURFACES.get()) { + + this.surface().paintTerrain(primer, i, j, x, y, depth, rtgWorld, noise, riverRegion, base); + } + else { + + this.surfaceGeneric().paintTerrain(primer, i, j, x, y, depth, rtgWorld, noise, riverRegion, base); + } + } default float lakePressure(IRTGWorld rtgWorld, int x, int y, float border, float lakeInterval, float largeBendSize, float mediumBendSize, float smallBendSize) { if (!this.getConfig().ALLOW_SCENIC_LAKES.get()) return 1f; diff --git a/src/main/java/rtg/world/biome/realistic/RealisticBiomeBase.java b/src/main/java/rtg/world/biome/realistic/RealisticBiomeBase.java index 67d0e28a1..1bbfe9b35 100644 --- a/src/main/java/rtg/world/biome/realistic/RealisticBiomeBase.java +++ b/src/main/java/rtg/world/biome/realistic/RealisticBiomeBase.java @@ -307,16 +307,21 @@ public float r3Dnoise(float z) { return 0f; } - public TerrainBase getTerrain() { - + @Override + public TerrainBase terrain() { return this.terrain; } - public SurfaceBase getSurface() { - + @Override + public SurfaceBase surface() { return this.surface; } + @Override + public SurfaceBase surfaceGeneric() { + return this.surfaceGeneric; + } + private class ChunkDecoration { ChunkPos chunkLocation; DecoBase decoration;