Search in sources :

Example 36 with ModContainer

use of net.minecraftforge.fml.common.ModContainer in project Gaspunk by Ladysnake.

the class GasDeserializer method loadGases.

@SubscribeEvent
public static void loadGases(RegistryEvent.Register<IGas> event) {
    ModContainer gaspunkContainer = Loader.instance().activeModContainer();
    Loader.instance().getActiveModList().forEach(GasDeserializer::loadGases);
    Loader.instance().setActiveModContainer(gaspunkContainer);
    File configFolder = new File(GasPunk.lib.getConfigFolder(), GasPunk.MOD_ID + "/custom_gases");
    // if the config folder was just created or couldn't be created, no need to search it
    if (!configFolder.mkdirs() && configFolder.exists()) {
        try {
            Files.walk(configFolder.toPath()).forEach(path -> loadGases(configFolder.toPath(), path));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
Also used : ModContainer(net.minecraftforge.fml.common.ModContainer) IOException(java.io.IOException) File(java.io.File) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

ModContainer (net.minecraftforge.fml.common.ModContainer)36 File (java.io.File)4 ResourceLocation (net.minecraft.util.ResourceLocation)4 DummyModContainer (net.minecraftforge.fml.common.DummyModContainer)4 LoaderException (net.minecraftforge.fml.common.LoaderException)4 IOException (java.io.IOException)3 Nullable (javax.annotation.Nullable)3 ForgeModContainer (net.minecraftforge.common.ForgeModContainer)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 JsonObject (com.google.gson.JsonObject)2 InputStream (java.io.InputStream)2 List (java.util.List)2 Map (java.util.Map)2 BiMap (com.google.common.collect.BiMap)1 HashBiMap (com.google.common.collect.HashBiMap)1 ImmutableSetMultimap (com.google.common.collect.ImmutableSetMultimap)1 SetMultimap (com.google.common.collect.SetMultimap)1 Gson (com.google.gson.Gson)1 JsonArray (com.google.gson.JsonArray)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1