Noise Routers
The NoiseRouter bundles the
various DensityFunctions
that create a given dimension’s terrain. Where a single density function describes one piece of the
generator’s behavior.
The eight slots fall into two groups:
- Climate parameters:
temperature,vegetation,continents,erosion,depth, andridgesdescribe the noise fields that bend terrain and feed biome placement. - Terrain shape:
chunkSurfaceLevelgives an early surface-height estimate, andfinalDensitydecides whether a given block ends up solid.
The aquifer and fluid functions (barrier, fluidLevelFloodedness, fluidLevelSpread, and lava) now live in
AquiferSettings, which is set on the
noise generator with aquifers(...). The old ore vein slots were removed from the router.
Example Usage
Section titled “Example Usage”import dev.wyck.worldgen.noise.NoiseRouter;
import dev.wyck.worldgen.function.DensityFunction;
import dev.wyck.worldgen.function.DensityFunctions;
import dev.wyck.worldgen.synth.Noises;
import org.bukkit.plugin.java.JavaPlugin;
public class ExamplePlugin extends JavaPlugin {
@Override
public void onEnable() {
DensityFunction temperature = DensityFunctions.ZERO;
DensityFunction vegetation = DensityFunctions.ZERO;
DensityFunction continents = DensityFunction.noise(Noises.CONTINENTALNESS, 0.25, 0.0);
DensityFunction erosion = DensityFunction.noise(Noises.EROSION, 0.25, 0.0);
DensityFunction depth = DensityFunction.yClampedGradient(-64, 320, 1.5, -1.5);
DensityFunction ridges = DensityFunctions.RIDGES;
// Actual terrain shape
DensityFunction finalDensity = DensityFunction.yClampedGradient(-64, 320, 1.0, -1.0);
NoiseRouter router = NoiseRouter.builder()
// Climate parameters
.temperature(temperature)
.vegetation(vegetation)
.continents(continents)
.erosion(erosion)
.depth(depth)
.ridges(ridges)
// Terrain shape
.chunkSurfaceLevel(DensityFunction.constant(0.0))
.finalDensity(finalDensity)
// All done!
.build();
}
}