示例#1
0
  // Initialisation Event
  @Init
  public void loadSequence(FMLInitializationEvent event) {
    try {

      MaterialRegistry.init();

      logger.info("Loading Module Aurora...");
      AuroraInit.init();

      proxy.registerCommonEventHandlers();
      proxy.registerClientEventHandlers();
      proxy.registerTileEntities();
      proxy.registerEntities();

      EnchantmentRegistry.init();

      ItemRegistry.init();
      BlockRegistry.init();
      ItemRegistry.initDepend();
      BlockRegistry.initDepend();

      LoaderEngine.registerMod(instance);

      CorruptionRegistry.init();

      OreDictionaryHelper.registerItems();
      LiquidDictionaryHelper.init();

      HandleRegistry.registerTools();

      ArmorRegistry.init();

      LiquidRegistry.init();

      EnergyNetMain.init();

      BiomeRegistry.init();

      Debug.init();

      DimensionManager.registerProviderType(
          Config.providerIDAtlantis.getValueInt(), CraftMineWorldProvider.class, true);
      DimensionManager.registerDimension(
          Config.dimensionIDAtlantis.getValueInt(), Config.providerIDAtlantis.getValueInt());

      GameRegistry.registerWorldGenerator(new WorldGenHandler());

      proxy.registerClientTicks();
      proxy.registerServerTicks();
      proxy.registerMiscTicks();

      KeyLib.beginKeyValueLocalization();

      proxy.registerKeyBindings();

      RecipeManager.init();

      proxy.registerRenderInformation();
      ItemDuplicatorRegistry.init();

      DictionaryLib.init();

      AchievementManager.init();

      TurretRegistry.init();

    } catch (Exception e) {
      CrashLogger.killWithError(e, "Fatal error during initialization");
    }
  }
示例#2
0
  // Preinitialisation Event
  @PreInit
  public void preInit(FMLPreInitializationEvent event) throws Exception {
    logger.setParent(FMLLog.getLogger());
    try {
      if (CoreLoadingPlugin.callBack()) {
        CraftMineCore.logger.info("nintendofan9797-Core callback succeeded!");
      } else {
        throw new Exception();
      }
    } catch (Exception e) {
      throw new RuntimeException("nintendofan9797-Core is not installed/corrupt! Cannot proceed!");
    }

    try {
      Validator.verify(); // Do some loading checks, for example checking
      // the jar signature.

      EnumPacketType.put(
          "KEYARMOR",
          PacketKeyArmor.class,
          "KEYARMOR",
          PacketChannelLib.CHANNEL_ARMOR_TO_SERVER,
          EnumDirection.SERVER);
      EnumPacketType.put(
          "SOUND",
          PacketSound.class,
          "SOUND",
          PacketChannelLib.CHANNEL_SV_TO_CL,
          EnumDirection.CLIENT);
      EnumPacketType.put(
          "ENDPICK",
          PacketEndPick.class,
          "ENDPICK",
          PacketChannelLib.CHANNEL_ENDPICK,
          EnumDirection.SERVER);
      EnumPacketType.put(
          "RENAME",
          PacketRename.class,
          "RENAME",
          PacketChannelLib.CHANNEL_SV_TO_CL,
          EnumDirection.CLIENT);
      EnumPacketType.put(
          "GUI", PacketGui.class, "GUI", PacketChannelLib.CHANNEL_SV_TO_CL, EnumDirection.CLIENT);
      EnumPacketType.put(
          "CAMO", PacketCamo.class, "CAMO", PacketChannelLib.CHANNEL_CAMO, EnumDirection.CLIENT);
      EnumPacketType.put(
          "KEY", PacketKey.class, "KEY", PacketChannelLib.CHANNEL_KEY, EnumDirection.SERVER);

      CoreLoadingPlugin.manager.registerMod(new PacketHandlerClient(), "CMPKC");
      CoreLoadingPlugin.manager.registerMod(new PacketHandlerServer(), "CMPKS");

      CoreLoadingPlugin.manager.getContainerForId("CMPKC").setSide(Side.CLIENT);
      CoreLoadingPlugin.manager.getContainerForId("CMPKS").setSide(Side.SERVER);

      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_ARMOR_TO_SERVER, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_CL_TO_SV, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_DATA_UPDATE, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_ENDPICK, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_INV_CHANGE, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_MAIN, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_SV_TO_CL, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_CAMO, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_KEY, "CMPKS");

      proxy.registerConfigurationCategories();

      ReferenceLib.DAY = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
      // CraftMineCore.logger.info("Day: " + ReferenceLib.DAY);
      ReferenceLib.MONTH = Calendar.getInstance().get(Calendar.MONTH);
      // CraftMineCore.logger.info("Month: " + ReferenceLib.MONTH);

      logger.info("Attempting AutoUpdate...");
      UpdateMain.doVersionCheck();

      CapeLib.init();
      proxy.registerGuis();

      logger.info("Configuring API...");
      CraftMineApi.constructionTab = tabsCraftMineConstruction;
      CraftMineApi.coreTab = tabsCraftMine;
      CraftMineApi.toolsTab = tabsCraftMineTools;

      if (event.getSide() == Side.SERVER) {
        logger.info("Initializing Server-side...");
        isServer = true;
      } else {
        logger.info("Initializing Client-side...");
      }

      proxy.registerSounds();

      MinecraftForge.EVENT_BUS.register(new AttackHandler());

      logger.info("Reading/Writing configuration values...");

      try {
        Config.init();
      } catch (Exception e) {
        CraftMineCore.logger.warning("Error while initialising configuration!");
        CraftMineCore.logger.warning("Re-writing configuration file.");
        Config.rewriteConfig();
        Config.init();
      }

    } catch (Exception e) {
      CrashLogger.killWithError(e, "Fatal error during pre-initialization");
    }
  }