mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 14:50:56 +00:00
implement features using dynamic templates
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab
|
|||||||
.getContext()
|
.getContext()
|
||||||
.get(BiomeFeatures.class)
|
.get(BiomeFeatures.class)
|
||||||
.getFeatures()
|
.getFeatures()
|
||||||
.getOrDefault(id, Collections.emptyList())
|
.getOrDefault(this, Collections.emptyList())
|
||||||
.forEach(feature -> {
|
.forEach(feature -> {
|
||||||
try(ProfileFrame ignored = platform.getProfiler().profile(feature.getID())) {
|
try(ProfileFrame ignored = platform.getProfiler().profile(feature.getID())) {
|
||||||
if(feature.getDistributor().matches(tx, tz, seed)) {
|
if(feature.getDistributor().matches(tx, tz, seed)) {
|
||||||
|
|||||||
+4
-3
@@ -10,18 +10,19 @@ package com.dfsek.terra.addons.generation.feature.config;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.generation.feature.FeatureGenerationStage;
|
||||||
import com.dfsek.terra.api.properties.Properties;
|
import com.dfsek.terra.api.properties.Properties;
|
||||||
import com.dfsek.terra.api.structure.feature.Feature;
|
import com.dfsek.terra.api.structure.feature.Feature;
|
||||||
|
|
||||||
|
|
||||||
public class BiomeFeatures implements Properties {
|
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;
|
this.features = features;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, List<Feature>> getFeatures() {
|
public Map<FeatureGenerationStage, List<Feature>> getFeatures() {
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-32
@@ -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