mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-08-18 09:25:42 +00:00
Compare commits
3 Commits
cd69c7e77d
...
7214053b9e
Author | SHA1 | Date | |
---|---|---|---|
|
7214053b9e | ||
|
da5d0c52f2 | ||
|
f3476c5cc8 |
@ -41,7 +41,7 @@ object Versions {
|
||||
|
||||
const val minecraft = "1.20.4"
|
||||
const val yarn = "$minecraft+build.1"
|
||||
const val fabricLoader = "0.15.1"
|
||||
const val fabricLoader = "0.15.3"
|
||||
|
||||
const val architecuryLoom = "1.4.369"
|
||||
const val architecturyPlugin = "3.4.151"
|
||||
|
@ -13,6 +13,7 @@ import java.util.random.RandomGeneratorFactory;
|
||||
|
||||
import com.dfsek.terra.addons.generation.feature.config.BiomeFeatures;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||
import com.dfsek.terra.api.properties.PropertyKey;
|
||||
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
||||
import com.dfsek.terra.api.util.Rotation;
|
||||
@ -32,13 +33,20 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab
|
||||
|
||||
private final int resolution;
|
||||
private final PropertyKey<BiomeFeatures> biomeFeaturesKey;
|
||||
private final NoiseSampler blendSampler;
|
||||
private final boolean doBlending;
|
||||
private final double blendAmplitude;
|
||||
|
||||
public FeatureGenerationStage(Platform platform, String id, int resolution, PropertyKey<BiomeFeatures> biomeFeaturesKey) {
|
||||
public FeatureGenerationStage(Platform platform, String id, int resolution, PropertyKey<BiomeFeatures> biomeFeaturesKey,
|
||||
NoiseSampler blendSampler, double blendAmplitude) {
|
||||
this.platform = platform;
|
||||
this.id = id;
|
||||
this.profile = "feature_stage:" + id;
|
||||
this.resolution = resolution;
|
||||
this.biomeFeaturesKey = biomeFeaturesKey;
|
||||
this.blendSampler = blendSampler;
|
||||
this.doBlending = blendAmplitude != 0d;
|
||||
this.blendAmplitude = blendAmplitude;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,7 +61,10 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab
|
||||
int tx = cx + chunkX;
|
||||
int tz = cz + chunkZ;
|
||||
world.getBiomeProvider()
|
||||
.getColumn(tx, tz, world)
|
||||
.getColumn(
|
||||
tx + (doBlending ? (int) (blendSampler.noise(seed, tx, tz) * blendAmplitude) : 0),
|
||||
tz + (doBlending ? (int) (blendSampler.noise(seed+1, tx, tz) * blendAmplitude) : 0),
|
||||
world)
|
||||
.forRanges(resolution, (min, max, biome) -> {
|
||||
for(int subChunkX = 0; subChunkX < resolution; subChunkX++) {
|
||||
for(int subChunkZ = 0; subChunkZ < resolution; subChunkZ++) {
|
||||
|
@ -8,6 +8,7 @@ import com.dfsek.tectonic.api.exception.ValidationException;
|
||||
|
||||
import com.dfsek.terra.addons.generation.feature.FeatureGenerationStage;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||
import com.dfsek.terra.api.properties.PropertyKey;
|
||||
import com.dfsek.terra.api.world.chunk.generation.stage.GenerationStage;
|
||||
|
||||
@ -22,6 +23,24 @@ public class FeatureStageTemplate implements ObjectTemplate<GenerationStage>, Va
|
||||
@Default
|
||||
private int resolution = 4;
|
||||
|
||||
@Value("blend.sampler")
|
||||
@Default
|
||||
private NoiseSampler blendSampler = new NoiseSampler() {
|
||||
@Override
|
||||
public double noise(long seed, double x, double y) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double noise(long seed, double x, double y, double z) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@Value("blend.amplitude")
|
||||
@Default
|
||||
private double blendAmplitude = 0d;
|
||||
|
||||
public FeatureStageTemplate(Platform platform, PropertyKey<BiomeFeatures> biomeFeaturesKey) {
|
||||
this.platform = platform;
|
||||
this.biomeFeaturesKey = biomeFeaturesKey;
|
||||
@ -30,7 +49,7 @@ public class FeatureStageTemplate implements ObjectTemplate<GenerationStage>, Va
|
||||
|
||||
@Override
|
||||
public FeatureGenerationStage get() {
|
||||
return new FeatureGenerationStage(platform, id, resolution, biomeFeaturesKey);
|
||||
return new FeatureGenerationStage(platform, id, resolution, biomeFeaturesKey, blendSampler, blendAmplitude);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user