From f129aaa470a26ea0a4f055c85ccd448b16e04f91 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Sat, 11 Dec 2021 07:55:39 -0700 Subject: [PATCH] well, 1.8.9 works... 1.12 fg2 is giving me issues --- .../providers/forge/McpConfigProvider.java | 8 ++++---- .../providers/forge/MinecraftPatchedProvider.java | 12 ++++++------ .../providers/mappings/MappingsProviderImpl.java | 2 +- .../loom/util/srg/SpecialSourceExecutor.java | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/forge/McpConfigProvider.java b/src/main/java/net/fabricmc/loom/configuration/providers/forge/McpConfigProvider.java index 0ab287a771..69ed6ded70 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/forge/McpConfigProvider.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/forge/McpConfigProvider.java @@ -58,14 +58,14 @@ public class McpConfigProvider extends DependencyProvider { private String mappingsPath; private RemapAction remapAction; - private boolean isSRG = false; + private boolean isFG2 = false; public McpConfigProvider(Project project) { super(project); } - public boolean isSRG() { - return isSRG; + public boolean isFG2() { + return isFG2; } @Override @@ -78,7 +78,7 @@ public void provide(DependencyInfo dependency, Consumer postPopulation if (getExtension().getForgeProvider().isFG2()) { official = false; mappingsPath = ZipUtils.contains(mcpZip, "joined.srg") ? "joined.srg" : "config/joined.tsrg"; - isSRG = mappingsPath.endsWith(".srg"); + isFG2 = mappingsPath.endsWith(".srg"); remapAction = new FG2RemapAction(getProject()); if (!Files.exists(mcp) || isRefreshDeps()) { Files.copy(mcpZip, mcp, StandardCopyOption.REPLACE_EXISTING); diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java b/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java index fe267d7b04..c500ffbb74 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java @@ -346,15 +346,15 @@ private void produceSrgJar(boolean official, Path clientJar, Path serverJar) thr Path tmpSrg = getToSrgMappings(); Set mcLibs = getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES).resolve(); - boolean isSrg = getExtension().getMcpConfigProvider().isSRG(); + boolean isSrg = getExtension().getSrgProvider().isLegacy(); Path[] clientJarOut = new Path[] { null }; Path[] serverJarOut = new Path[] { null }; ThreadingUtils.run(() -> { - clientJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg, isSrg, false); + clientJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg, isSrg, true); }, () -> { - serverJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg, isSrg, false); + serverJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg, isSrg, true); }); // if (isSrg) { @@ -641,7 +641,7 @@ private void patchJars(File clean, File output, Path patches, String side) throw // Failed to replace logger filter, just ignore } - if (getExtension().getMcpConfigProvider().isSRG()) { + if (getExtension().getMcpConfigProvider().isFG2()) { new TaskApplyBinPatches().doTask(getProject(), clean.getAbsoluteFile(), patches.toFile().getAbsoluteFile(), output.getAbsoluteFile(), side); @@ -665,11 +665,11 @@ private void mergeJars(Logger logger) throws Exception { // This will change if upstream Loom adds the possibility for separate projects/source sets per environment. - if (getExtension().getMcpConfigProvider().isSRG()) { + if (getExtension().getMcpConfigProvider().isFG2()) { logger.lifecycle(":merging jars"); Path tmpSrg = getToSrgMappings(); Set mcLibs = getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES).resolve(); - Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "merged", mcLibs, minecraftClientPatchedSrgJar.toPath(), tmpSrg, true, true), minecraftMergedPatchedSrgJar.toPath()); + Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "merged", mcLibs, minecraftClientPatchedSrgJar.toPath(), tmpSrg, getExtension().getSrgProvider().isLegacy(), false), minecraftMergedPatchedSrgJar.toPath()); } else { Files.copy(minecraftClientPatchedSrgJar.toPath(), minecraftMergedPatchedSrgJar.toPath()); } diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java index ef4b3f2a04..7dd8a69ebe 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java @@ -343,7 +343,7 @@ private void readAndMergeMCP(Path mcpJar, Consumer postPopulationSched } Path srgPath = getRawSrgFile(); - TinyFile file = new MCPReader(intermediaryTinyPath, srgPath, getExtension().getMcpConfigProvider().isSRG()).read(mcpJar); + TinyFile file = new MCPReader(intermediaryTinyPath, srgPath, getExtension().getSrgProvider().isLegacy()).read(mcpJar); TinyV2Writer.write(file, tinyMappings); } diff --git a/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java b/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java index 98b625c221..64b47b718e 100644 --- a/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java +++ b/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java @@ -55,10 +55,10 @@ private static String trimLeadingSlash(String string) { return string; } - public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set mcLibs, Path officialJar, Path mappings, boolean isSrg, boolean actuallyRemapSrg) + public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set mcLibs, Path officialJar, Path mappings, boolean isLegacy, boolean isFG2) throws Exception { Set filter; - if (isSrg) { + if (isLegacy) { filter = Files.readAllLines(mappings, StandardCharsets.UTF_8).stream() .filter(s -> s.startsWith("CL:")) .map(s -> s.split(" ")[1] + ".class") @@ -122,7 +122,7 @@ public static Path produceSrgJar(RemapAction remapAction, Project project, Strin Path workingDir = tmpDir(); - if (!isSrg || actuallyRemapSrg) { + if (!isFG2) { project.javaexec(spec -> { spec.setArgs(args); spec.setClasspath(remapAction.getClasspath());