Skip to content

Commit

Permalink
rrr
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecdcaeb committed Aug 4, 2024
1 parent ceefdcd commit ba2bf95
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/rml/loader/ResourceModLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -113,6 +114,19 @@ public static void loadModuleFindAssets(ModuleType module, ContainerHolder.Modul
}
}

public static void loadModuleFindAssets(ModuleType module, ContainerHolder.FileLootModuleConsumer consumer){
Set<ContainerHolder> 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();
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/rml/loader/api/mods/ContainerHolder.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
}

0 comments on commit ba2bf95

Please sign in to comment.