use of forestry.api.modules.ForestryModule in project Binnie by ForestryMC.
the class ModuleContainer method isModuleEnabled.
@Override
public boolean isModuleEnabled(IForestryModule module) {
ForestryModule info = module.getClass().getAnnotation(ForestryModule.class);
String comment = ForestryPluginUtil.getComment(module);
Property prop = getModulesConfig().get(CONFIG_CATEGORY, info.moduleID(), true, comment);
return prop.getBoolean();
}
use of forestry.api.modules.ForestryModule in project ForestryMC by ForestryMC.
the class ForestryModEnvWarningCallable method register.
public static void register() {
Set<IForestryModule> configDisabledModules = ModuleManager.configDisabledModules;
if (!configDisabledModules.isEmpty()) {
List<String> disabledModuleNames = new ArrayList<>();
for (IForestryModule module : configDisabledModules) {
ForestryModule info = module.getClass().getAnnotation(ForestryModule.class);
disabledModuleNames.add(info.name());
}
String disabledModulesMessage = "Modules have been disabled in the config: " + Joiner.on(", ").join(disabledModuleNames);
ForestryModEnvWarningCallable callable = new ForestryModEnvWarningCallable(disabledModulesMessage);
FMLCommonHandler.instance().registerCrashCallable(callable);
}
}
use of forestry.api.modules.ForestryModule in project ForestryMC by ForestryMC.
the class ForestryPluginUtil method getComment.
public static String getComment(IForestryModule module) {
ForestryModule info = module.getClass().getAnnotation(ForestryModule.class);
String comment = I18n.translateToLocal(info.unlocalizedDescription());
Set<ResourceLocation> dependencies = module.getDependencyUids();
if (!dependencies.isEmpty()) {
Iterator<ResourceLocation> iDependencies = dependencies.iterator();
StringBuilder builder = new StringBuilder(comment);
builder.append("\n");
builder.append("Dependencies: [ ");
builder.append(iDependencies.next());
while (iDependencies.hasNext()) {
ResourceLocation uid = iDependencies.next();
builder.append(", ").append(uid.toString());
}
builder.append(" ]");
comment = builder.toString();
}
return comment;
}
use of forestry.api.modules.ForestryModule in project ForestryMC by ForestryMC.
the class ModuleManager method getLootTableFiles.
public static Set<String> getLootTableFiles() {
Set<String> lootTableNames = new HashSet<>();
for (IForestryModule module : loadedModules) {
ForestryModule info = module.getClass().getAnnotation(ForestryModule.class);
String lootTableFolder = info.lootTable();
if (!lootTableFolder.isEmpty()) {
lootTableNames.add(lootTableFolder);
}
}
return lootTableNames;
}
Aggregations