コード例 #1
0
  private static void extractSkin(String fileName) {
    InputStream input = null;
    FileOutputStream output = null;
    File outputFile = new File(SkinIOUtils.getSkinLibraryDirectory(), fileName + ".armour");
    if (outputFile.exists()) {
      if (getFileSize(outputFile) > 0) {
        return;
      } else {
        ModLogger.log("Deleting corrupted skin file " + fileName);
        outputFile.delete();
      }
    }

    try {
      ModLogger.log("Extracting file " + fileName);
      input =
          SkinExtractor.class
              .getClassLoader()
              .getResourceAsStream(SKINS_ASSETS_LOCATION + fileName + ".armour");
      if (input != null) {
        output = new FileOutputStream(outputFile);
        while (input.available() > 0) {
          output.write(input.read());
        }
        output.flush();
      } else {
        ModLogger.log(Level.ERROR, "Error extracting skin " + fileName);
      }
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      IOUtils.closeQuietly(input);
      IOUtils.closeQuietly(output);
    }
  }
コード例 #2
0
  @Mod.EventHandler
  public void perInit(FMLPreInitializationEvent event) {
    ModLogger.log("Loading " + LibModInfo.NAME + " " + LibModInfo.VERSION);
    creativeTabArmorersWorkshop.setMinecraftCreativeTab(tabArmorersWorkshop);
    ConfigHandler.init(event.getSuggestedConfigurationFile());

    Addons.preInit();
    proxy.preInit();

    SkinIOUtils.makeLibraryDirectory();
    UpdateCheck.checkForUpdates();
    SkinExtractor.extractSkins();

    modItems = new ModItems();
    modBlocks = new ModBlocks();

    SkinTypeRegistry.init();
    CubeRegistry.init();
    proxy.initLibraryManager();
  }