Search in sources :

Example 1 with ResourceManager

use of net.minecraft.server.packs.resources.ResourceManager in project MinecraftForge by MinecraftForge.

the class LanguageHook method loadLanguage.

private static void loadLanguage(String langName, MinecraftServer server) {
    String langFile = String.format(Locale.ROOT, "lang/%s.json", langName);
    ResourceManager resourceManager = server.getServerResources().getResourceManager();
    resourceManager.getNamespaces().forEach(namespace -> {
        try {
            ResourceLocation langResource = new ResourceLocation(namespace, langFile);
            loadLocaleData(resourceManager.getResources(langResource));
        } catch (FileNotFoundException fnfe) {
        } catch (Exception exception) {
            LOGGER.warn("Skipped language file: {}:{}", namespace, langFile, exception);
        }
    });
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) FileNotFoundException(java.io.FileNotFoundException) ResourceManager(net.minecraft.server.packs.resources.ResourceManager) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 ResourceManager (net.minecraft.server.packs.resources.ResourceManager)1