Search in sources :

Example 1 with BasicScriptCommandManager

use of me.superckl.api.superscript.script.command.BasicScriptCommandManager in project BiomeTweaker by superckl.

the class BiomeTweaker method onPreInit.

@EventHandler
public void onPreInit(final FMLPreInitializationEvent e) {
    final ProgressBar bar = ProgressManager.push("BiomeTweaker PreInitialization", 6, true);
    LogHelper.setLogger(e.getModLog());
    bar.step("Reading config");
    if (!this.signed) {
        LogHelper.warn("Hey... uhm... this is awkward but, it looks like you're using an unofficial version of BiomeTweaker. Where exactly did you get this from?");
        LogHelper.warn("Unless I (superckl) sent you this version, don't expect to get any support for it.");
    }
    this.config = new Config(new File(Loader.instance().getConfigDir(), ModData.MOD_NAME + "/"));
    this.config.loadValues();
    final List<IMCMessage> messages = FMLInterModComms.fetchRuntimeMessages(ModData.MOD_ID);
    for (final IMCMessage message : messages) if (message.key.equals("enableTweak") && message.isStringMessage()) {
        LogHelper.debug("Received enableTweak IMC message from " + message.getSender() + ", enabling tweak: " + message.getStringValue());
        this.enabledTweaks.add(message.getStringValue());
    }
    bar.step("Initializing scripting enviroment");
    final File scripts = new File(this.config.getBtConfigFolder(), "scripts/");
    scripts.mkdirs();
    this.commandManager = new BasicScriptCommandManager();
    ScriptCommandRegistry.INSTANCE.registerScriptCommandManager(ModData.MOD_ID, this.commandManager);
    BiomeTweaker.proxy.initProperties();
    BiomeTweaker.proxy.setupScripts(e.getAsmData());
    bar.step("Pre-Initializing Integration");
    IntegrationManager.INSTANCE.preInit();
    bar.step("Registering handlers");
    BiomeTweaker.proxy.registerHandlers();
    bar.step("Parsing scripts");
    this.parseScripts();
    bar.step("Applying scripts");
    this.commandManager.applyCommandsFor(ApplicationStage.PRE_INIT);
    ProgressManager.pop(bar);
}
Also used : IMCMessage(net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage) Config(me.superckl.biometweaker.config.Config) BasicScriptCommandManager(me.superckl.api.superscript.script.command.BasicScriptCommandManager) ProgressBar(net.minecraftforge.fml.common.ProgressManager.ProgressBar) File(java.io.File) EventHandler(net.minecraftforge.fml.common.Mod.EventHandler)

Aggregations

File (java.io.File)1 BasicScriptCommandManager (me.superckl.api.superscript.script.command.BasicScriptCommandManager)1 Config (me.superckl.biometweaker.config.Config)1 EventHandler (net.minecraftforge.fml.common.Mod.EventHandler)1 ProgressBar (net.minecraftforge.fml.common.ProgressManager.ProgressBar)1 IMCMessage (net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage)1