begin work on WorldConfig stuff

This doesn't compile right now. A lot of work needs to be done.
This commit is contained in:
dfsek
2021-03-01 09:58:18 -07:00
parent 7f988dcf26
commit 5a6b7ac4c1
32 changed files with 377 additions and 152 deletions

View File

@@ -17,7 +17,7 @@ import java.util.function.Consumer;
* Registry implementation with read/write access. For internal use only.
* @param <T>
*/
public abstract class OpenRegistry<T> implements Registry<T> {
public class OpenRegistry<T> implements Registry<T> {
private final Map<String, T> objects = new HashMap<>();
@Override

View File

@@ -3,15 +3,16 @@ package com.dfsek.terra.registry.config;
import com.dfsek.tectonic.exception.LoadException;
import com.dfsek.tectonic.loading.ConfigLoader;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.config.builder.ConfigBuilder;
import com.dfsek.terra.registry.OpenRegistry;
import java.lang.reflect.Type;
public class BiomeRegistry extends OpenRegistry<TerraBiome> {
public class BiomeRegistry extends OpenRegistry<ConfigBuilder<TerraBiome>> {
@Override
public TerraBiome load(Type type, Object o, ConfigLoader configLoader) throws LoadException {
public ConfigBuilder<TerraBiome> load(Type type, Object o, ConfigLoader configLoader) throws LoadException {
if(o.equals("SELF")) return null;
TerraBiome biome = get((String) o);
ConfigBuilder<TerraBiome> biome = get((String) o);
if(biome == null)
throw new LoadException("No such " + type.getTypeName() + " matching \"" + o + "\" was found in this registry.");
return biome;