Search in sources :

Example 1 with CoreModDispatcher

use of com.dreammaster.network.CoreModDispatcher in project NewHorizonsCoreMod by GTNewHorizons.

the class MainRegistry method PreLoad.

@EventHandler
public void PreLoad(FMLPreInitializationEvent PreEvent) {
    Logger.setDebugOutput(true);
    Rnd = new Random(System.currentTimeMillis());
    // ------------------------------------------------------------
    // Init coremod config file. Create it if it's not there
    CoreConfig = new CoreModConfig(PreEvent.getModConfigurationDirectory(), Refstrings.COLLECTIONID, Refstrings.MODID);
    if (!CoreConfig.LoadConfig())
        Logger.error(String.format("%s could not load its config file. Things are going to be weird!", Refstrings.MODID));
    if (CoreConfig.ModAdminErrorLogs_Enabled) {
        Logger.debug("Module_AdminErrorLogs is enabled");
        Module_AdminErrorLogs = new IngameErrorLog();
    }
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Init NetworkChannel");
    NW = new CoreModDispatcher();
    NW.registerPackets();
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Init itemmanager");
    ItemManager = new ModItemManager(Refstrings.MODID);
    BlockManager = new ModBlockManager(Refstrings.MODID);
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Init Tabmanager");
    TabManager = new CreativeTabsManager();
    ModTabList.InitModTabs(TabManager, ItemManager);
    //Materials init
    if (!GT_Mod.gregtechproxy.mEnableAllMaterials)
        new GT_CoreModSupport();
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Create Items");
    if (!ItemList.AddToItemManager(ItemManager)) {
        Logger.warn("Some items failed to register. Check the logfile for details");
        AddLoginError("[CoreMod-Items] Some items failed to register. Check the logfile for details");
    }
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.info("PRELOAD Create Blocks");
    if (!BlockList.AddToItemManager(BlockManager)) {
        Logger.warn("Some blocks failed to register. Check the logfile for details");
        AddLoginError("[CoreMod-Blocks] Some blocks failed to register. Check the logfile for details");
    }
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    // Init Modules
    Logger.debug("PRELOAD Init Modules");
    if (CoreConfig.ModHazardousItems_Enabled) {
        Logger.debug("Module_HazardousItems is enabled");
        Module_HazardousItems = new HazardousItemsHandler();
    // Module_HazardousItems.LoadConfig();
    }
    if (CoreConfig.ModCustomToolTips_Enabled) {
        Logger.debug("Module_HazardousItems is enabled");
        Module_CustomToolTips = new CustomToolTipsHandler();
    // Module_CustomToolTips.LoadConfig();
    }
    if (CoreConfig.ModCustomFuels_Enabled) {
        Logger.debug("Module_CustomFuels is enabled");
        Module_CustomFuels = new CustomFuelsHandler();
    // Module_CustomFuels.LoadConfig();
    }
    if (CoreConfig.ModCustomDrops_Enabled) {
        Logger.debug("Module_CustomDrops is enabled");
        Module_CustomDrops = new CustomDropsHandler(PreEvent.getModConfigurationDirectory());
    }
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Create Fluids");
    FluidManager = new ModFluidManager(Refstrings.MODID);
    if (!FluidList.AddToItemManager(FluidManager)) {
        Logger.warn("Some fluids failed to register. Check the logfile for details");
        AddLoginError("[CoreMod-Fluids] Some fluids failed to register. Check the logfile for details");
    }
    // ------------------------------------------------------------
    // register final list with valid items to forge
    Logger.debug("LOAD Register Items");
    ItemManager.RegisterItems(TabManager);
    Logger.debug("LOAD Register Blocks");
    BlockManager.RegisterItems(TabManager);
    Logger.debug("LOAD Register Fluids");
    FluidManager.RegisterItems(TabManager);
    // register all non-enum items
    Logger.debug("LOAD Register non enum Items");
    if (!RegisterNonEnumItems()) {
        Logger.error("Some extended items could not be registered to the game registry");
        AddLoginError("[CoreMod-Items] Some extended items could not be registered to the game registry");
    }
    if (PreEvent.getSide() == Side.CLIENT) {
        FMLCommonHandler.instance().bus().register(new NotificationTickHandler());
    }
}
Also used : NotificationTickHandler(eu.usrv.yamcore.client.NotificationTickHandler) GT_CoreModSupport(com.dreammaster.gthandler.GT_CoreModSupport) CustomDropsHandler(com.dreammaster.modcustomdrops.CustomDropsHandler) CustomFuelsHandler(com.dreammaster.modcustomfuels.CustomFuelsHandler) CoreModConfig(com.dreammaster.config.CoreModConfig) ModBlockManager(eu.usrv.yamcore.blocks.ModBlockManager) CreativeTabsManager(eu.usrv.yamcore.creativetabs.CreativeTabsManager) IngameErrorLog(eu.usrv.yamcore.auxiliary.IngameErrorLog) CoreModDispatcher(com.dreammaster.network.CoreModDispatcher) ModItemManager(eu.usrv.yamcore.items.ModItemManager) Random(java.util.Random) HazardousItemsHandler(com.dreammaster.modhazardousitems.HazardousItemsHandler) ModFluidManager(eu.usrv.yamcore.fluids.ModFluidManager) CustomToolTipsHandler(com.dreammaster.modctt.CustomToolTipsHandler) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Aggregations

CoreModConfig (com.dreammaster.config.CoreModConfig)1 GT_CoreModSupport (com.dreammaster.gthandler.GT_CoreModSupport)1 CustomToolTipsHandler (com.dreammaster.modctt.CustomToolTipsHandler)1 CustomDropsHandler (com.dreammaster.modcustomdrops.CustomDropsHandler)1 CustomFuelsHandler (com.dreammaster.modcustomfuels.CustomFuelsHandler)1 HazardousItemsHandler (com.dreammaster.modhazardousitems.HazardousItemsHandler)1 CoreModDispatcher (com.dreammaster.network.CoreModDispatcher)1 EventHandler (cpw.mods.fml.common.Mod.EventHandler)1 IngameErrorLog (eu.usrv.yamcore.auxiliary.IngameErrorLog)1 ModBlockManager (eu.usrv.yamcore.blocks.ModBlockManager)1 NotificationTickHandler (eu.usrv.yamcore.client.NotificationTickHandler)1 CreativeTabsManager (eu.usrv.yamcore.creativetabs.CreativeTabsManager)1 ModFluidManager (eu.usrv.yamcore.fluids.ModFluidManager)1 ModItemManager (eu.usrv.yamcore.items.ModItemManager)1 Random (java.util.Random)1