diff --git a/src/main/java/rml/loader/ResourceModLoader.java b/src/main/java/rml/loader/ResourceModLoader.java index 7a61dcb..2212ca4 100644 --- a/src/main/java/rml/loader/ResourceModLoader.java +++ b/src/main/java/rml/loader/ResourceModLoader.java @@ -14,6 +14,7 @@ import rml.loader.core.RMLFMLLoadingPlugin; import javax.annotation.Nullable; +import java.nio.file.Path; import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; @@ -113,6 +114,19 @@ public static void loadModuleFindAssets(ModuleType module, ContainerHolder.Modul } } + public static void loadModuleFindAssets(ModuleType module, ContainerHolder.FileLootModuleConsumer consumer){ + Set containerHolders = RMLModuleLoadingEvent.post(getCurrentRMLContainerHolders(module), module); + for(ContainerHolder containerHolder : containerHolders){ + ModContainer oldActive = Loader.instance().activeModContainer(); + Loader.instance().setActiveModContainer(containerHolder.container); + final Module module_ = containerHolder.modules.get(module); + FileHelper.findAssets(containerHolder, module_, (containerHolder1, root, file) -> { + consumer.accept(containerHolder1, module_, root, file); + }); + Loader.instance().setActiveModContainer(oldActive); + } + } + @Nullable public static ContainerHolder of(ModContainer modContainer){ updateRMLContainerState(); diff --git a/src/main/java/rml/loader/api/mods/ContainerHolder.java b/src/main/java/rml/loader/api/mods/ContainerHolder.java index 39c0207..0bad5cc 100644 --- a/src/main/java/rml/loader/api/mods/ContainerHolder.java +++ b/src/main/java/rml/loader/api/mods/ContainerHolder.java @@ -1,12 +1,14 @@ package rml.loader.api.mods; import net.minecraftforge.fml.common.FMLContainerHolder; +import net.minecraftforge.fml.common.Mod; import rml.jrx.announces.PublicAPI; import rml.loader.ResourceModLoader; import rml.loader.api.mods.module.Module; import rml.loader.api.mods.module.ModuleType; import net.minecraftforge.fml.common.ModContainer; +import java.nio.file.Path; import java.util.HashMap; @PublicAPI @@ -52,4 +54,9 @@ public ModContainer getFMLContainer() { public interface ModuleConsumer{ void accept(ModuleType module, ContainerHolder containerHolder); } + + @FunctionalInterface + public interface FileLootModuleConsumer{ + void accept(ContainerHolder containerHolder, Module module, Path root, Path file); + } }