mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-22 08:10:40 +00:00
implement API for 3d biomes
This commit is contained in:
@@ -37,7 +37,7 @@ public class ImageBiomeProvider implements BiomeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int x, int z, long seed) {
|
||||
public Biome getBiome(int x, int y, int z, long seed) {
|
||||
x /= resolution;
|
||||
z /= resolution;
|
||||
Color color = align.getColor(image, x, z);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class BiomePipelineProvider implements BiomeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int x, int z, long seed) {
|
||||
public Biome getBiome(int x, int y, int z, long seed) {
|
||||
x += mutator.noise(seed + 1, x, z) * noiseAmp;
|
||||
z += mutator.noise(seed + 2, x, z) * noiseAmp;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class SingleBiomeProvider implements BiomeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int x, int z, long seed) {
|
||||
public Biome getBiome(int x, int y, int z, long seed) {
|
||||
return biome;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
||||
int cx = xOrig + x;
|
||||
int cz = zOrig + z;
|
||||
|
||||
Biome biome = biomeProvider.getBiome(cx, cz, seed);
|
||||
Biome biome = biomeProvider.getBiome(cx, 0, cz, seed);
|
||||
|
||||
PaletteInfo paletteInfo = biome.getContext().get(PaletteInfo.class);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(WorldProperties world, int x, int y, int z, BiomeProvider biomeProvider) {
|
||||
Biome biome = biomeProvider.getBiome(x, z, world.getSeed());
|
||||
Biome biome = biomeProvider.getBiome(x, y, z, world.getSeed());
|
||||
Sampler3D sampler = samplerCache.get(x, z, world, biomeProvider);
|
||||
|
||||
PaletteInfo paletteInfo = biome.getContext().get(PaletteInfo.class);
|
||||
@@ -128,7 +128,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
||||
|
||||
@Override
|
||||
public Palette getPalette(int x, int y, int z, WorldProperties world, BiomeProvider biomeProvider) {
|
||||
return biomeProvider.getBiome(x, z, world.getSeed()).getContext().get(PaletteInfo.class).paletteHolder().getPalette(y);
|
||||
return biomeProvider.getBiome(x, y, z, world.getSeed()).getContext().get(PaletteInfo.class).paletteHolder().getPalette(y);
|
||||
}
|
||||
|
||||
public SamplerProvider samplerProvider() {
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ChunkInterpolator {
|
||||
|
||||
for(int x = 0; x < 5; x++) {
|
||||
for(int z = 0; z < 5; z++) {
|
||||
BiomeNoiseProperties generationSettings = provider.getBiome(xOrigin + (x << 2), zOrigin + (z << 2), seed)
|
||||
BiomeNoiseProperties generationSettings = provider.getBiome(xOrigin + (x << 2), 0, zOrigin + (z << 2), seed)
|
||||
.getContext()
|
||||
.get(BiomeNoiseProperties.class);
|
||||
Map<BiomeNoiseProperties, MutableInteger> genMap = new HashMap<>();
|
||||
@@ -66,7 +66,7 @@ public class ChunkInterpolator {
|
||||
for(int xi = -blend; xi <= blend; xi++) {
|
||||
for(int zi = -blend; zi <= blend; zi++) {
|
||||
genMap.computeIfAbsent(
|
||||
provider.getBiome(xOrigin + (x << 2) + (xi * step), zOrigin + (z << 2) + (zi * step), seed)
|
||||
provider.getBiome(xOrigin + (x << 2) + (xi * step), 0, zOrigin + (z << 2) + (zi * step), seed)
|
||||
.getContext()
|
||||
.get(BiomeNoiseProperties.class),
|
||||
g -> new MutableInteger(0)).increment(); // Increment by 1
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ElevationInterpolator {
|
||||
// Precompute generators.
|
||||
for(int x = -1 - smooth; x <= 16 + smooth; x++) {
|
||||
for(int z = -1 - smooth; z <= 16 + smooth; z++) {
|
||||
gens[x + 1 + smooth][z + 1 + smooth] = provider.getBiome(xOrigin + x, zOrigin + z, seed).getContext().get(
|
||||
gens[x + 1 + smooth][z + 1 + smooth] = provider.getBiome(xOrigin + x, 0, zOrigin + z, seed).getContext().get(
|
||||
BiomeNoiseProperties.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class LazilyEvaluatedInterpolator {
|
||||
|
||||
NoiseSampler sampler = samplers[x][z];
|
||||
if(sampler == null) {
|
||||
sampler = biomeProvider.getBiome(xi, zi, seed).getContext().get(BiomeNoiseProperties.class).carving();
|
||||
sampler = biomeProvider.getBiome(xi, y, zi, seed).getContext().get(BiomeNoiseProperties.class).carving();
|
||||
samplers[x][z] = sampler;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab
|
||||
long coordinateSeed = (seed * 31 + tx) * 31 + tz;
|
||||
|
||||
world.getBiomeProvider()
|
||||
.getBiome(tx, tz, seed)
|
||||
.getBiome(tx, 0, tz, seed)
|
||||
.getContext()
|
||||
.get(BiomeFeatures.class)
|
||||
.getFeatures()
|
||||
|
||||
Reference in New Issue
Block a user