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")
|
accessTransformer = file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
|
||||||
exc = file("$rootDir/src/main/resources/forge.exc")
|
exc = file("$rootDir/src/main/resources/forge.exc")
|
||||||
srgPatches = true
|
srgPatches = true
|
||||||
clientRun {
|
runs {
|
||||||
main = 'net.minecraftforge.fml.LaunchTesting'
|
client = {
|
||||||
|
main 'net.minecraftforge.fml.LaunchTesting'
|
||||||
environment = [
|
environment = [
|
||||||
target: 'fmldevclient',
|
target: 'fmldevclient',
|
||||||
assetDirectory: downloadAssets.output,
|
assetDirectory: downloadAssets.output,
|
||||||
|
@ -179,8 +180,8 @@ project(':forge') {
|
||||||
'fmllauncher.version': SPEC_VERSION
|
'fmllauncher.version': SPEC_VERSION
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
serverRun {
|
server = {
|
||||||
main = 'net.minecraftforge.fml.LaunchTesting'
|
main 'net.minecraftforge.fml.LaunchTesting'
|
||||||
environment = [
|
environment = [
|
||||||
target: 'fmldevserver'
|
target: 'fmldevserver'
|
||||||
]
|
]
|
||||||
|
@ -193,6 +194,7 @@ project(':forge') {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
MANIFESTS = [
|
MANIFESTS = [
|
||||||
|
@ -283,9 +285,9 @@ project(':forge') {
|
||||||
}
|
}
|
||||||
//jvmArgs = ['-verbose:class']
|
//jvmArgs = ['-verbose:class']
|
||||||
classpath sourceSets.main.runtimeClasspath
|
classpath sourceSets.main.runtimeClasspath
|
||||||
main patcher.clientRun.main
|
main patcher.runs.client.main
|
||||||
systemProperties = patcher.clientRun.properties
|
systemProperties = patcher.runs.client.properties
|
||||||
environment += patcher.clientRun.environment
|
environment += patcher.runs.client.environment
|
||||||
workingDir 'runclient'
|
workingDir 'runclient'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,10 +302,10 @@ project(':forge') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
classpath sourceSets.main.runtimeClasspath
|
classpath sourceSets.main.runtimeClasspath
|
||||||
main patcher.serverRun.main
|
main patcher.runs.server.main
|
||||||
args 'nogui'
|
args 'nogui'
|
||||||
systemProperties = patcher.serverRun.properties
|
systemProperties = patcher.runs.server.properties
|
||||||
environment += patcher.serverRun.environment
|
environment += patcher.runs.server.environment
|
||||||
workingDir 'runserver'
|
workingDir 'runserver'
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
}
|
}
|
||||||
|
@ -790,6 +792,31 @@ project(':forge') {
|
||||||
artifacts.each { key, lib ->
|
artifacts.each { key, lib ->
|
||||||
addLibrary(lib.name)
|
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 {
|
license {
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||||
jcenter()
|
jcenter()
|
||||||
mavenCentral()
|
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 {
|
dependencies {
|
||||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
|
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
|
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = 'modid'
|
archivesBaseName = 'modid'
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = targetCompatibility = '1.8'
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
// the mappings can be changed at any time, and must be in the following format.
|
// the mappings can be changed at any time, and must be in the following format.
|
||||||
|
@ -42,22 +31,14 @@ minecraft {
|
||||||
|
|
||||||
// default run configurations.
|
// default run configurations.
|
||||||
// these can be tweaked, removed, or duplicated as needed.
|
// these can be tweaked, removed, or duplicated as needed.
|
||||||
runConfig {
|
runs {
|
||||||
name= "Minecraft Client"
|
client = {
|
||||||
main= "net.minecraftforge.userdev.UserdevLauncher"
|
workingDirectory project.file('run').canonicalPath
|
||||||
ideaModuleName = "${project.name}_main"
|
source sourceSets.main
|
||||||
workingDirectory = project.file("run").canonicalPath
|
}
|
||||||
environment "target", "fmldevclient"
|
server = {
|
||||||
environment "assetDirectory", downloadAssets.output.absolutePath
|
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
|
// 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.
|
// 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.
|
// 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
|
// you may put jars on which you depend on in ./libs
|
||||||
// or you may define them like so..
|
// 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.
|
// 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'
|
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||||
|
|
||||||
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
|
// These dependencies get remapped to your current MCP mappings
|
||||||
// except that these dependencies get remapped to your current MCP mappings
|
//deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||||
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
|
||||||
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
|
||||||
|
|
||||||
// for more info...
|
// for more info...
|
||||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
// 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> mcOption;
|
||||||
private ArgumentAcceptingOptionSpec<String> forgeGroupOption;
|
private ArgumentAcceptingOptionSpec<String> forgeGroupOption;
|
||||||
private ArgumentAcceptingOptionSpec<String> mcpOption;
|
private ArgumentAcceptingOptionSpec<String> mcpOption;
|
||||||
|
private ArgumentAcceptingOptionSpec<String> mappingsOption;
|
||||||
private List<String> modsArgumentList;
|
private List<String> modsArgumentList;
|
||||||
private List<String> modListsArgumentList;
|
private List<String> modListsArgumentList;
|
||||||
private List<String> mavenRootsArgumentList;
|
private List<String> mavenRootsArgumentList;
|
||||||
private String targetForgeVersion;
|
private String targetForgeVersion;
|
||||||
private String targetMcVersion;
|
private String targetMcVersion;
|
||||||
private String targetMcpVersion;
|
private String targetMcpVersion;
|
||||||
|
private String targetMcpMappings;
|
||||||
private String targetForgeGroup;
|
private String targetForgeGroup;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -74,6 +76,7 @@ public class FMLServiceProvider implements ITransformationService
|
||||||
arguments.put("forgeGroup", targetForgeGroup);
|
arguments.put("forgeGroup", targetForgeGroup);
|
||||||
arguments.put("mcVersion", targetMcVersion);
|
arguments.put("mcVersion", targetMcVersion);
|
||||||
arguments.put("mcpVersion", targetMcpVersion);
|
arguments.put("mcpVersion", targetMcpVersion);
|
||||||
|
arguments.put("mcpMappings", targetMcpMappings);
|
||||||
LOGGER.debug(CORE, "Preparing launch handler");
|
LOGGER.debug(CORE, "Preparing launch handler");
|
||||||
FMLLoader.setupLaunchHandler(environment, arguments);
|
FMLLoader.setupLaunchHandler(environment, arguments);
|
||||||
LOGGER.debug(CORE,"Initiating mod scan");
|
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");
|
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();
|
mcOption = argumentBuilder.apply("mcVersion", "Minecraft Version number").withRequiredArg().ofType(String.class).required();
|
||||||
mcpOption = argumentBuilder.apply("mcpVersion", "MCP 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(",");
|
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(",");
|
modListsOption = argumentBuilder.apply("modLists", "JSON modlists").withRequiredArg().ofType(String.class).withValuesSeparatedBy(",");
|
||||||
mavenRootsOption = argumentBuilder.apply("mavenRoots", "Maven root directories").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);
|
targetForgeGroup = option.value(forgeGroupOption);
|
||||||
targetMcVersion = option.value(mcOption);
|
targetMcVersion = option.value(mcOption);
|
||||||
targetMcpVersion = option.value(mcpOption);
|
targetMcpVersion = option.value(mcpOption);
|
||||||
|
targetMcpMappings = option.value(mappingsOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
|
|
@ -695,7 +695,7 @@ public class GameData
|
||||||
//Loader.instance().fireRemapEvent(remaps, false);
|
//Loader.instance().fireRemapEvent(remaps, false);
|
||||||
|
|
||||||
// The id map changed, ensure we apply object holders
|
// The id map changed, ensure we apply object holders
|
||||||
//ObjectHolderRegistry.INSTANCE.applyObjectHolders();
|
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
|
||||||
|
|
||||||
// Return an empty list, because we're good
|
// Return an empty list, because we're good
|
||||||
return ArrayListMultimap.create();
|
return ArrayListMultimap.create();
|
||||||
|
|
|
@ -44,7 +44,6 @@ public class ClasspathLocator implements IModLocator
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
private static final String COREMODS = "META-INF/coremods.json";
|
private static final String COREMODS = "META-INF/coremods.json";
|
||||||
private static final String MODS = "META-INF/mods.toml";
|
private static final String MODS = "META-INF/mods.toml";
|
||||||
private Map<Path, List<Path>> paths = Maps.newHashMap();
|
|
||||||
|
|
||||||
public ClasspathLocator() {}
|
public ClasspathLocator() {}
|
||||||
|
|
||||||
|
@ -75,7 +74,10 @@ public class ClasspathLocator implements IModLocator
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
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))
|
.map(path -> new ModFile(path, this))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
@ -121,6 +123,7 @@ public class ClasspathLocator implements IModLocator
|
||||||
{
|
{
|
||||||
Path classesPath = filePath;
|
Path classesPath = filePath;
|
||||||
|
|
||||||
|
/*
|
||||||
// Hack 1: When running from within intellij, we get
|
// Hack 1: When running from within intellij, we get
|
||||||
// "out/production/resources" + "out/production/classes"
|
// "out/production/resources" + "out/production/classes"
|
||||||
if(filePath.getNameCount() >= 1 && filePath.getName(filePath.getNameCount()-1).toString().equals("resources"))
|
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...
|
// We'll scan all the subdirectories for languages and sourcesets, hopefully that works...
|
||||||
classesPath = filePath.getParent().getParent().resolve("classes");
|
classesPath = filePath.getParent().getParent().resolve("classes");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return classesPath;
|
return classesPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,9 @@ public abstract class FMLUserdevLaunchProvider extends FMLCommonLaunchHandler {
|
||||||
final String forgeVersion = (String) arguments.get("forgeVersion");
|
final String forgeVersion = (String) arguments.get("forgeVersion");
|
||||||
final String mcVersion = (String) arguments.get("mcVersion");
|
final String mcVersion = (String) arguments.get("mcVersion");
|
||||||
final String mcpVersion = (String) arguments.get("mcpVersion");
|
final String mcpVersion = (String) arguments.get("mcpVersion");
|
||||||
|
final String mcpMappings = (String) arguments.get("mcpMappings");
|
||||||
final String forgeGroup = (String) arguments.get("forgeGroup");
|
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;
|
int dirs = forgeGroup.split("\\.").length + 2;
|
||||||
Path fjroot = forgeJar;
|
Path fjroot = forgeJar;
|
||||||
do {
|
do {
|
||||||
|
@ -51,7 +52,7 @@ public abstract class FMLUserdevLaunchProvider extends FMLCommonLaunchHandler {
|
||||||
final String fjpath = fjroot.toString();
|
final String fjpath = fjroot.toString();
|
||||||
LOGGER.debug(CORE, "Injecting forge as mod {} from maven path {}", userdevVersion, fjpath);
|
LOGGER.debug(CORE, "Injecting forge as mod {} from maven path {}", userdevVersion, fjpath);
|
||||||
mavenRoots.add(fjpath);
|
mavenRoots.add(fjpath);
|
||||||
mods.add(forgeGroup+":userdev:"+userdevVersion);
|
mods.add(forgeGroup+":forge:"+userdevVersion);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources("META-INF/mods.toml");
|
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 assets = System.getenv().getOrDefault("assetDirectory", "assets");
|
||||||
String target = System.getenv().get("target");
|
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) {
|
if (target == null) {
|
||||||
throw new IllegalArgumentException("Environment variable 'target' must be set to 'fmluserdevclient' or 'fmluserdevserver'.");
|
throw new IllegalArgumentException("Environment variable 'target' must be set to 'fmluserdevclient' or 'fmluserdevserver'.");
|
||||||
}
|
}
|
||||||
|
@ -65,11 +62,16 @@ public class UserdevLauncher
|
||||||
"--launchTarget", target,
|
"--launchTarget", target,
|
||||||
"--fml.forgeVersion", System.getenv("FORGE_VERSION"),
|
"--fml.forgeVersion", System.getenv("FORGE_VERSION"),
|
||||||
"--fml.mcpVersion", System.getenv("MCP_VERSION"),
|
"--fml.mcpVersion", System.getenv("MCP_VERSION"),
|
||||||
|
"--fml.mcpMappings", System.getenv("MCP_MAPPINGS"),
|
||||||
"--fml.mcVersion", System.getenv("MC_VERSION"),
|
"--fml.mcVersion", System.getenv("MC_VERSION"),
|
||||||
"--fml.forgeGroup", System.getenv("FORGE_GROUP")
|
"--fml.forgeGroup", System.getenv("FORGE_GROUP")
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Objects.equals(target,"fmluserdevclient")) {
|
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();
|
hackNatives();
|
||||||
launchArgs = ObjectArrays.concat(launchArgs, new String[] {
|
launchArgs = ObjectArrays.concat(launchArgs, new String[] {
|
||||||
"--accessToken", "blah",
|
"--accessToken", "blah",
|
||||||
|
|
Loading…
Reference in a new issue