mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-20 23:30:29 +00:00
begin work on WorldConfig stuff
This doesn't compile right now. A lot of work needs to be done.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user