示例#1
0
 @Override
 public List<String> getAdditionalBrandingInformation() {
   if (optifineContainer != null) {
     return Arrays.asList(String.format("Optifine %s", optifineContainer.getVersion()));
   } else {
     return ImmutableList.<String>of();
   }
 }
示例#2
0
  /**
   * Called to start the whole game off
   *
   * @param minecraft The minecraft instance being launched
   * @param resourcePackList The resource pack list we will populate with mods
   * @param resourceManager The resource manager
   */
  public void beginMinecraftLoading(
      Minecraft minecraft, List resourcePackList, ReloadableResourceManager resourceManager) {
    client = minecraft;
    this.resourcePackList = resourcePackList;
    this.resourceManager = resourceManager;
    this.resourcePackMap = Maps.newHashMap();
    if (minecraft.func_71355_q()) {
      FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
      haltGame("FML will not run in demo mode", new RuntimeException());
      return;
    }

    //        TextureFXManager.instance().setClient(client);
    FMLCommonHandler.instance().beginLoading(this);
    new ModLoaderClientHelper(client);
    try {
      Class<?> optifineConfig =
          Class.forName("Config", false, Loader.instance().getModClassLoader());
      String optifineVersion = (String) optifineConfig.getField("VERSION").get(null);
      Map<String, Object> dummyOptifineMeta =
          ImmutableMap.<String, Object>builder()
              .put("name", "Optifine")
              .put("version", optifineVersion)
              .build();
      ModMetadata optifineMetadata =
          MetadataCollection.from(getClass().getResourceAsStream("optifinemod.info"), "optifine")
              .getMetadataForId("optifine", dummyOptifineMeta);
      optifineContainer = new DummyModContainer(optifineMetadata);
      FMLLog.info(
          "Forge Mod Loader has detected optifine %s, enabling compatibility features",
          optifineContainer.getVersion());
    } catch (Exception e) {
      optifineContainer = null;
    }
    try {
      Loader.instance().loadMods();
    } catch (WrongMinecraftVersionException wrong) {
      wrongMC = wrong;
    } catch (DuplicateModsFoundException dupes) {
      dupesFound = dupes;
    } catch (MissingModsException missing) {
      modsMissing = missing;
    } catch (ModSortingException sorting) {
      modSorting = sorting;
    } catch (CustomModLoadingErrorDisplayException custom) {
      FMLLog.log(
          Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
      customError = custom;
    } catch (LoaderException le) {
      haltGame(
          "There was a severe problem during mod loading that has caused the game to fail", le);
      return;
    }
  }