mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Increase resolution of elevation interpolation
This commit is contained in:
parent
f6a4479855
commit
2d18f5dbe5
@ -7,7 +7,7 @@ import org.polydev.gaea.math.FastNoiseLite;
|
||||
import org.polydev.gaea.math.Interpolator;
|
||||
|
||||
public class ElevationInterpolator {
|
||||
private final UserDefinedGenerator[][] gens = new UserDefinedGenerator[8][8];
|
||||
private final UserDefinedGenerator[][] gens = new UserDefinedGenerator[10][10];
|
||||
private final double[][] values = new double[18][18];
|
||||
private final FastNoiseLite noise;
|
||||
private final int xOrigin;
|
||||
@ -20,16 +20,16 @@ public class ElevationInterpolator {
|
||||
this.noise = noise;
|
||||
this.grid = grid;
|
||||
|
||||
for(int x = -1; x < 7; x++) {
|
||||
for(int z = -1; z < 7; z++) {
|
||||
gens[x + 1][z + 1] = (UserDefinedGenerator) grid.getBiome(xOrigin + x * 4, zOrigin + z * 4, GenerationPhase.BASE).getGenerator();
|
||||
for(int x = -2; x < 8; x++) {
|
||||
for(int z = -2; z < 8; z++) {
|
||||
gens[x + 2][z + 2] = (UserDefinedGenerator) grid.getBiome(xOrigin + x * 4, zOrigin + z * 4, GenerationPhase.BASE).getGenerator();
|
||||
}
|
||||
}
|
||||
|
||||
for(byte x = -1; x <= 16; x++) {
|
||||
for(byte z = -1; z <= 16; z++) {
|
||||
UserDefinedGenerator generator = getGenerator(x, z);
|
||||
if(compareGens((x / 4) + 1, (z / 4) + 1) && generator.interpolateElevation()) {
|
||||
if(compareGens((x / 4), (z / 4)) && generator.interpolateElevation()) {
|
||||
Interpolator interpolator = new Interpolator(biomeAvg(x / 4, z / 4),
|
||||
biomeAvg((x / 4) + 1, z / 4),
|
||||
biomeAvg(x / 4, (z / 4) + 1),
|
||||
@ -45,36 +45,31 @@ public class ElevationInterpolator {
|
||||
return (UserDefinedGenerator) grid.getBiome(xOrigin + x, zOrigin + z, GenerationPhase.BASE).getGenerator();
|
||||
}
|
||||
|
||||
private UserDefinedGenerator getStoredGen(int x, int z) {
|
||||
return gens[x + 2][z + 2];
|
||||
}
|
||||
|
||||
private boolean compareGens(int x, int z) {
|
||||
UserDefinedGenerator comp = gens[x][z];
|
||||
UserDefinedGenerator comp = getStoredGen(x, z);
|
||||
|
||||
if(!comp.equals(gens[x + 1][z])) return true;
|
||||
|
||||
if(!comp.equals(gens[x][z + 1])) return true;
|
||||
|
||||
if(!comp.equals(gens[x - 1][z])) return true;
|
||||
|
||||
if(!comp.equals(gens[x][z - 1])) return true;
|
||||
|
||||
if(!comp.equals(gens[x + 1][z + 1])) return true;
|
||||
|
||||
if(!comp.equals(gens[x - 1][z - 1])) return true;
|
||||
|
||||
if(!comp.equals(gens[x + 1][z - 1])) return true;
|
||||
|
||||
return !comp.equals(gens[x - 1][z + 1]);
|
||||
for(int xi = x - 2; xi <= x + 2; xi++) {
|
||||
for(int zi = z - 2; zi <= z + 2; zi++) {
|
||||
if(!comp.equals(getStoredGen(xi, zi))) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private double biomeAvg(int x, int z) {
|
||||
return (elevate(gens[x + 2][z + 1], x * 4 + 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(gens[x][z + 1], x * 4 - 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(gens[x + 1][z + 2], x * 4 + xOrigin, z * 4 + 4 + zOrigin)
|
||||
+ elevate(gens[x + 1][z], x * 4 + xOrigin, z * 4 - 4 + zOrigin)
|
||||
+ elevate(gens[x + 1][z + 1], x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(gens[x][z], x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(gens[x][z + 2], x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(gens[x + 2][z], x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(gens[x + 2][z + 2], x * 4 + xOrigin, z * 4 + zOrigin)) / 9D;
|
||||
return (elevate(getStoredGen(x + 1, z), x * 4 + 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x - 1, z), x * 4 - 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x, z + 1), x * 4 + xOrigin, z * 4 + 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x, z - 1), x * 4 + xOrigin, z * 4 - 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x, z), x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x - 1, z - 1), x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x - 1, z + 1), x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x + 1, z - 1), x * 4 + xOrigin, z * 4 + zOrigin)
|
||||
+ elevate(getStoredGen(x + 1, z + 1), x * 4 + xOrigin, z * 4 + zOrigin)) / 9D;
|
||||
}
|
||||
|
||||
private double elevate(UserDefinedGenerator g, int x, int z) {
|
||||
|
@ -188,6 +188,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
||||
return chunk;
|
||||
}
|
||||
|
||||
|
||||
private void load(World w) {
|
||||
try {
|
||||
popMan.loadBlocks(w);
|
||||
|
73
src/main/resources/default-config/biomes/crag.yml
Normal file
73
src/main/resources/default-config/biomes/crag.yml
Normal file
@ -0,0 +1,73 @@
|
||||
noise-equation: "((-((y / 63)^2)) + 1) + |(noise2(x/1.5, z/1.5)+0.25)|/2.5"
|
||||
elevation:
|
||||
equation: "min(floor(((max(noise2(x, z)+0.5, 0)))*8), 7)*6 + noise2(x*2,z*2)*12"
|
||||
interpolation: true
|
||||
extends: "BASIC_ORES"
|
||||
id: "CRAG"
|
||||
|
||||
slant:
|
||||
palette:
|
||||
- "BLOCK:minecraft:bedrock": 0
|
||||
- BEDROCK_MOST: 1
|
||||
- BEDROCK_HALF: 2
|
||||
- BEDROCK_LITTLE: 3
|
||||
- "BLOCK:minecraft:stone": 255
|
||||
y-offset:
|
||||
top: 0.3
|
||||
bottom: 0.25
|
||||
|
||||
palette:
|
||||
- "BLOCK:minecraft:bedrock": 0
|
||||
- BEDROCK_MOST: 1
|
||||
- BEDROCK_HALF: 2
|
||||
- BEDROCK_LITTLE: 3
|
||||
- GRASSY: 255
|
||||
vanilla: PLAINS
|
||||
|
||||
flora:
|
||||
chance: 60
|
||||
attempts: 2
|
||||
simplex:
|
||||
enable: true
|
||||
frequency: 0.1
|
||||
seed: 4
|
||||
items:
|
||||
SMALL_ROCK:
|
||||
weight: 1
|
||||
y:
|
||||
min: 62
|
||||
max: 180
|
||||
TALL_GRASS:
|
||||
weight: 1
|
||||
y:
|
||||
min: 62
|
||||
max: 180
|
||||
GRASS:
|
||||
weight: 5
|
||||
y:
|
||||
min: 62
|
||||
max: 180
|
||||
LEAVES:
|
||||
weight: 3
|
||||
y:
|
||||
min: 62
|
||||
max: 180
|
||||
slabs:
|
||||
enable: true
|
||||
threshold: 0.0075
|
||||
palettes:
|
||||
- "minecraft:stone": "MOUNTAIN_SLABS"
|
||||
- "minecraft:gravel": "MOUNTAIN_SLABS"
|
||||
use-stairs-if-available: true
|
||||
stair-palettes:
|
||||
- "minecraft:stone": "MOUNTAIN_STAIRS"
|
||||
- "minecraft:gravel": "MOUNTAIN_STAIRS"
|
||||
|
||||
trees:
|
||||
density: 7
|
||||
items:
|
||||
CACTUS:
|
||||
weight: 1
|
||||
y:
|
||||
min: 58
|
||||
max: 72
|
@ -1,9 +1,9 @@
|
||||
noise-equation: "((-((y / 63)^2)) + 1) + (noise2(x/1.5, z/1.5)+0.1)/2.5"
|
||||
noise-equation: "((-((y / 63)^2)) + 1) + |(noise2(x/1.5, z/1.5)+0.25)|/2.5"
|
||||
elevation:
|
||||
equation: "min(floor(((max(noise2(x/1.5, z/1.5)+0.1, 0)) + 0.1)*5), 3)*10"
|
||||
equation: "min(floor(((max(noise2(x/1.5, z/1.5)+0.25, 0)))*5), 3)*9"
|
||||
interpolation: true
|
||||
extends: "BASIC_ORES"
|
||||
id: "MESA"
|
||||
id: "CRAG"
|
||||
|
||||
slant:
|
||||
palette:
|
||||
@ -11,27 +11,42 @@ slant:
|
||||
- BEDROCK_MOST: 1
|
||||
- BEDROCK_HALF: 2
|
||||
- BEDROCK_LITTLE: 3
|
||||
- RED_DESERT: 255
|
||||
- "BLOCK:minecraft:red_terracotta": 128
|
||||
- "BLOCK:minecraft:orange_terracotta": 124
|
||||
- "BLOCK:minecraft:terracotta": 120
|
||||
- "BLOCK:minecraft:yellow_terracotta": 116
|
||||
- "BLOCK:minecraft:red_terracotta": 112
|
||||
- "BLOCK:minecraft:orange_terracotta": 108
|
||||
- "BLOCK:minecraft:terracotta": 104
|
||||
- "BLOCK:minecraft:red_terracotta": 100
|
||||
- "BLOCK:minecraft:orange_terracotta": 96
|
||||
- "BLOCK:minecraft:terracotta": 255
|
||||
- "BLOCK:minecraft:gray_terracotta": 124
|
||||
- "BLOCK:minecraft:cyan_terracotta": 121
|
||||
- "BLOCK:minecraft:white_terracotta": 120
|
||||
- "BLOCK:minecraft:gray_terracotta": 119
|
||||
- "BLOCK:minecraft:orange_terracotta": 117
|
||||
- "BLOCK:minecraft:terracotta": 116
|
||||
- "BLOCK:minecraft:orange_terracotta": 115
|
||||
- "BLOCK:minecraft:terracotta": 111
|
||||
- "BLOCK:minecraft:red_terracotta": 109
|
||||
- "BLOCK:minecraft:terracotta": 108
|
||||
- "BLOCK:minecraft:white_terracotta": 107
|
||||
- "BLOCK:minecraft:red_terracotta": 106
|
||||
- "BLOCK:minecraft:yellow_terracotta": 103
|
||||
- "BLOCK:minecraft:terracotta": 102
|
||||
- "BLOCK:minecraft:yellow_terracotta": 101
|
||||
- "BLOCK:minecraft:terracotta": 98
|
||||
- "BLOCK:minecraft:red_terracotta": 95
|
||||
- "BLOCK:minecraft:yellow_terracotta": 94
|
||||
- "BLOCK:minecraft:white_terracotta": 93
|
||||
- "BLOCK:minecraft:terracotta": 92
|
||||
- "BLOCK:minecraft:yellow_terracotta": 88
|
||||
- "BLOCK:minecraft:red_terracotta": 84
|
||||
- "BLOCK:minecraft:orange_terracotta": 80
|
||||
- "BLOCK:minecraft:terracotta": 76
|
||||
- "BLOCK:minecraft:yellow_terracotta": 72
|
||||
- "BLOCK:minecraft:red_terracotta": 68
|
||||
- "BLOCK:minecraft:orange_terracotta": 64
|
||||
- "BLOCK:minecraft:terracotta": 60
|
||||
- "BLOCK:minecraft:yellow_terracotta": 56
|
||||
- "BLOCK:minecraft:red_terracotta": 52
|
||||
- "BLOCK:minecraft:orange_terracotta": 88
|
||||
- "BLOCK:minecraft:terracotta": 87
|
||||
- "BLOCK:minecraft:orange_terracotta": 86
|
||||
- "BLOCK:minecraft:terracotta": 85
|
||||
- "BLOCK:minecraft:red_terracotta": 82
|
||||
- "BLOCK:minecraft:terracotta": 80
|
||||
- "BLOCK:minecraft:orange_terracotta": 77
|
||||
- "BLOCK:minecraft:yellow_terracotta": 76
|
||||
- "BLOCK:minecraft:gray_terracotta": 75
|
||||
- "BLOCK:minecraft:cyan_terracotta": 73
|
||||
- "BLOCK:minecraft:white_terracotta": 72
|
||||
- "BLOCK:minecraft:terracotta": 71
|
||||
- "BLOCK:minecraft:terracotta": 70
|
||||
- "BLOCK:minecraft:orange_terracotta": 66
|
||||
- "BLOCK:minecraft:terracotta": 65
|
||||
y-offset:
|
||||
top: 0.3
|
||||
bottom: 0.25
|
||||
|
@ -43,8 +43,8 @@ frequencies:
|
||||
zone: 2048
|
||||
blend:
|
||||
enable: true
|
||||
frequency: 0.125
|
||||
amplitude: 10
|
||||
frequency: 0.12
|
||||
amplitude: 5
|
||||
erode:
|
||||
enable: true
|
||||
frequency: 0.001
|
||||
|
Loading…
x
Reference in New Issue
Block a user