noise addon impl

This commit is contained in:
dfsek
2021-07-05 20:09:59 -07:00
parent fe28fcedd1
commit b8e1e99b84
2 changed files with 11 additions and 4 deletions

View File

@@ -184,6 +184,12 @@ public class ConfigPackImpl implements ConfigPack {
toWorldConfig(new TerraWorldImpl(new DummyWorld(), this, main)); // Build now to catch any errors immediately.
}
@SuppressWarnings("unchecked")
private void applyLoaders(TypeRegistry registry) {
loaders.forEach(registry::registerLoader);
objectLoaders.forEach((t, l) -> registry.registerLoader(t, (TemplateProvider<ObjectTemplate<Object>>) ((Object) l)));
}
private Map<Class<?>, ImmutablePair<OpenRegistry<?>, CheckedRegistry<?>>> newRegistryMap() {
Map<Class<?>, ImmutablePair<OpenRegistry<?>, CheckedRegistry<?>>> map = new HashMap<Class<?>, ImmutablePair<OpenRegistry<?>, CheckedRegistry<?>>>() {
@Serial
@@ -230,6 +236,8 @@ public class ConfigPackImpl implements ConfigPack {
@SuppressWarnings({"unchecked", "rawtypes"})
private void load(long start, TerraPlugin main) throws ConfigException {
applyLoaders(abstractConfigLoader);
applyLoaders(selfLoader);
configTypes.values().forEach(list -> list.forEach(pair -> configTypeRegistry.register(pair.getLeft(), pair.getRight())));
for(Map.Entry<String, Double> var : template.getVariables().entrySet()) {
@@ -297,8 +305,6 @@ public class ConfigPackImpl implements ConfigPack {
.registerLoader(ConfigType.class, configTypeRegistry)
.registerLoader(BufferedImage.class, new BufferedImageLoader(loader));
registryMap.forEach((clazz, reg) -> registry.registerLoader(clazz, reg.getLeft()));
loaders.forEach(registry::registerLoader);
objectLoaders.forEach((t, l) -> registry.registerLoader(t, (TemplateProvider<ObjectTemplate<Object>>) ((Object) l)));
}
@Override