Update userdev and runconfigs for ForgeGradle changes.

This commit is contained in:
LexManos committed 2019-01-08 00:29:36 -08:00
1 parent 60926ad6ea
commit f7acc73282
7 files changed
+99 -81

No files matched your search

@@ -44,7 +44,6 @@ public class ClasspathLocator implements IModLocator
private static final Logger LOGGER = LogManager.getLogger();
private static final String COREMODS = "META-INF/coremods.json";
private static final String MODS = "META-INF/mods.toml";
private Map<Path, List<Path>> paths = Maps.newHashMap();
public ClasspathLocator() {}
@@ -75,9 +74,12 @@ public class ClasspathLocator implements IModLocator
e.printStackTrace();
}
return null;
}).filter(Objects::nonNull).distinct()
.map(path -> new ModFile(path, this))
.collect(Collectors.toList());
})
.filter(Objects::nonNull)
.distinct()
.filter(Files::isRegularFile) //We're only looking for remapped jars, exploded directories are handled by FMLUserdevLaunchProvider
.map(path -> new ModFile(path, this))
.collect(Collectors.toList());
}
@Override
@@ -121,6 +123,7 @@ public class ClasspathLocator implements IModLocator
{
Path classesPath = filePath;
/*
// Hack 1: When running from within intellij, we get
// "out/production/resources" + "out/production/classes"
if(filePath.getNameCount() >= 1 && filePath.getName(filePath.getNameCount()-1).toString().equals("resources"))
@@ -134,6 +137,7 @@ public class ClasspathLocator implements IModLocator
// We'll scan all the subdirectories for languages and sourcesets, hopefully that works...
classesPath = filePath.getParent().getParent().resolve("classes");
}
*/
return classesPath;
}
@@ -29,7 +29,7 @@ public abstract class FMLUserdevLaunchProvider extends FMLCommonLaunchHandler {
LOGGER.fatal(CORE, "Unable to locate forge on the classpath");
throw new RuntimeException("Unable to locate forge on the classpath");
}
forgeJar = LibraryFinder.findJarPathFor("ForgeVersion.class","forge", forgePath);
forgeJar = LibraryFinder.findJarPathFor("ForgeVersion.class", "forge", forgePath);
return forgeJar;
}
@@ -41,8 +41,9 @@ public abstract class FMLUserdevLaunchProvider extends FMLCommonLaunchHandler {
final String forgeVersion = (String) arguments.get("forgeVersion");
final String mcVersion = (String) arguments.get("mcVersion");
final String mcpVersion = (String) arguments.get("mcpVersion");
final String mcpMappings = (String) arguments.get("mcpMappings");
final String forgeGroup = (String) arguments.get("forgeGroup");
final String userdevVersion = mcVersion+"-"+forgeVersion+"_mapped_snapshot_"+mcpVersion;
final String userdevVersion = mcVersion + "-" + forgeVersion + "_mapped_" + mcpMappings;
int dirs = forgeGroup.split("\\.").length + 2;
Path fjroot = forgeJar;
do {
@@ -51,7 +52,7 @@ public abstract class FMLUserdevLaunchProvider extends FMLCommonLaunchHandler {
final String fjpath = fjroot.toString();
LOGGER.debug(CORE, "Injecting forge as mod {} from maven path {}", userdevVersion, fjpath);
mavenRoots.add(fjpath);
mods.add(forgeGroup+":userdev:"+userdevVersion);
mods.add(forgeGroup+":forge:"+userdevVersion);
try {
final Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources("META-INF/mods.toml");
@@ -53,9 +53,6 @@ public class UserdevLauncher
String assets = System.getenv().getOrDefault("assetDirectory", "assets");
String target = System.getenv().get("target");
if (assets == null ||!new File(assets).exists()) {
throw new IllegalArgumentException("Environment variable 'assets' must be set to a valid path.");
}
if (target == null) {
throw new IllegalArgumentException("Environment variable 'target' must be set to 'fmluserdevclient' or 'fmluserdevserver'.");
}
@@ -65,11 +62,16 @@ public class UserdevLauncher
"--launchTarget", target,
"--fml.forgeVersion", System.getenv("FORGE_VERSION"),
"--fml.mcpVersion", System.getenv("MCP_VERSION"),
"--fml.mcpMappings", System.getenv("MCP_MAPPINGS"),
"--fml.mcVersion", System.getenv("MC_VERSION"),
"--fml.forgeGroup", System.getenv("FORGE_GROUP")
};
if (Objects.equals(target,"fmluserdevclient")) {
if (assets == null || !new File(assets).exists()) {
throw new IllegalArgumentException("Environment variable 'assetDirectory' must be set to a valid path.");
}
hackNatives();
launchArgs = ObjectArrays.concat(launchArgs, new String[] {
"--accessToken", "blah",