Make MOD_CLASSES available to the forge development environment as well.

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-01-26 13:07:30 -05:00
1 parent 1d1133123b
commit 8b74b32909
3 files changed
+28 -21

No files matched your search

@@ -83,29 +83,13 @@ public abstract class FMLUserdevLaunchProvider extends FMLCommonLaunchHandler {
throw new RuntimeException("wha?", e);
}
LOGGER.fatal(CORE, "Got mod coordinates {} from env", System.getenv("MOD_CLASSES"));
// "a/b/;c/d/;" -> "modid%%c:\fish\pepper;modid%%c:\fish2\pepper2\;modid2%%c:\fishy\bums;modid2%%c:\hmm"
final Map<String, List<Path>> modClassPaths = Arrays.stream(System.getenv("MOD_CLASSES").split(File.pathSeparator)).
map(inp -> inp.split("%%", 2)).map(this::buildModPair).
collect(Collectors.groupingBy(Pair::getLeft, Collectors.mapping(Pair::getRight, Collectors.toList())));
LOGGER.info(CORE, "Found supplied mod coordinates [{}]", modClassPaths);
final List<Pair<Path, List<Path>>> explodedTargets = ((Map<String, List<Pair<Path, List<Path>>>>) arguments).computeIfAbsent("explodedTargets", a -> new ArrayList<>());
modClassPaths.forEach((modlabel,paths) -> explodedTargets.add(Pair.of(paths.get(0), paths.subList(1, paths.size()))));
processModClassesEnvironmentVariable((Map<String, List<Pair<Path, List<Path>>>>) arguments);
// generics are gross yea?
((Map)arguments).put("mavenRoots", mavenRoots);
((Map)arguments).put("mods", mods);
}
private Pair<String, Path> buildModPair(String[] splitString) {
String modid = splitString.length == 1 ? "defaultmodid" : splitString[0];
Path path = Paths.get(splitString[splitString.length - 1]);
return Pair.of(modid, path);
}
@Override
protected void validatePaths(final Path forgePath, final Path[] mcPaths, final String forgeVersion, final String mcVersion, final String mcpVersion) {