mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-16 21:30:08 +00:00
implement features using dynamic templates
This commit is contained in:
@@ -48,7 +48,7 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab
|
||||
.getContext()
|
||||
.get(BiomeFeatures.class)
|
||||
.getFeatures()
|
||||
.getOrDefault(id, Collections.emptyList())
|
||||
.getOrDefault(this, Collections.emptyList())
|
||||
.forEach(feature -> {
|
||||
try(ProfileFrame ignored = platform.getProfiler().profile(feature.getID())) {
|
||||
if(feature.getDistributor().matches(tx, tz, seed)) {
|
||||
|
||||
@@ -10,18 +10,19 @@ package com.dfsek.terra.addons.generation.feature.config;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.addons.generation.feature.FeatureGenerationStage;
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
import com.dfsek.terra.api.structure.feature.Feature;
|
||||
|
||||
|
||||
public class BiomeFeatures implements Properties {
|
||||
private final Map<String, List<Feature>> features;
|
||||
private final Map<FeatureGenerationStage, List<Feature>> features;
|
||||
|
||||
public BiomeFeatures(Map<String, List<Feature>> features) {
|
||||
public BiomeFeatures(Map<FeatureGenerationStage, List<Feature>> features) {
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
public Map<String, List<Feature>> getFeatures() {
|
||||
public Map<FeatureGenerationStage, List<Feature>> getFeatures() {
|
||||
return features;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.generation.feature.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.api.config.meta.Meta;
|
||||
import com.dfsek.terra.api.structure.feature.Feature;
|
||||
|
||||
|
||||
@SuppressWarnings("FieldMayBeFinal")
|
||||
public class BiomeFeaturesTemplate implements ObjectTemplate<BiomeFeatures> {
|
||||
@Value("features")
|
||||
@Default
|
||||
private @Meta Map<@Meta String, @Meta List<@Meta Feature>> features = Collections.emptyMap();
|
||||
|
||||
@Override
|
||||
public BiomeFeatures get() {
|
||||
return new BiomeFeatures(features);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user