Skip to content

Commit

Permalink
well, 1.8.9 works... 1.12 fg2 is giving me issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Dec 11, 2021
1 parent 47d62bd commit f129aaa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -78,7 +78,7 @@ public void provide(DependencyInfo dependency, Consumer<Runnable> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,15 @@ private void produceSrgJar(boolean official, Path clientJar, Path serverJar) thr
Path tmpSrg = getToSrgMappings();
Set<File> 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) {
Expand Down Expand Up @@ -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);

Expand All @@ -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<File> 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private void readAndMergeMCP(Path mcpJar, Consumer<Runnable> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ private static String trimLeadingSlash(String string) {
return string;
}

public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set<File> mcLibs, Path officialJar, Path mappings, boolean isSrg, boolean actuallyRemapSrg)
public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set<File> mcLibs, Path officialJar, Path mappings, boolean isLegacy, boolean isFG2)
throws Exception {
Set<String> filter;
if (isSrg) {
if (isLegacy) {
filter = Files.readAllLines(mappings, StandardCharsets.UTF_8).stream()
.filter(s -> s.startsWith("CL:"))
.map(s -> s.split(" ")[1] + ".class")
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit f129aaa

Please sign in to comment.