Example #1
0
  @EventHandler
  public void postInit(FMLPostInitializationEvent event) {
    RegistrationManager.INSTANCE.registerAll(this, "PostInit");

    try {
      Class.forName("ic2.core.IC2");
      try {
        Class.forName("cn.academy.support.ic2.IC2Support").getMethod("init").invoke(this);
        ic2SupportPresent = true;
      } catch (Throwable e) {
        log.error("Failed to initialize IC2 support", e);
      }
    } catch (Throwable e) {
    }

    try {
      Class.forName("cofh.thermalexpansion.ThermalExpansion");
      try {
        Class.forName("cn.academy.support.te.TESupport").getMethod("init").invoke(this);
        teSupportPresent = true;
      } catch (Throwable e) {
        log.error("Failed to initialize TE support", e);
      }
    } catch (Throwable e) {
    }

    recipes.addRecipeFromResourceLocation(new ResourceLocation("academy:recipes/default.recipe"));

    if (DEBUG_MODE) {
      System.out.printf("|-------------------------------------------------------\n");
      System.out.printf("| AC Recipe Name Mappings\n");
      System.out.printf("|--------------------------|----------------------------\n");
      System.out.printf(String.format("| %-25s| Object Name\n", "Recipe Name"));
      System.out.printf("|--------------------------|----------------------------\n");
      for (Entry<String, Object> entry : recipes.nameMapping.entrySet()) {
        Object obj = entry.getValue();
        String str1 = entry.getKey(), str2;
        if (obj instanceof Item) {
          str2 = StatCollector.translateToLocal(((Item) obj).getUnlocalizedName() + ".name");
        } else if (obj instanceof Block) {
          str2 = StatCollector.translateToLocal(((Block) obj).getUnlocalizedName() + ".name");
        } else {
          str2 = obj.toString();
        }
        System.out.printf(String.format("| %-25s| %s\n", str1, str2));
      }
      System.out.printf("|-------------------------------------------------------\n");
    }

    recipes = null; // Doesn't need it after loading
  }
Example #2
0
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    log.info("Starting AcademyCraft");
    log.info("Copyright (c) Lambda Innovation, 2013-2015");
    log.info("http://ac.li-dev.cn/");

    config = new Configuration(event.getSuggestedConfigurationFile());

    script = new ScriptProgram();
    for (String s : scripts) {
      ResourceLocation res = new ResourceLocation("academy:scripts/" + s + ".r");
      ResourceCheck.add(res);
      script.loadScript(res);
    }

    ResourceCheck.add(new ResourceLocation("academy:recipes/default.recipe"));

    RegistrationManager.INSTANCE.registerAll(this, "PreInit");
  }
Example #3
0
 @EventHandler
 public void serverStarting(FMLServerStartingEvent event) {
   RegistrationManager.INSTANCE.registerAll(this, "StartServer");
 }
Example #4
0
 @EventHandler
 public void init(FMLInitializationEvent event) {
   RegistrationManager.INSTANCE.registerAll(this, "Init");
 }