Split mappings and minecraft
parent
8e3822dec7
commit
94c7137086
|
@ -27,6 +27,7 @@ package net.fabricmc.loom;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import net.fabricmc.loom.providers.MinecraftProvider;
|
import net.fabricmc.loom.providers.MinecraftProvider;
|
||||||
import net.fabricmc.loom.providers.ModRemapperProvider;
|
import net.fabricmc.loom.providers.ModRemapperProvider;
|
||||||
|
import net.fabricmc.loom.providers.PomfProvider;
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
import net.fabricmc.loom.util.LoomDependencyManager;
|
import net.fabricmc.loom.util.LoomDependencyManager;
|
||||||
import net.fabricmc.loom.util.ModRemapper;
|
import net.fabricmc.loom.util.ModRemapper;
|
||||||
|
@ -74,6 +75,8 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
Configuration minecraftConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT);
|
Configuration minecraftConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT);
|
||||||
minecraftConfig.setTransitive(false); // The launchers do not recurse dependencies
|
minecraftConfig.setTransitive(false); // The launchers do not recurse dependencies
|
||||||
|
|
||||||
|
project.getConfigurations().maybeCreate(Constants.MAPPINGS);
|
||||||
|
|
||||||
configureIDEs();
|
configureIDEs();
|
||||||
configureCompile();
|
configureCompile();
|
||||||
|
|
||||||
|
@ -88,8 +91,8 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
javaCompileTask.doFirst(task1 -> {
|
javaCompileTask.doFirst(task1 -> {
|
||||||
project.getLogger().lifecycle(":setting java compiler args");
|
project.getLogger().lifecycle(":setting java compiler args");
|
||||||
try {
|
try {
|
||||||
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFileNamedIntermediary=" + extension.getMinecraftProvider().pomfProvider.MAPPINGS_TINY.getCanonicalPath());
|
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFileNamedIntermediary=" + extension.getPomfProvider().MAPPINGS_TINY.getCanonicalPath());
|
||||||
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFileNamedIntermediary=" + extension.getMinecraftProvider().pomfProvider.MAPPINGS_MIXIN_EXPORT.getCanonicalPath());
|
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFileNamedIntermediary=" + extension.getPomfProvider().MAPPINGS_MIXIN_EXPORT.getCanonicalPath());
|
||||||
if(extension.refmapName == null || extension.refmapName.isEmpty()){
|
if(extension.refmapName == null || extension.refmapName.isEmpty()){
|
||||||
project.getLogger().error("Could not find refmap definition, will be using default name: " + project.getName() + "-refmap.json");
|
project.getLogger().error("Could not find refmap definition, will be using default name: " + project.getName() + "-refmap.json");
|
||||||
extension.refmapName = project.getName() + "-refmap.json";
|
extension.refmapName = project.getName() + "-refmap.json";
|
||||||
|
@ -207,6 +210,7 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
LoomDependencyManager dependencyManager = new LoomDependencyManager();
|
LoomDependencyManager dependencyManager = new LoomDependencyManager();
|
||||||
extension.setDependencyManager(dependencyManager);
|
extension.setDependencyManager(dependencyManager);
|
||||||
|
|
||||||
|
dependencyManager.addProvider(new PomfProvider());
|
||||||
dependencyManager.addProvider(new MinecraftProvider());
|
dependencyManager.addProvider(new MinecraftProvider());
|
||||||
dependencyManager.addProvider(new ModRemapperProvider());
|
dependencyManager.addProvider(new ModRemapperProvider());
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package net.fabricmc.loom;
|
package net.fabricmc.loom;
|
||||||
|
|
||||||
import net.fabricmc.loom.providers.MinecraftProvider;
|
import net.fabricmc.loom.providers.MinecraftProvider;
|
||||||
|
import net.fabricmc.loom.providers.PomfProvider;
|
||||||
import net.fabricmc.loom.util.LoomDependencyManager;
|
import net.fabricmc.loom.util.LoomDependencyManager;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
||||||
|
@ -58,6 +59,10 @@ public class LoomGradleExtension {
|
||||||
return getDependencyManager().getProvider(MinecraftProvider.class);
|
return getDependencyManager().getProvider(MinecraftProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PomfProvider getPomfProvider(){
|
||||||
|
return getDependencyManager().getProvider(PomfProvider.class);
|
||||||
|
}
|
||||||
|
|
||||||
public void setDependencyManager(LoomDependencyManager dependencyManager) {
|
public void setDependencyManager(LoomDependencyManager dependencyManager) {
|
||||||
this.dependencyManager = dependencyManager;
|
this.dependencyManager = dependencyManager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,16 +88,13 @@ public class MinecraftJarProvider {
|
||||||
|
|
||||||
private void initFiles(Project project, MinecraftProvider minecraftProvider) {
|
private void initFiles(Project project, MinecraftProvider minecraftProvider) {
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
|
PomfProvider pomfProvider = extension.getPomfProvider();
|
||||||
MINECRAFT_INTERMEDIARY_JAR = new File(extension.getUserCache(), minecraftProvider.minecraftVersion + "-intermediary.jar");
|
MINECRAFT_INTERMEDIARY_JAR = new File(extension.getUserCache(), minecraftProvider.minecraftVersion + "-intermediary.jar");
|
||||||
MINECRAFT_MERGED_JAR = new File(extension.getUserCache(), minecraftProvider.minecraftVersion + "-merged.jar");
|
MINECRAFT_MERGED_JAR = new File(extension.getUserCache(), minecraftProvider.minecraftVersion + "-merged.jar");
|
||||||
MINECRAFT_MAPPED_JAR = new File(extension.getUserCache(), minecraftProvider.minecraftVersion + "-mapped-" + minecraftProvider.pomfVersion + ".jar");
|
MINECRAFT_MAPPED_JAR = new File(extension.getUserCache(), minecraftProvider.minecraftVersion + "-mapped-" + pomfProvider.pomfVersion + ".jar");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getMappingFile() {
|
|
||||||
return minecraftProvider.pomfProvider.MAPPINGS_TINY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<File> getMapperPaths() {
|
public Collection<File> getMapperPaths() {
|
||||||
return minecraftProvider.libraryProvider.getLibraries();
|
return minecraftProvider.libraryProvider.getLibraries();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,7 @@ import java.util.Optional;
|
||||||
public class MinecraftProvider extends DependencyProvider {
|
public class MinecraftProvider extends DependencyProvider {
|
||||||
|
|
||||||
public String minecraftVersion;
|
public String minecraftVersion;
|
||||||
public String pomfVersion;
|
|
||||||
|
|
||||||
public PomfProvider pomfProvider;
|
|
||||||
public MinecraftVersionInfo versionInfo;
|
public MinecraftVersionInfo versionInfo;
|
||||||
public MinecraftLibraryProvider libraryProvider;
|
public MinecraftLibraryProvider libraryProvider;
|
||||||
public MinecraftJarProvider jarProvider;
|
public MinecraftJarProvider jarProvider;
|
||||||
|
@ -58,8 +56,7 @@ public class MinecraftProvider extends DependencyProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception {
|
public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception {
|
||||||
minecraftVersion = dependency.getDependency().getName();
|
minecraftVersion = dependency.getDependency().getVersion();
|
||||||
pomfVersion = dependency.getDependency().getVersion();
|
|
||||||
|
|
||||||
initFiles(project);
|
initFiles(project);
|
||||||
|
|
||||||
|
@ -74,8 +71,6 @@ public class MinecraftProvider extends DependencyProvider {
|
||||||
libraryProvider = new MinecraftLibraryProvider();
|
libraryProvider = new MinecraftLibraryProvider();
|
||||||
libraryProvider.provide(this, project);
|
libraryProvider.provide(this, project);
|
||||||
|
|
||||||
pomfProvider = new PomfProvider(pomfVersion, minecraftVersion, project);
|
|
||||||
|
|
||||||
jarProvider = new MinecraftJarProvider(project, this);
|
jarProvider = new MinecraftJarProvider(project, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +91,7 @@ public class MinecraftProvider extends DependencyProvider {
|
||||||
if (optionalVersion.isPresent()) {
|
if (optionalVersion.isPresent()) {
|
||||||
FileUtils.copyURLToFile(new URL(optionalVersion.get().url), MINECRAFT_JSON);
|
FileUtils.copyURLToFile(new URL(optionalVersion.get().url), MINECRAFT_JSON);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Failed to download minecraft json");
|
throw new RuntimeException("Failed to find minecraft version: " + minecraftVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,20 @@ public class ModRemapperProvider extends DependencyProvider {
|
||||||
|
|
||||||
project.getLogger().lifecycle("Providing " + dependency.getDepString());
|
project.getLogger().lifecycle("Providing " + dependency.getDepString());
|
||||||
|
|
||||||
MinecraftProvider minecraftProvider = getDependencyManager().getProvider(MinecraftProvider.class);
|
PomfProvider pomfProvider = getDependencyManager().getProvider(PomfProvider.class);
|
||||||
|
|
||||||
String outputName = input.getName().substring(0, input.getName().length() - 4) + "-mapped-" + minecraftProvider.pomfVersion + ".jar";//TODO use the hash of the input file or something?
|
String outputName = input.getName().substring(0, input.getName().length() - 4) + "-mapped-" + pomfProvider.pomfVersion + ".jar";//TODO use the hash of the input file or something?
|
||||||
File output = new File(Constants.REMAPPED_MODS_STORE, outputName);
|
File output = new File(Constants.REMAPPED_MODS_STORE, outputName);
|
||||||
|
if(output.exists()){
|
||||||
|
output.delete();
|
||||||
|
}
|
||||||
|
|
||||||
ModProcessor.handleMod(input, output, project);
|
ModProcessor.handleMod(input, output, project);
|
||||||
|
|
||||||
|
if(!output.exists()){
|
||||||
|
throw new RuntimeException("Failed to remap mod");
|
||||||
|
}
|
||||||
|
|
||||||
addDependency(output, project);
|
addDependency(output, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,63 +26,52 @@ package net.fabricmc.loom.providers;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
import org.apache.commons.io.FileUtils;
|
import net.fabricmc.loom.util.DependencyProvider;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.nio.file.FileSystem;
|
||||||
import java.io.FileOutputStream;
|
import java.nio.file.FileSystems;
|
||||||
import java.io.IOException;
|
import java.nio.file.Files;
|
||||||
import java.net.URL;
|
import java.nio.file.Path;
|
||||||
import java.util.zip.GZIPInputStream;
|
|
||||||
|
|
||||||
//TODO fix local mappings
|
//TODO fix local mappings
|
||||||
//TODO possibly use maven for mappings, can fix above at the same time
|
//TODO possibly use maven for mappings, can fix above at the same time
|
||||||
public class PomfProvider {
|
public class PomfProvider extends DependencyProvider {
|
||||||
|
|
||||||
public String minecraftVersion;
|
public String minecraftVersion;
|
||||||
public String pomfVersion;
|
public String pomfVersion;
|
||||||
|
|
||||||
public File POMF_DIR;
|
private File POMF_DIR;
|
||||||
public File MAPPINGS_TINY_GZ;
|
|
||||||
public File MAPPINGS_TINY;
|
public File MAPPINGS_TINY;
|
||||||
|
|
||||||
public File MAPPINGS_MIXIN_EXPORT;
|
public File MAPPINGS_MIXIN_EXPORT;
|
||||||
|
|
||||||
public PomfProvider(String pomfVersion, String minecraftVersion, Project project) {
|
@Override
|
||||||
this.pomfVersion = pomfVersion;
|
public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception {
|
||||||
this.minecraftVersion = minecraftVersion;
|
project.getLogger().lifecycle(":setting up pomf " + dependency.getDependency().getVersion());
|
||||||
initFiles(project);
|
|
||||||
try {
|
|
||||||
init(project);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to setup pomf", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Project project) throws IOException {
|
String version = dependency.getDependency().getVersion();
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
String[] split = version.split("\\.");
|
||||||
project.getLogger().lifecycle(":setting up pomf " + pomfVersion);
|
|
||||||
|
File mappingsJar = dependency.resolveFile();
|
||||||
|
|
||||||
|
this.pomfVersion = split[0];
|
||||||
|
this.minecraftVersion = split[1];
|
||||||
|
|
||||||
|
initFiles(project);
|
||||||
|
|
||||||
if (!POMF_DIR.exists()) {
|
if (!POMF_DIR.exists()) {
|
||||||
POMF_DIR.mkdir();
|
POMF_DIR.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MAPPINGS_TINY_GZ.exists()) {
|
|
||||||
FileUtils.copyURLToFile(
|
|
||||||
new URL(String.format("%1$s%2$s.%3$s/pomf-%2$s.%3$s-tiny.gz", Constants.POMF_MAVEN_SERVER, minecraftVersion, pomfVersion)),
|
|
||||||
MAPPINGS_TINY_GZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!MAPPINGS_TINY.exists()) {
|
if (!MAPPINGS_TINY.exists()) {
|
||||||
GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(MAPPINGS_TINY_GZ));
|
project.getLogger().lifecycle(":extracting " + mappingsJar.getName());
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(MAPPINGS_TINY);
|
try (FileSystem fileSystem = FileSystems.newFileSystem(mappingsJar.toPath(), null)) {
|
||||||
int length;
|
Path fileToExtract = fileSystem.getPath("mappings/mappings.tiny");
|
||||||
byte[] buffer = new byte[4096];
|
Files.copy(fileToExtract, MAPPINGS_TINY.toPath());
|
||||||
while ((length = gzipInputStream.read(buffer)) > 0) {
|
|
||||||
fileOutputStream.write(buffer, 0, length);
|
|
||||||
}
|
}
|
||||||
gzipInputStream.close();
|
|
||||||
fileOutputStream.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +79,12 @@ public class PomfProvider {
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
POMF_DIR = new File(extension.getUserCache(), "pomf");
|
POMF_DIR = new File(extension.getUserCache(), "pomf");
|
||||||
|
|
||||||
MAPPINGS_TINY_GZ = new File(POMF_DIR, "pomf-tiny-" + minecraftVersion + "." + pomfVersion + ".gz");
|
|
||||||
MAPPINGS_TINY = new File(POMF_DIR, "pomf-tiny-" + minecraftVersion + "." + pomfVersion);
|
MAPPINGS_TINY = new File(POMF_DIR, "pomf-tiny-" + minecraftVersion + "." + pomfVersion);
|
||||||
MAPPINGS_MIXIN_EXPORT = new File(Constants.CACHE_FILES, "mixin-map-" + minecraftVersion + "." + pomfVersion + ".tiny");
|
MAPPINGS_MIXIN_EXPORT = new File(Constants.CACHE_FILES, "mixin-map-" + minecraftVersion + "." + pomfVersion + ".tiny");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTargetConfig() {
|
||||||
|
return Constants.MAPPINGS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package net.fabricmc.loom.task;
|
package net.fabricmc.loom.task;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
|
import net.fabricmc.loom.providers.PomfProvider;
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
import net.fabricmc.loom.util.MinecraftVersionInfo;
|
import net.fabricmc.loom.util.MinecraftVersionInfo;
|
||||||
import org.gradle.api.tasks.JavaExec;
|
import org.gradle.api.tasks.JavaExec;
|
||||||
|
@ -39,6 +40,7 @@ public class RunClientTask extends JavaExec {
|
||||||
public void exec() {
|
public void exec() {
|
||||||
LoomGradleExtension extension = this.getProject().getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = this.getProject().getExtensions().getByType(LoomGradleExtension.class);
|
||||||
MinecraftVersionInfo minecraftVersionInfo = extension.getMinecraftProvider().versionInfo;
|
MinecraftVersionInfo minecraftVersionInfo = extension.getMinecraftProvider().versionInfo;
|
||||||
|
PomfProvider pomfProvider = extension.getPomfProvider();
|
||||||
|
|
||||||
|
|
||||||
List<String> libs = new ArrayList<>();
|
List<String> libs = new ArrayList<>();
|
||||||
|
@ -53,7 +55,7 @@ public class RunClientTask extends JavaExec {
|
||||||
}
|
}
|
||||||
|
|
||||||
classpath(libs);
|
classpath(libs);
|
||||||
args("--tweakClass", Constants.FABRIC_CLIENT_TWEAKER, "--assetIndex", minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion), "--assetsDir", new File(extension.getUserCache(), "assets").getAbsolutePath(), "--fabricMappingFile", extension.getMinecraftProvider().pomfProvider.MAPPINGS_TINY.getAbsolutePath());
|
args("--tweakClass", Constants.FABRIC_CLIENT_TWEAKER, "--assetIndex", minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion), "--assetsDir", new File(extension.getUserCache(), "assets").getAbsolutePath(), "--fabricMappingFile", pomfProvider.MAPPINGS_TINY.getAbsolutePath());
|
||||||
|
|
||||||
setWorkingDir(new File(getProject().getRootDir(), "run"));
|
setWorkingDir(new File(getProject().getRootDir(), "run"));
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class RunServerTask extends JavaExec {
|
||||||
}
|
}
|
||||||
classpath(libs);
|
classpath(libs);
|
||||||
|
|
||||||
args("--tweakClass", Constants.FABRIC_SERVER_TWEAKER, "--fabricMappingFile", extension.getMinecraftProvider().pomfProvider.MAPPINGS_TINY.getAbsolutePath());
|
args("--tweakClass", Constants.FABRIC_SERVER_TWEAKER, "--fabricMappingFile", extension.getPomfProvider().MAPPINGS_TINY.getAbsolutePath());
|
||||||
|
|
||||||
setWorkingDir(new File(getProject().getRootDir(), "run"));
|
setWorkingDir(new File(getProject().getRootDir(), "run"));
|
||||||
|
|
||||||
|
|
|
@ -44,4 +44,5 @@ public class Constants {
|
||||||
|
|
||||||
public static final String COMPILE_MODS = "modCompile";
|
public static final String COMPILE_MODS = "modCompile";
|
||||||
public static final String MINECRAFT = "minecraft";
|
public static final String MINECRAFT = "minecraft";
|
||||||
|
public static final String MAPPINGS = "mappings";
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.providers.MinecraftProvider;
|
import net.fabricmc.loom.providers.MinecraftProvider;
|
||||||
|
import net.fabricmc.loom.providers.PomfProvider;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -84,7 +85,8 @@ public class IdeaRunConfig {
|
||||||
|
|
||||||
public static IdeaRunConfig clientRunConfig(Project project){
|
public static IdeaRunConfig clientRunConfig(Project project){
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
MinecraftProvider minecraftProvider = extension.getDependencyManager().getProvider(MinecraftProvider.class);
|
MinecraftProvider minecraftProvider = extension.getMinecraftProvider();
|
||||||
|
PomfProvider pomfProvider = extension.getPomfProvider();
|
||||||
MinecraftVersionInfo minecraftVersionInfo = minecraftProvider.versionInfo;
|
MinecraftVersionInfo minecraftVersionInfo = minecraftProvider.versionInfo;
|
||||||
|
|
||||||
IdeaRunConfig ideaClient = new IdeaRunConfig();
|
IdeaRunConfig ideaClient = new IdeaRunConfig();
|
||||||
|
@ -93,15 +95,14 @@ public class IdeaRunConfig {
|
||||||
ideaClient.configName = "Minecraft Client";
|
ideaClient.configName = "Minecraft Client";
|
||||||
ideaClient.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
|
ideaClient.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
|
||||||
ideaClient.vmArgs = "-Dfabric.development=true";
|
ideaClient.vmArgs = "-Dfabric.development=true";
|
||||||
ideaClient.programArgs = "--tweakClass " + Constants.FABRIC_CLIENT_TWEAKER + " --assetIndex " + minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion) + " --assetsDir \"" + new File(extension.getUserCache(), "assets").getAbsolutePath() + "\" --fabricMappingFile \"" + minecraftProvider.pomfProvider.MAPPINGS_TINY.getAbsolutePath() + "\"";
|
ideaClient.programArgs = "--tweakClass " + Constants.FABRIC_CLIENT_TWEAKER + " --assetIndex " + minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion) + " --assetsDir \"" + new File(extension.getUserCache(), "assets").getAbsolutePath() + "\" --fabricMappingFile \"" + pomfProvider.MAPPINGS_TINY.getAbsolutePath() + "\"";
|
||||||
|
|
||||||
return ideaClient;
|
return ideaClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IdeaRunConfig serverRunConfig(Project project){
|
public static IdeaRunConfig serverRunConfig(Project project){
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
MinecraftProvider minecraftProvider = extension.getDependencyManager().getProvider(MinecraftProvider.class);
|
PomfProvider pomfProvider = extension.getPomfProvider();
|
||||||
MinecraftVersionInfo minecraftVersionInfo = minecraftProvider.versionInfo;
|
|
||||||
|
|
||||||
IdeaRunConfig ideaServer = new IdeaRunConfig();
|
IdeaRunConfig ideaServer = new IdeaRunConfig();
|
||||||
ideaServer.mainClass = "net.minecraft.launchwrapper.Launch";
|
ideaServer.mainClass = "net.minecraft.launchwrapper.Launch";
|
||||||
|
@ -109,7 +110,7 @@ public class IdeaRunConfig {
|
||||||
ideaServer.configName = "Minecraft Server";
|
ideaServer.configName = "Minecraft Server";
|
||||||
ideaServer.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
|
ideaServer.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
|
||||||
ideaServer.vmArgs = "-Dfabric.development=true";
|
ideaServer.vmArgs = "-Dfabric.development=true";
|
||||||
ideaServer.programArgs = "--tweakClass " + Constants.FABRIC_SERVER_TWEAKER + " --fabricMappingFile \"" + minecraftProvider.pomfProvider.MAPPINGS_TINY.getAbsolutePath() + "\"";
|
ideaServer.programArgs = "--tweakClass " + Constants.FABRIC_SERVER_TWEAKER + " --fabricMappingFile \"" + pomfProvider.MAPPINGS_TINY.getAbsolutePath() + "\"";
|
||||||
|
|
||||||
return ideaServer;
|
return ideaServer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,7 @@ import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
import org.gradle.api.artifacts.Configuration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class LoomDependencyManager {
|
public class LoomDependencyManager {
|
||||||
|
|
||||||
|
@ -60,7 +58,7 @@ public class LoomDependencyManager {
|
||||||
public void handleDependencies(Project project){
|
public void handleDependencies(Project project){
|
||||||
project.getLogger().lifecycle(":setting up loom dependencies");
|
project.getLogger().lifecycle(":setting up loom dependencies");
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
Set<String> targetConfigs = new HashSet<>();
|
List<String> targetConfigs = new ArrayList<>();
|
||||||
for(DependencyProvider provider : dependencyProviderList){
|
for(DependencyProvider provider : dependencyProviderList){
|
||||||
targetConfigs.add(provider.getTargetConfig());
|
targetConfigs.add(provider.getTargetConfig());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
package net.fabricmc.loom.util;
|
package net.fabricmc.loom.util;
|
||||||
|
|
||||||
|
|
||||||
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.providers.MinecraftJarProvider;
|
import net.fabricmc.loom.providers.MinecraftJarProvider;
|
||||||
|
import net.fabricmc.loom.providers.PomfProvider;
|
||||||
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
||||||
import net.fabricmc.tinyremapper.TinyRemapper;
|
import net.fabricmc.tinyremapper.TinyRemapper;
|
||||||
import net.fabricmc.tinyremapper.TinyUtils;
|
import net.fabricmc.tinyremapper.TinyUtils;
|
||||||
|
@ -41,7 +43,10 @@ public class MapJarsTiny {
|
||||||
public void mapJars(MinecraftJarProvider jarProvider, Project project) throws IOException {
|
public void mapJars(MinecraftJarProvider jarProvider, Project project) throws IOException {
|
||||||
String fromM = "official";
|
String fromM = "official";
|
||||||
|
|
||||||
Path mappings = jarProvider.getMappingFile().toPath();
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
|
PomfProvider pomfProvider = extension.getPomfProvider();
|
||||||
|
|
||||||
|
Path mappings = pomfProvider.MAPPINGS_TINY.toPath();
|
||||||
Path[] classpath = jarProvider.getMapperPaths().stream()
|
Path[] classpath = jarProvider.getMapperPaths().stream()
|
||||||
.map(File::toPath)
|
.map(File::toPath)
|
||||||
.toArray(Path[]::new);
|
.toArray(Path[]::new);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.providers.MinecraftProvider;
|
import net.fabricmc.loom.providers.MinecraftProvider;
|
||||||
|
import net.fabricmc.loom.providers.PomfProvider;
|
||||||
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
||||||
import net.fabricmc.tinyremapper.TinyRemapper;
|
import net.fabricmc.tinyremapper.TinyRemapper;
|
||||||
import net.fabricmc.tinyremapper.TinyUtils;
|
import net.fabricmc.tinyremapper.TinyUtils;
|
||||||
|
@ -79,8 +80,9 @@ public class ModProcessor {
|
||||||
String toM = "named";
|
String toM = "named";
|
||||||
|
|
||||||
MinecraftProvider minecraftProvider = extension.getMinecraftProvider();
|
MinecraftProvider minecraftProvider = extension.getMinecraftProvider();
|
||||||
|
PomfProvider pomfProvider = extension.getPomfProvider();
|
||||||
|
|
||||||
File mappingsFile = minecraftProvider.pomfProvider.MAPPINGS_TINY;
|
File mappingsFile = pomfProvider.MAPPINGS_TINY;
|
||||||
Path mappings = mappingsFile.toPath();
|
Path mappings = mappingsFile.toPath();
|
||||||
Path mc = minecraftProvider.jarProvider.MINECRAFT_INTERMEDIARY_JAR.toPath();
|
Path mc = minecraftProvider.jarProvider.MINECRAFT_INTERMEDIARY_JAR.toPath();
|
||||||
Path[] mcDeps = minecraftProvider.jarProvider.getMapperPaths().stream()
|
Path[] mcDeps = minecraftProvider.jarProvider.getMapperPaths().stream()
|
||||||
|
|
|
@ -26,6 +26,7 @@ package net.fabricmc.loom.util;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.providers.MinecraftProvider;
|
import net.fabricmc.loom.providers.MinecraftProvider;
|
||||||
|
import net.fabricmc.loom.providers.PomfProvider;
|
||||||
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
||||||
import net.fabricmc.tinyremapper.TinyRemapper;
|
import net.fabricmc.tinyremapper.TinyRemapper;
|
||||||
import net.fabricmc.tinyremapper.TinyUtils;
|
import net.fabricmc.tinyremapper.TinyUtils;
|
||||||
|
@ -51,8 +52,9 @@ public class ModRemapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
MinecraftProvider minecraftProvider = extension.getMinecraftProvider();
|
MinecraftProvider minecraftProvider = extension.getMinecraftProvider();
|
||||||
|
PomfProvider pomfProvider = extension.getPomfProvider();
|
||||||
|
|
||||||
Path mappings = minecraftProvider.pomfProvider.MAPPINGS_TINY.toPath();
|
Path mappings = pomfProvider.MAPPINGS_TINY.toPath();
|
||||||
|
|
||||||
String fromM = "named";
|
String fromM = "named";
|
||||||
String toM = "intermediary";
|
String toM = "intermediary";
|
||||||
|
@ -62,7 +64,7 @@ public class ModRemapper {
|
||||||
|
|
||||||
Path[] classpath = classpathFiles.stream().map(File::toPath).toArray(Path[]::new);
|
Path[] classpath = classpathFiles.stream().map(File::toPath).toArray(Path[]::new);
|
||||||
|
|
||||||
File mixinMapFile = extension.getMinecraftProvider().pomfProvider.MAPPINGS_MIXIN_EXPORT;
|
File mixinMapFile = pomfProvider.MAPPINGS_MIXIN_EXPORT;
|
||||||
Path mixinMapPath = mixinMapFile.toPath();
|
Path mixinMapPath = mixinMapFile.toPath();
|
||||||
|
|
||||||
TinyRemapper.Builder remapperBuilder = TinyRemapper.newRemapper();
|
TinyRemapper.Builder remapperBuilder = TinyRemapper.newRemapper();
|
||||||
|
|
Loading…
Reference in New Issue