aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/tectech/TecTech.java
blob: 4f3dc3428dd2fba7ff24666a62ec313b4b84df8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package tectech;

import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import eu.usrv.yamcore.auxiliary.IngameErrorLog;
import eu.usrv.yamcore.auxiliary.LogHelper;
import gregtech.api.enums.Mods;
import gregtech.api.objects.XSTR;
import tectech.loader.MainLoader;
import tectech.loader.TecTechConfig;
import tectech.loader.gui.CreativeTabTecTech;
import tectech.loader.thing.MuTeLoader;
import tectech.mechanics.enderStorage.EnderWorldSavedData;
import tectech.proxy.CommonProxy;
import tectech.recipe.EyeOfHarmonyRecipeStorage;
import tectech.recipe.TecTechRecipeMaps;

@Mod(
    modid = Reference.MODID,
    name = Reference.NAME,
    version = Reference.VERSION,
    dependencies = "required-after:Forge@[10.13.4.1614,);" + "required-after:YAMCore@[0.5.70,);"
        + "required-after:structurelib;"
        + "after:ComputerCraft;"
        + "after:OpenComputers;"
        + "required-after:gtneioreplugin;"
        + "required-after:gregtech;"
        + "after:dreamcraft;"
        + "after:appliedenergistics2;"
        + "after:CoFHCore;"
        + "after:Thaumcraft;")
public class TecTech {

    @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE)
    public static CommonProxy proxy;

    @Mod.Instance(Reference.MODID)
    public static TecTech instance;

    public static final XSTR RANDOM = XSTR.XSTR_INSTANCE;
    public static final LogHelper LOGGER = new LogHelper(Reference.MODID);
    public static CreativeTabTecTech creativeTabTecTech;

    public static TecTechConfig configTecTech;

    public static EnderWorldSavedData enderWorldSavedData;

    /**
     * For Loader.isModLoaded checks during the runtime
     */
    public static boolean hasCOFH = false;

    public static final byte tectechTexturePage1 = 8;

    @Mod.EventHandler
    @SuppressWarnings("unused")
    public void PreLoad(FMLPreInitializationEvent PreEvent) {
        LOGGER.setDebugOutput(true);

        configTecTech = new TecTechConfig(
            PreEvent.getModConfigurationDirectory(),
            Reference.COLLECTIONNAME,
            Reference.MODID);

        if (!configTecTech.LoadConfig()) {
            LOGGER.error(Reference.MODID + " could not load its config file. Things are going to be weird!");
        }

        if (configTecTech.MOD_ADMIN_ERROR_LOGS) {
            LOGGER.setDebugOutput(TecTechConfig.DEBUG_MODE);
            LOGGER.debug("moduleAdminErrorLogs is enabled");
            IngameErrorLog moduleAdminErrorLogs = new IngameErrorLog();
        }

        enderWorldSavedData = new EnderWorldSavedData();
        FMLCommonHandler.instance()
            .bus()
            .register(enderWorldSavedData);
        MinecraftForge.EVENT_BUS.register(enderWorldSavedData);
        TecTechEventHandlers.init();

        TecTechRecipeMaps.init();
        MainLoader.preLoad();
        new MuTeLoader().run();
    }

    @Mod.EventHandler
    @SuppressWarnings("unused")
    public void Load(FMLInitializationEvent event) {
        hasCOFH = Mods.COFHCore.isModLoaded();

        MainLoader.load();
        MainLoader.addAfterGregTechPostLoadRunner();
    }

    @Mod.EventHandler
    @SuppressWarnings("unused")
    public void PostLoad(FMLPostInitializationEvent PostEvent) {
        MainLoader.postLoad();
    }

    @Mod.EventHandler
    @SuppressWarnings("unused")
    public void onLoadCompleted(FMLLoadCompleteEvent event) {
        eyeOfHarmonyRecipeStorage = new EyeOfHarmonyRecipeStorage();
        MainLoader.onLoadCompleted();
    }

    public static EyeOfHarmonyRecipeStorage eyeOfHarmonyRecipeStorage = null;

}