mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-16 21:30:08 +00:00
implement flora populator
This commit is contained in:
@@ -17,11 +17,14 @@ public class ConfigLoadEvent implements PackEvent {
|
||||
private final Consumer<ConfigTemplate> loader;
|
||||
private final ConfigType<?, ?> type;
|
||||
|
||||
public ConfigLoadEvent(ConfigPack pack, AbstractConfiguration configuration, Consumer<ConfigTemplate> loader, ConfigType<?, ?> type) {
|
||||
private final Object loaded;
|
||||
|
||||
public ConfigLoadEvent(ConfigPack pack, AbstractConfiguration configuration, Consumer<ConfigTemplate> loader, ConfigType<?, ?> type, Object loaded) {
|
||||
this.pack = pack;
|
||||
this.configuration = configuration;
|
||||
this.loader = loader;
|
||||
this.type = type;
|
||||
this.loaded = loaded;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,4 +44,10 @@ public class ConfigLoadEvent implements PackEvent {
|
||||
public ConfigType<?, ?> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getLoadedObject(Class<T> clazz) {
|
||||
if(!clazz.isAssignableFrom(type.getTypeClass())) throw new ClassCastException("Cannot assign object from loader of type " + type.getTypeClass().getCanonicalName() + " to class " + clazz.getCanonicalName());
|
||||
return (T) loaded;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user