feature addon registry configuration

This commit is contained in:
dfsek
2021-12-12 20:50:55 -07:00
parent 480bb84d9c
commit c804947923
8 changed files with 73 additions and 26 deletions

View File

@@ -118,12 +118,6 @@ public class ConfigPackImpl implements ConfigPack {
private final Map<Type, Pair<OpenRegistry<?>, CheckedRegistry<?>>> registryMap = new HashMap<>();
private final ConfigTypeRegistry configTypeRegistry;
private final Lazy<List<GenerationStage>> stages = Lazy.lazy(() -> template
.getStages()
.stream()
.map(stage -> stage.newInstance(this))
.collect(Collectors.toList()));
private final TreeMap<Integer, List<Pair<String, ConfigType<?, ?>>>> configTypes = new TreeMap<>();
public ConfigPackImpl(File folder, Platform platform) throws ConfigException {
@@ -352,7 +346,7 @@ public class ConfigPackImpl implements ConfigPack {
@Override
public List<GenerationStage> getStages() {
return stages.value();
return template.getStages();
}
@Override

View File

@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import com.dfsek.terra.api.config.meta.Meta;
import com.dfsek.terra.api.world.chunk.generation.stage.GenerationStage;
import com.dfsek.terra.api.world.chunk.generation.util.provider.ChunkGeneratorProvider;
import com.dfsek.terra.api.world.chunk.generation.util.provider.GenerationStageProvider;
@@ -76,7 +77,7 @@ public class ConfigPackTemplate implements ConfigTemplate {
private @Meta boolean disableSaplings = false;
@Value("stages")
private @Meta List<@Meta GenerationStageProvider> stages;
private @Meta List<@Meta GenerationStage> stages;
@Value("version")
@Default
@@ -149,7 +150,7 @@ public class ConfigPackTemplate implements ConfigTemplate {
return generatorProvider;
}
public List<GenerationStageProvider> getStages() {
public List<GenerationStage> getStages() {
return stages;
}