當前位置: 首頁>>代碼示例>>Java>>正文


Java EnderFileUtils類代碼示例

本文整理匯總了Java中com.enderio.core.common.util.EnderFileUtils的典型用法代碼示例。如果您正苦於以下問題:Java EnderFileUtils類的具體用法?Java EnderFileUtils怎麽用?Java EnderFileUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EnderFileUtils類屬於com.enderio.core.common.util包,在下文中一共展示了EnderFileUtils類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addCustoms

import com.enderio.core.common.util.EnderFileUtils; //導入依賴的package包/類
private static void addCustoms(ResourcePackAssembler assembler)
{
    initialize("recordMusic");
    JsonObject root = new JsonObject();
    for (File f : new File(baseDir.getAbsolutePath() + "/recordMusic").listFiles((FileFilter) FileFilterUtils.suffixFileFilter(".ogg")))
    {
        assembler.addCustomFile("assets/minecraft/sounds/records", f); // add record .ogg
        JsonObject event = new JsonObject();
        event.addProperty("category", "record"); // put under the "record" category for sound options
        JsonArray sounds = new JsonArray(); // array of sounds (will only ever be one)
        JsonObject sound = new JsonObject(); // sound object (instead of primitive to use 'stream' flag)
        sound.addProperty("name", "records/" + getSimpleName(f)); // path to file
        sound.addProperty("stream", true); // prevents lag for large files
        sounds.add(sound);
        event.add("sounds", sounds);
        root.add("records." + CustomThings.MODID + "." + getSimpleName(f), event); // event name (same as name sent to ItemCustomRecord)
    }
    assembler.addCustomFile("assets/minecraft", EnderFileUtils.writeToFile(baseDir.getAbsolutePath() + "/recordMusic/sounds.json", gson.toJson(root)));
}
 
開發者ID:tterrag1098,項目名稱:CustomThings,代碼行數:20,代碼來源:ConfigHandler.java

示例2: preInit

import com.enderio.core.common.util.EnderFileUtils; //導入依賴的package包/類
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
  if (Loader.isModLoaded("ttCore")) {
    proxy.throwModCompatibilityError(lang.localize("error.ttcore.1"), lang.localize("error.ttcore.2"), lang.localize("error.ttcore.3"));
  }

  if (event.getSide().isClient()) {
    TextureErrorRemover.beginIntercepting();
  }

  ConfigHandler.configFolder = event.getModConfigurationDirectory();
  ConfigHandler.enderConfigFolder = new File(ConfigHandler.configFolder.getPath() + "/" + MODID);
  ConfigHandler.configFile = new File(ConfigHandler.enderConfigFolder.getPath() + "/" + event.getSuggestedConfigurationFile().getName());

  if (!ConfigHandler.configFile.exists() && event.getSuggestedConfigurationFile().exists()) {
    try {
      FileUtils.copyFile(event.getSuggestedConfigurationFile(), ConfigHandler.configFile);
    } catch (IOException e) {
      Throwables.propagate(e);
    }
    EnderFileUtils.safeDelete(event.getSuggestedConfigurationFile());
  }

  ConfigHandler.instance().initialize(ConfigHandler.configFile);
  Handlers.preInit(event);

  CompatRegistry.INSTANCE.handle(event);
  OreDict.registerVanilla();

  EnchantXPBoost.INSTANCE.register();
  EnchantAutoSmelt.INSTANCE.register();
}
 
開發者ID:SleepyTrousers,項目名稱:EnderCore,代碼行數:33,代碼來源:EnderCore.java

示例3: initialize

import com.enderio.core.common.util.EnderFileUtils; //導入依賴的package包/類
private void initialize(ModToken mod, File file) {
  this.file = file;

  if (!file.exists()) {
    file.getParentFile().mkdirs();
    String assetPath = mod.getAssetPath();
    if (!assetPath.endsWith("/")) {
      assetPath = assetPath + "/";
    }

    EnderFileUtils.copyFromJar(mod.getMainClass(), assetPath + file.getName(), file);
  }

  refresh();
}
 
開發者ID:SleepyTrousers,項目名稱:EnderCore,代碼行數:16,代碼來源:JsonConfigReader.java

示例4: addIcons

import com.enderio.core.common.util.EnderFileUtils; //導入依賴的package包/類
private static void addIcons(ResourcePackAssembler assembler)
{
    initialize("icons");
    for (File f : new File(baseDir.getAbsolutePath() + "/icons").listFiles((FileFilter) FileFilterUtils.or((IOFileFilter) EnderFileUtils.pngFilter, FileFilterUtils.suffixFileFilter(".mcmeta"))))
    {
        assembler.addIcon(f);
    }
}
 
開發者ID:tterrag1098,項目名稱:CustomThings,代碼行數:9,代碼來源:ConfigHandler.java

示例5: addLangs

import com.enderio.core.common.util.EnderFileUtils; //導入依賴的package包/類
private static void addLangs(ResourcePackAssembler assembler)
{
    initialize("lang");
    for (File f : new File(baseDir.getAbsolutePath() + "/lang").listFiles(EnderFileUtils.langFilter))
    {
        assembler.addLang(f);
    }
}
 
開發者ID:tterrag1098,項目名稱:CustomThings,代碼行數:9,代碼來源:ConfigHandler.java


注:本文中的com.enderio.core.common.util.EnderFileUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。