Improve mod re-mapper
parent
9f959ef04d
commit
e274d0c8c5
|
@ -241,7 +241,7 @@ public class AbstractPlugin implements Plugin<Project> {
|
|||
|
||||
if (extension.fabricVersion != null && !extension.fabricVersion.isEmpty()) {
|
||||
//only add this when not in a fabric dev env
|
||||
project1.getDependencies().add(Constants.CONFIG_MC_DEPENDENCIES, "net.fabricmc:fabric-base:" + extension.version + "-" + extension.fabricVersion);
|
||||
project1.getDependencies().add(Constants.CONFIG_MC_DEPENDENCIES, "net.fabricmc:fabric-base:" + extension.version + "-" + extension.fabricVersion + ":debof");
|
||||
}
|
||||
project1.getDependencies().add(Constants.PROCESS_MODS_DEPENDENCIES, "net.fabricmc:fabric-base:16w38a-0.0.4-SNAPSHOT");
|
||||
});
|
||||
|
|
|
@ -59,8 +59,6 @@ public class ProcessModsTask extends DefaultTask {
|
|||
if (mods.size() == 0) {
|
||||
FileUtils.copyFile(Constants.MINECRAFT_MAPPED_JAR.get(extension), Constants.MINECRAFT_FINAL_JAR.get(extension));
|
||||
} else {
|
||||
//TODO figure out a way to specify what deps do what
|
||||
//TODO download deps when needed
|
||||
downloadRequiredDeps(extension);
|
||||
new PreBakeMixins().proccess(getProject(), extension, mods);
|
||||
}
|
||||
|
|
|
@ -42,17 +42,19 @@ public class ModRemapper {
|
|||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||
//TODO whats the proper way of doing this???
|
||||
File libsDir = new File(project.getBuildDir(), "libs");
|
||||
File modJar = new File(libsDir, project.getName() + "-" + project.getVersion() + "-unmapped.jar");
|
||||
File modMappedJar = new File(libsDir, project.getName() + "-" + project.getVersion() + ".jar");
|
||||
if (!modMappedJar.exists()) {
|
||||
project.getLogger().error("Could not find mod jar @" + modJar.getAbsolutePath());
|
||||
File debofJar = new File(libsDir, project.getName() + "-" + project.getVersion() + "-debof.jar");
|
||||
File modJar = new File(libsDir, project.getName() + "-" + project.getVersion() + ".jar");
|
||||
if (!modJar.exists()) {
|
||||
project.getLogger().error("Could not find mod jar @" + debofJar.getAbsolutePath());
|
||||
project.getLogger().error("This is can be fixed by adding a 'settings.gradle' file specifying 'rootProject.name'");
|
||||
return;
|
||||
}
|
||||
if (modJar.exists()) {
|
||||
modJar.delete();
|
||||
if (debofJar.exists()) {
|
||||
debofJar.delete();
|
||||
}
|
||||
|
||||
modMappedJar.renameTo(modJar);
|
||||
//Move the pre existing mod jar to the debof jar
|
||||
modJar.renameTo(debofJar);
|
||||
|
||||
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();
|
||||
|
||||
|
@ -75,12 +77,16 @@ public class ModRemapper {
|
|||
.withMappings(TinyUtils.createTinyMappingProvider(Constants.MAPPINGS_MIXIN_EXPORT.get(extension).toPath(), fromM, toM))
|
||||
.build();
|
||||
|
||||
OutputConsumerPath outputConsumer = new OutputConsumerPath(modMappedJar.toPath());
|
||||
outputConsumer.addNonClassFiles(modJar.toPath());
|
||||
remapper.read(modJar.toPath());
|
||||
OutputConsumerPath outputConsumer = new OutputConsumerPath(modJar.toPath());
|
||||
//Rebof the debof jar
|
||||
outputConsumer.addNonClassFiles(debofJar.toPath());
|
||||
remapper.read(debofJar.toPath());
|
||||
remapper.read(classpath);
|
||||
remapper.apply(modJar.toPath(), outputConsumer);
|
||||
remapper.apply(debofJar.toPath(), outputConsumer);
|
||||
outputConsumer.finish();
|
||||
remapper.finish();
|
||||
|
||||
//Add the debof jar to be uploaded to maven
|
||||
project.getArtifacts().add("archives", debofJar);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue