Search in sources :

Example 6 with IForestryModule

use of forestry.api.modules.IForestryModule 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();
}
Also used : ForestryModule(forestry.api.modules.ForestryModule) IForestryModule(forestry.api.modules.IForestryModule) Property(net.minecraftforge.common.config.Property)

Example 7 with IForestryModule

use of forestry.api.modules.IForestryModule 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);
    }
}
Also used : ForestryModule(forestry.api.modules.ForestryModule) IForestryModule(forestry.api.modules.IForestryModule) ArrayList(java.util.ArrayList) IForestryModule(forestry.api.modules.IForestryModule)

Example 8 with IForestryModule

use of forestry.api.modules.IForestryModule in project ForestryMC by ForestryMC.

the class CommandModules method listModulesForSender.

private static void listModulesForSender(ICommandSender sender) {
    StringBuilder pluginList = new StringBuilder();
    for (IForestryModule module : ModuleManager.getLoadedModules()) {
        if (pluginList.length() > 0) {
            pluginList.append(", ");
        }
        pluginList.append(makeListEntry(module));
    }
    CommandHelpers.sendChatMessage(sender, pluginList.toString());
}
Also used : IForestryModule(forestry.api.modules.IForestryModule)

Example 9 with IForestryModule

use of forestry.api.modules.IForestryModule 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;
}
Also used : ForestryModule(forestry.api.modules.ForestryModule) IForestryModule(forestry.api.modules.IForestryModule) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 10 with IForestryModule

use of forestry.api.modules.IForestryModule in project ForestryMC by ForestryMC.

the class InternalModuleHandler method runSetup.

public void runSetup() {
    stage = Stage.SETUP;
    for (IForestryModule module : modules) {
        Log.debug("Setup API Start: {}", module);
        module.setupAPI();
        Log.debug("Setup API Complete: {}", module);
    }
    stage = Stage.SETUP_DISABLED;
    for (IForestryModule module : disabledModules) {
        Log.debug("Disabled-Setup Start: {}", module);
        module.disabledSetupAPI();
        Log.debug("Disabled-Setup Complete: {}", module);
    }
    stage = Stage.REGISTER;
    for (IForestryModule module : modules) {
        Log.debug("Register Items and Blocks Start: {}", module);
        module.registerItemsAndBlocks();
        Log.debug("Register Items and Blocks Complete: {}", module);
    }
}
Also used : IForestryModule(forestry.api.modules.IForestryModule)

Aggregations

IForestryModule (forestry.api.modules.IForestryModule)14 ForestryModule (forestry.api.modules.ForestryModule)9 ArrayList (java.util.ArrayList)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 Property (net.minecraftforge.common.config.Property)3 Log (forestry.core.utils.Log)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 ASMDataTable (net.minecraftforge.fml.common.discovery.ASMDataTable)2 Preconditions (com.google.common.base.Preconditions)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Lists (com.google.common.collect.Lists)1 ForestryAPI (forestry.api.core.ForestryAPI)1 IModuleContainer (forestry.api.modules.IModuleContainer)1