当前位置: 首页>>代码示例>>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;未经允许,请勿转载。