Update userdev and runconfigs for ForgeGradle changes.
This commit is contained in:
parent
60926ad6ea
commit
f7acc73282
7 changed files with 99 additions and 81 deletions
47
build.gradle
47
build.gradle
|
@ -160,8 +160,9 @@ project(':forge') {
|
|||
accessTransformer = file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
|
||||
exc = file("$rootDir/src/main/resources/forge.exc")
|
||||
srgPatches = true
|
||||
clientRun {
|
||||
main = 'net.minecraftforge.fml.LaunchTesting'
|
||||
runs {
|
||||
client = {
|
||||
main 'net.minecraftforge.fml.LaunchTesting'
|
||||
environment = [
|
||||
target: 'fmldevclient',
|
||||
assetDirectory: downloadAssets.output,
|
||||
|
@ -179,8 +180,8 @@ project(':forge') {
|
|||
'fmllauncher.version': SPEC_VERSION
|
||||
]
|
||||
}
|
||||
serverRun {
|
||||
main = 'net.minecraftforge.fml.LaunchTesting'
|
||||
server = {
|
||||
main 'net.minecraftforge.fml.LaunchTesting'
|
||||
environment = [
|
||||
target: 'fmldevserver'
|
||||
]
|
||||
|
@ -193,6 +194,7 @@ project(':forge') {
|
|||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
MANIFESTS = [
|
||||
|
@ -283,9 +285,9 @@ project(':forge') {
|
|||
}
|
||||
//jvmArgs = ['-verbose:class']
|
||||
classpath sourceSets.main.runtimeClasspath
|
||||
main patcher.clientRun.main
|
||||
systemProperties = patcher.clientRun.properties
|
||||
environment += patcher.clientRun.environment
|
||||
main patcher.runs.client.main
|
||||
systemProperties = patcher.runs.client.properties
|
||||
environment += patcher.runs.client.environment
|
||||
workingDir 'runclient'
|
||||
}
|
||||
|
||||
|
@ -300,10 +302,10 @@ project(':forge') {
|
|||
}
|
||||
}
|
||||
classpath sourceSets.main.runtimeClasspath
|
||||
main patcher.serverRun.main
|
||||
main patcher.runs.server.main
|
||||
args 'nogui'
|
||||
systemProperties = patcher.serverRun.properties
|
||||
environment += patcher.serverRun.environment
|
||||
systemProperties = patcher.runs.server.properties
|
||||
environment += patcher.runs.server.environment
|
||||
workingDir 'runserver'
|
||||
standardInput = System.in
|
||||
}
|
||||
|
@ -790,6 +792,31 @@ project(':forge') {
|
|||
artifacts.each { key, lib ->
|
||||
addLibrary(lib.name)
|
||||
}
|
||||
addLibrary("${project.group}:${project.name}:${project.version}:launcher")
|
||||
runs {
|
||||
client = {
|
||||
main 'net.minecraftforge.userdev.UserdevLauncher'
|
||||
environment 'target', 'fmluserdevclient'
|
||||
environment 'assetDirectory', '{assets_root}'
|
||||
environment 'nativesDirectory', '{natives}'
|
||||
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1)
|
||||
environment 'FORGE_GROUP', project.group
|
||||
environment 'MCP_VERSION', MCP_VERSION
|
||||
environment 'MC_VERSION', MC_VERSION
|
||||
environment 'MOD_CLASSES', '{source_roots}'
|
||||
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
||||
}
|
||||
server = {
|
||||
main 'net.minecraftforge.userdev.UserdevLauncher'
|
||||
environment 'target', 'fmldevserver'
|
||||
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1)
|
||||
environment 'FORGE_GROUP', project.group
|
||||
environment 'MCP_VERSION', MCP_VERSION
|
||||
environment 'MC_VERSION', MC_VERSION
|
||||
environment 'MOD_CLASSES', '{source_roots}'
|
||||
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
license {
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
// This is only here while i'm activly developing FG, Remind me to remove when we publically release
|
||||
configurations {
|
||||
classpath.resolutionStrategy {
|
||||
cacheDynamicVersionsFor 10, 'seconds'
|
||||
cacheChangingModulesFor 0, 'seconds'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
|
||||
}
|
||||
|
@ -24,10 +16,7 @@ version = '1.0'
|
|||
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'modid'
|
||||
|
||||
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
}
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
|
||||
minecraft {
|
||||
// the mappings can be changed at any time, and must be in the following format.
|
||||
|
@ -42,22 +31,14 @@ minecraft {
|
|||
|
||||
// default run configurations.
|
||||
// these can be tweaked, removed, or duplicated as needed.
|
||||
runConfig {
|
||||
name= "Minecraft Client"
|
||||
main= "net.minecraftforge.userdev.UserdevLauncher"
|
||||
ideaModuleName = "${project.name}_main"
|
||||
workingDirectory = project.file("run").canonicalPath
|
||||
environment "target", "fmldevclient"
|
||||
environment "assetDirectory", downloadAssets.output.absolutePath
|
||||
runs {
|
||||
client = {
|
||||
workingDirectory project.file('run').canonicalPath
|
||||
source sourceSets.main
|
||||
}
|
||||
server = {
|
||||
workingDirectory project.file('run').canonicalPath
|
||||
}
|
||||
|
||||
runConfig {
|
||||
name= "Minecraft Server"
|
||||
main= "net.minecraftforge.userdev.UserdevLauncher"
|
||||
ideaModuleName = "${project.name}_main"
|
||||
workingDirectory = project.file("run").canonicalPath
|
||||
environment "target", "fmldevserver"
|
||||
environment "assetDirectory", downloadAssets.output.absolutePath
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +46,7 @@ dependencies {
|
|||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft '@FORGE_GROUP@:userdev:@FORGE_VERSION@'
|
||||
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
|
||||
|
||||
// you may put jars on which you depend on in ./libs
|
||||
// or you may define them like so..
|
||||
|
@ -79,10 +60,8 @@ dependencies {
|
|||
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
|
||||
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
|
||||
// except that these dependencies get remapped to your current MCP mappings
|
||||
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
// These dependencies get remapped to your current MCP mappings
|
||||
//deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// for more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
|
|
|
@ -45,12 +45,14 @@ public class FMLServiceProvider implements ITransformationService
|
|||
private ArgumentAcceptingOptionSpec<String> mcOption;
|
||||
private ArgumentAcceptingOptionSpec<String> forgeGroupOption;
|
||||
private ArgumentAcceptingOptionSpec<String> mcpOption;
|
||||
private ArgumentAcceptingOptionSpec<String> mappingsOption;
|
||||
private List<String> modsArgumentList;
|
||||
private List<String> modListsArgumentList;
|
||||
private List<String> mavenRootsArgumentList;
|
||||
private String targetForgeVersion;
|
||||
private String targetMcVersion;
|
||||
private String targetMcpVersion;
|
||||
private String targetMcpMappings;
|
||||
private String targetForgeGroup;
|
||||
|
||||
@Override
|
||||
|
@ -74,6 +76,7 @@ public class FMLServiceProvider implements ITransformationService
|
|||
arguments.put("forgeGroup", targetForgeGroup);
|
||||
arguments.put("mcVersion", targetMcVersion);
|
||||
arguments.put("mcpVersion", targetMcpVersion);
|
||||
arguments.put("mcpMappings", targetMcpMappings);
|
||||
LOGGER.debug(CORE, "Preparing launch handler");
|
||||
FMLLoader.setupLaunchHandler(environment, arguments);
|
||||
LOGGER.debug(CORE,"Initiating mod scan");
|
||||
|
@ -95,6 +98,7 @@ public class FMLServiceProvider implements ITransformationService
|
|||
forgeGroupOption = argumentBuilder.apply("forgeGroup", "Forge Group (for testing)").withRequiredArg().ofType(String.class).defaultsTo("net.minecraftforge");
|
||||
mcOption = argumentBuilder.apply("mcVersion", "Minecraft Version number").withRequiredArg().ofType(String.class).required();
|
||||
mcpOption = argumentBuilder.apply("mcpVersion", "MCP Version number").withRequiredArg().ofType(String.class).required();
|
||||
mappingsOption = argumentBuilder.apply("mcpMappings", "MCP Mappings Channel and Version").withRequiredArg().ofType(String.class);
|
||||
modsOption = argumentBuilder.apply("mods", "List of mods to add").withRequiredArg().ofType(String.class).withValuesSeparatedBy(",");
|
||||
modListsOption = argumentBuilder.apply("modLists", "JSON modlists").withRequiredArg().ofType(String.class).withValuesSeparatedBy(",");
|
||||
mavenRootsOption = argumentBuilder.apply("mavenRoots", "Maven root directories").withRequiredArg().ofType(String.class).withValuesSeparatedBy(",");
|
||||
|
@ -110,6 +114,7 @@ public class FMLServiceProvider implements ITransformationService
|
|||
targetForgeGroup = option.value(forgeGroupOption);
|
||||
targetMcVersion = option.value(mcOption);
|
||||
targetMcpVersion = option.value(mcpOption);
|
||||
targetMcpMappings = option.value(mappingsOption);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -695,7 +695,7 @@ public class GameData
|
|||
//Loader.instance().fireRemapEvent(remaps, false);
|
||||
|
||||
// The id map changed, ensure we apply object holders
|
||||
//ObjectHolderRegistry.INSTANCE.applyObjectHolders();
|
||||
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
|
||||
|
||||
// Return an empty list, because we're good
|
||||
return ArrayListMultimap.create();
|
||||
|
|
|
@ -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,7 +74,10 @@ public class ClasspathLocator implements IModLocator
|
|||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}).filter(Objects::nonNull).distinct()
|
||||
})
|
||||
.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());
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue