mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-11 10:16:15 +00:00
more addonification progress
This commit is contained in:
@@ -14,6 +14,7 @@ group = "com.dfsek.terra.common"
|
||||
|
||||
dependencies {
|
||||
"shadedApi"(project(":common:api"))
|
||||
"compileOnly"(project(":common:addons:noise"))
|
||||
|
||||
"shadedApi"("org.apache.commons:commons-rng-core:1.3")
|
||||
"shadedApi"("commons-io:commons-io:2.4")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.api.config;
|
||||
|
||||
import com.dfsek.terra.api.registry.meta.RegistryHolder;
|
||||
import com.dfsek.terra.api.tectonic.LoaderHolder;
|
||||
import com.dfsek.terra.api.tectonic.LoaderRegistrar;
|
||||
import com.dfsek.terra.api.addon.TerraAddon;
|
||||
@@ -10,14 +11,14 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ConfigPack extends LoaderRegistrar, LoaderHolder {
|
||||
public interface ConfigPack extends LoaderRegistrar, LoaderHolder, RegistryHolder {
|
||||
<T> CheckedRegistry<T> getRegistry(Class<T> clazz);
|
||||
|
||||
BiomeProvider.BiomeProviderBuilder getBiomeProviderBuilder();
|
||||
|
||||
WorldConfig toWorldConfig(TerraWorld world);
|
||||
|
||||
CheckedRegistry<ConfigType<?, ?>> getConfigTypeRegistry();
|
||||
void registerConfigType(ConfigType<?, ?> type, int priority);
|
||||
|
||||
Set<TerraAddon> addons();
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.dfsek.terra.api.registry.meta;
|
||||
|
||||
import com.dfsek.terra.api.registry.CheckedRegistry;
|
||||
import com.dfsek.terra.api.registry.Registry;
|
||||
|
||||
public interface RegistryHolder {
|
||||
<T> Registry<T> getRegistry(Class<T> clazz);
|
||||
|
||||
<T>CheckedRegistry<T> getCheckedRegistry(Class<T> clazz) throws IllegalStateException;
|
||||
}
|
||||
@@ -292,6 +292,11 @@ public class ConfigPackImpl implements ConfigPack {
|
||||
return (CheckedRegistry<T>) registryMap.getOrDefault(clazz, ImmutablePair.ofNull()).getRight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CheckedRegistry<T> getCheckedRegistry(Class<T> clazz) throws IllegalStateException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T> OpenRegistry<T> getOpenRegistry(Class<T> clazz) {
|
||||
return (OpenRegistry<T>) registryMap.getOrDefault(clazz, ImmutablePair.ofNull()).getLeft();
|
||||
@@ -323,14 +328,8 @@ public class ConfigPackImpl implements ConfigPack {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckedRegistry<ConfigType<?, ?>> getConfigTypeRegistry() {
|
||||
return new CheckedRegistryImpl<>(configTypeRegistry) {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void addUnchecked(String identifier, ConfigType<?, ?> value) {
|
||||
if(contains(identifier)) throw new UnsupportedOperationException("Cannot override values in ConfigTypeRegistry!");
|
||||
}
|
||||
};
|
||||
public void registerConfigType(ConfigType<?, ?> type, int priority) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user