Skip to content

Commit 689eb98

Browse files
committed
well, it works, cleanup needed
1 parent 47d62bd commit 689eb98

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/main/java/net/fabricmc/loom/configuration/providers/forge/McpConfigProvider.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ public class McpConfigProvider extends DependencyProvider {
5858
private String mappingsPath;
5959
private RemapAction remapAction;
6060

61-
private boolean isSRG = false;
61+
private boolean isFG2 = false;
6262

6363
public McpConfigProvider(Project project) {
6464
super(project);
6565
}
6666

67-
public boolean isSRG() {
68-
return isSRG;
67+
public boolean isFG2() {
68+
return isFG2;
6969
}
7070

7171
@Override
@@ -78,7 +78,7 @@ public void provide(DependencyInfo dependency, Consumer<Runnable> postPopulation
7878
if (getExtension().getForgeProvider().isFG2()) {
7979
official = false;
8080
mappingsPath = ZipUtils.contains(mcpZip, "joined.srg") ? "joined.srg" : "config/joined.tsrg";
81-
isSRG = mappingsPath.endsWith(".srg");
81+
isFG2 = mappingsPath.endsWith(".srg");
8282
remapAction = new FG2RemapAction(getProject());
8383
if (!Files.exists(mcp) || isRefreshDeps()) {
8484
Files.copy(mcpZip, mcp, StandardCopyOption.REPLACE_EXISTING);

src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,15 @@ private void produceSrgJar(boolean official, Path clientJar, Path serverJar) thr
346346
Path tmpSrg = getToSrgMappings();
347347
Set<File> mcLibs = getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES).resolve();
348348

349-
boolean isSrg = getExtension().getMcpConfigProvider().isSRG();
349+
boolean isSrg = getExtension().getSrgProvider().isLegacy();
350350

351351
Path[] clientJarOut = new Path[] { null };
352352
Path[] serverJarOut = new Path[] { null };
353353

354354
ThreadingUtils.run(() -> {
355-
clientJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg, isSrg, false);
355+
clientJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg, isSrg, true);
356356
}, () -> {
357-
serverJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg, isSrg, false);
357+
serverJarOut[0] = SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg, isSrg, true);
358358
});
359359

360360
// if (isSrg) {
@@ -641,7 +641,7 @@ private void patchJars(File clean, File output, Path patches, String side) throw
641641
// Failed to replace logger filter, just ignore
642642
}
643643

644-
if (getExtension().getMcpConfigProvider().isSRG()) {
644+
if (getExtension().getMcpConfigProvider().isFG2()) {
645645

646646
new TaskApplyBinPatches().doTask(getProject(), clean.getAbsoluteFile(), patches.toFile().getAbsoluteFile(), output.getAbsoluteFile(), side);
647647

@@ -665,11 +665,11 @@ private void mergeJars(Logger logger) throws Exception {
665665
// This will change if upstream Loom adds the possibility for separate projects/source sets per environment.
666666

667667

668-
if (getExtension().getMcpConfigProvider().isSRG()) {
668+
if (getExtension().getMcpConfigProvider().isFG2()) {
669669
logger.lifecycle(":merging jars");
670670
Path tmpSrg = getToSrgMappings();
671671
Set<File> mcLibs = getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES).resolve();
672-
Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "merged", mcLibs, minecraftClientPatchedSrgJar.toPath(), tmpSrg, true, true), minecraftMergedPatchedSrgJar.toPath());
672+
Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "merged", mcLibs, minecraftClientPatchedSrgJar.toPath(), tmpSrg, getExtension().getSrgProvider().isLegacy(), false), minecraftMergedPatchedSrgJar.toPath());
673673
} else {
674674
Files.copy(minecraftClientPatchedSrgJar.toPath(), minecraftMergedPatchedSrgJar.toPath());
675675
}

src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ private void readAndMergeMCP(Path mcpJar, Consumer<Runnable> postPopulationSched
343343
}
344344

345345
Path srgPath = getRawSrgFile();
346-
TinyFile file = new MCPReader(intermediaryTinyPath, srgPath, getExtension().getMcpConfigProvider().isSRG()).read(mcpJar);
346+
TinyFile file = new MCPReader(intermediaryTinyPath, srgPath, getExtension().getSrgProvider().isLegacy()).read(mcpJar);
347347
TinyV2Writer.write(file, tinyMappings);
348348
}
349349

src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ private static String trimLeadingSlash(String string) {
5555
return string;
5656
}
5757

58-
public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set<File> mcLibs, Path officialJar, Path mappings, boolean isSrg, boolean actuallyRemapSrg)
58+
public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set<File> mcLibs, Path officialJar, Path mappings, boolean isLegacy, boolean isFG2)
5959
throws Exception {
6060
Set<String> filter;
61-
if (isSrg) {
61+
if (isLegacy) {
6262
filter = Files.readAllLines(mappings, StandardCharsets.UTF_8).stream()
6363
.filter(s -> s.startsWith("CL:"))
6464
.map(s -> s.split(" ")[1] + ".class")
@@ -122,7 +122,7 @@ public static Path produceSrgJar(RemapAction remapAction, Project project, Strin
122122

123123
Path workingDir = tmpDir();
124124

125-
if (!isSrg || actuallyRemapSrg) {
125+
if (!isFG2) {
126126
project.javaexec(spec -> {
127127
spec.setArgs(args);
128128
spec.setClasspath(remapAction.getClasspath());

0 commit comments

Comments
 (0)