mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-04 14:56:28 +00:00
biome source meta-fication
This commit is contained in:
@@ -58,6 +58,10 @@ public class ProbabilityCollection<E> implements Collection<E> {
|
||||
return newCollection;
|
||||
}
|
||||
|
||||
public <T> ProbabilityCollection<T> map(Function<E, T> mapper) {
|
||||
return map(mapper, true);
|
||||
}
|
||||
|
||||
public int getTotalProbability() {
|
||||
return array.length;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
package com.dfsek.terra.config.loaders.config.biome.templates.source;
|
||||
|
||||
import com.dfsek.tectonic.annotations.Value;
|
||||
import com.dfsek.terra.api.config.meta.MetaValue;
|
||||
import com.dfsek.terra.api.util.collections.ProbabilityCollection;
|
||||
import com.dfsek.terra.api.util.seeded.NoiseSeeded;
|
||||
import com.dfsek.terra.api.world.biome.pipeline.source.BiomeSource;
|
||||
import com.dfsek.terra.api.world.biome.pipeline.source.RandomSource;
|
||||
import com.dfsek.terra.config.builder.BiomeBuilder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NoiseSourceTemplate extends SourceTemplate {
|
||||
@Value("noise")
|
||||
private NoiseSeeded noise;
|
||||
private MetaValue<NoiseSeeded> noise;
|
||||
|
||||
@Value("biomes")
|
||||
private ProbabilityCollection<BiomeBuilder> biomes;
|
||||
private ProbabilityCollection<MetaValue<BiomeBuilder>> biomes;
|
||||
|
||||
@Override
|
||||
public BiomeSource apply(Long seed) {
|
||||
return new RandomSource(biomes.map((biome) -> biome.apply(seed), false), noise.apply(seed));
|
||||
return new RandomSource(biomes.map((biome) -> biome.get().apply(seed), false), noise.get().apply(seed));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user