Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with Forge #225

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1138d0a
fixme MixinExtensionApiImpl
Jab125 Jul 8, 2024
116f8ee
test example mod mixin
Jab125 Jul 8, 2024
faca293
fix example mod mixin
Jab125 Jul 8, 2024
b27d721
output `useLegacyMixinAp` in the forge test
Jab125 Jul 8, 2024
7ad1fa8
require `useLegacyMixinAp` to be manually set to false on Forge 50+
Jab125 Jul 8, 2024
294a30d
add JEI to the forge test
Jab125 Jul 8, 2024
4de99f3
make MappingConfiguration aware of the project
Jab125 Jul 8, 2024
90bcdc0
make `getMappingsService` return the SRG service instead of the MOJAN…
Jab125 Jul 8, 2024
07664a3
add new test for Forge mod dependencies
Jab125 Jul 9, 2024
4bba791
Fix `usesMojangAtRuntime` check
Jab125 Jul 9, 2024
8446f11
try to replace all srg names with mojang names
Jab125 Jul 9, 2024
9feed22
Update ForgeSrgToMojangUtil.java
Jab125 Jul 9, 2024
a01b9a6
Update ModProcessor.java
Jab125 Jul 9, 2024
b9aaba2
Update ForgeSrgToMojangUtil.java
Jab125 Jul 9, 2024
f7102f2
add NeoForge 1.21 test
Jab125 Jul 9, 2024
19425cd
Fix NeoForge 1.21 test formatting
Jab125 Jul 9, 2024
81b7f4f
fix forge 1.20.6 dependency test formatting
Jab125 Jul 9, 2024
20334f5
fix checkstyle
Jab125 Jul 9, 2024
aa43f5a
Update src/main/java/net/fabricmc/loom/extension/MixinExtensionApiImp…
Jab125 Jul 9, 2024
555e1e0
Use union relauncher between 49.0.0 and 49.0.37, use bs-dev otherwise
Jab125 Jul 9, 2024
64441fe
change Automatic-Module-Name
Jab125 Jul 9, 2024
06ed900
Update ForgeRunTemplate.java
Jab125 Jul 9, 2024
e052ae9
add multiloader-forge project
Jab125 Jul 11, 2024
900f2cf
try fix more forge stuff
Jab125 Jul 11, 2024
81d92d6
Revert "add multiloader-forge project"
Jab125 Jul 11, 2024
acdc6db
fix checkstyle
Jab125 Jul 12, 2024
9d33f3f
Delete ForgeSrgToMojangUtil.java
Jab125 Jul 12, 2024
4a15c82
fix more issues
Jab125 Jul 13, 2024
e35e30b
Update MinecraftPatchedProvider.java
Jab125 Jul 13, 2024
bef3ea8
Update Constants.java
Jab125 Jul 14, 2024
1563c35
fix forge gametest hooks
Jab125 Jul 18, 2024
36777ef
Revert "fix forge gametest hooks"
Jab125 Jul 25, 2024
21bf66d
Merge branch 'dev/1.7' into dev/1.7-fix-forge-issues-for-the-3rd-time
Jab125 Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/dev/architectury/loom/util/MappingOption.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.architectury.loom.util;

import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.api.LoomGradleExtensionAPI;

public enum MappingOption {
Expand All @@ -9,7 +10,7 @@ public enum MappingOption {

public static MappingOption forPlatform(LoomGradleExtensionAPI extension) {
return switch (extension.getPlatform().get()) {
case FORGE -> WITH_SRG;
case FORGE -> ((LoomGradleExtension) extension).getForgeProvider().usesMojangAtRuntime() ? WITH_MOJANG : WITH_SRG;
case NEOFORGE -> WITH_MOJANG;
default -> DEFAULT;
};
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/fabricmc/loom/LoomGradleExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ default List<Path> getMinecraftJars(MappingsNamespace mappingsNamespace) {
yield getSrgMinecraftProvider().getMinecraftJarPaths();
}
case MOJANG -> {
ModPlatform.assertPlatform(this, ModPlatform.NEOFORGE, () -> "Mojang-mapped jars are only available on NeoForge.");
assert this.isForgeLike() && this.getForgeProvider().usesMojangAtRuntime() : "Mojang-mapped jars are only available on Forge 50+ or NeoForge.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using assert here is a behaviour change (since this check needs assertions at runtime which are never enabled for Gradle probably?)

yield getMojangMappedMinecraftProvider().getMinecraftJarPaths();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ public static String runtimeIntermediary(Project project) {
* Returns the intermediary namespace of the project.
*/
public static MappingsNamespace intermediaryNamespace(Project project) {
return intermediaryNamespace(LoomGradleExtension.get(project).getPlatform().get());
return intermediaryNamespace(LoomGradleExtension.get(project).getPlatform().get(), LoomGradleExtension.get(project));
}

/**
* Returns the intermediary namespace of the platform.
*/
public static MappingsNamespace intermediaryNamespace(ModPlatform platform) {
public static MappingsNamespace intermediaryNamespace(ModPlatform platform, LoomGradleExtension extension) {
return switch (platform) {
case FABRIC, QUILT -> MappingsNamespace.INTERMEDIARY;
case FORGE -> MappingsNamespace.SRG;
case FORGE -> extension.getForgeProvider().usesMojangAtRuntime() ? MappingsNamespace.MOJANG : MappingsNamespace.SRG;
case NEOFORGE -> MappingsNamespace.MOJANG;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ private synchronized void setupMinecraft(ConfigContext configContext) throws Exc
final SrgMinecraftProvider<?> srgMinecraftProvider = jarConfiguration.createSrgMinecraftProvider(project);
extension.setSrgMinecraftProvider(srgMinecraftProvider);
srgMinecraftProvider.provide(provideContext);
} else if (extension.isNeoForge()) {
}

if (extension.isForgeLike() && extension.getForgeProvider().usesMojangAtRuntime()) {
final MojangMappedMinecraftProvider<?> mojangMappedMinecraftProvider = jarConfiguration.createMojangMappedMinecraftProvider(project);
extension.setMojangMappedMinecraftProvider(mojangMappedMinecraftProvider);
mojangMappedMinecraftProvider.provide(provideContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class ForgeLibrariesProvider {
private static final String FANCYML_LOADER_GROUP = "net.neoforged.fancymodloader";
private static final String FANCYML_LOADER_NAME = "loader";

private static final String FORGE_GAME_TEST_HOOLS_FILE = "net/minecraftforge/gametest/ForgeGameTestHooks.class";
private static final String FORGE_OBJECT_HOLDER_FILE = "net/minecraftforge/fml/common/asm/ObjectHolderDefinalize.class";
private static final String FORGE_MOD_DIR_TRANSFORMER_DISCOVERER_FILE = "net/minecraftforge/fml/loading/ModDirTransformerDiscoverer.class";
private static final String NEOFORGE_OBJECT_HOLDER_FILE = "net/neoforged/fml/common/asm/ObjectHolderDefinalize.class";
Expand Down Expand Up @@ -96,6 +97,13 @@ public static void provide(MappingConfiguration mappingConfiguration, Project pr
}
}

if (lib.startsWith("net.minecraftforge:bootstrap:")) {
if (extension.isForge() && extension.getForgeProvider().usesBootstrapDev()) {
String version = lib.substring(lib.lastIndexOf(":"));
dependencies.add(project.getDependencies().create("net.minecraftforge:bootstrap-dev" + version));
}
}

if (dep == null) {
dep = lib;
}
Expand Down Expand Up @@ -178,6 +186,10 @@ private static Object remapFmlLoader(Project project, ResolvedArtifact artifact,
remapObjectHolder(project, outputJar, mappingConfiguration);
}

if (Files.exists(fs.get().getPath(FORGE_GAME_TEST_HOOLS_FILE))) {
remapObjectHolder(project, outputJar, mappingConfiguration);
}

if (Files.exists(fs.getPath(FORGE_MOD_DIR_TRANSFORMER_DISCOVERER_FILE))) {
ClassVisitorUtil.rewriteClassFile(fs.getPath(FORGE_MOD_DIR_TRANSFORMER_DISCOVERER_FILE), ModDirTransformerDiscovererPatch::new);
}
Expand Down Expand Up @@ -222,6 +234,24 @@ private static void remapObjectHolder(Project project, Path outputJar, MappingCo
}
}

private static void remapGameTestHooks(Project project, Path outputJar, MappingConfiguration mappingConfiguration) throws IOException {
try {
// Merge SRG mappings. The real SRG mapping file hasn't been created yet since the usual SRG merging
// process occurs after all Forge libraries have been provided.
// Forge libs are needed for MC, which is needed for the mappings.
final ForgeMappingsMerger.ExtraMappings extraMappings = ForgeMappingsMerger.ExtraMappings.ofMojmapTsrg(MappingConfiguration.getMojmapSrgFileIfPossible(project));
final MemoryMappingTree mappings = ForgeMappingsMerger.mergeSrg(MappingConfiguration.getRawSrgFile(project), mappingConfiguration.tinyMappings, extraMappings, true);

// Remap the game test hooks.
RemapObjectHolderVisitor.remapObjectHolder(
outputJar, "net.minecraftforge.gametest.ForgeGameTestHooks", mappings,
MappingsNamespace.SRG.toString(), MappingsNamespace.NAMED.toString()
);
} catch (IOException e) {
throw new IOException("Could not remap object holders in " + outputJar, e);
}
}

private static void remapNeoForgeObjectHolder(Project project, Path outputJar, MappingConfiguration mappingConfiguration) throws IOException {
try {
// Merge Mojang mappings. The real Mojang mapping file hasn't been created yet since the usual Mojang merging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void provide(DependencyInfo dependency) throws Exception {
addDependency(dependency.getDepString() + ":userdev", Constants.Configurations.FORGE_USERDEV);
addDependency(dependency.getDepString() + ":installer", Constants.Configurations.FORGE_INSTALLER);

if (getExtension().isForge() && version.getMajorVersion() >= Constants.Forge.MIN_UNION_RELAUNCHER_VERSION) {
if (getExtension().isForge() && usesUnionRelauncher()) {
addDependency(LoomVersions.UNION_RELAUNCHER.mavenNotation(), Constants.Configurations.FORGE_EXTRA);
}
}
Expand All @@ -64,6 +64,16 @@ public boolean usesMojangAtRuntime() {
return platform == ModPlatform.NEOFORGE || version.getMajorVersion() >= Constants.Forge.MIN_USE_MOJANG_NS_VERSION;
}

public boolean usesUnionRelauncher() {
return platform == ModPlatform.FORGE && version.getMajorVersion() >= Constants.Forge.MIN_UNION_RELAUNCHER_VERSION && !usesBootstrapDev();
}

public boolean usesBootstrapDev() {
boolean forge50OrOver = version.getMajorVersion() >= Constants.Forge.MIN_UNION_RELAUNCHER_VERSION;
boolean point0dot38 = version.getMajorVersion() >= 50 || (version.getMajorVersion() == 49 && version.getMinorVersion() >= 1 || version.getMinorVersion() == 0 && version.getPatchVersion() >= 38);
return platform == ModPlatform.FORGE && forge50OrOver && point0dot38;
}

public File getGlobalCache() {
if (globalCache == null) {
globalCache = getMinecraftProvider().dir(platform.id() + "/" + version.getCombined());
Expand Down Expand Up @@ -96,6 +106,8 @@ public static final class ForgeVersion {
private final String minecraftVersion;
private final String forgeVersion;
private final int majorVersion;
private final int minorVersion;
private final int patchVersion;

public ForgeVersion(String combined) {
this.combined = combined;
Expand All @@ -104,6 +116,8 @@ public ForgeVersion(String combined) {
this.minecraftVersion = "NO_VERSION";
this.forgeVersion = "NO_VERSION";
this.majorVersion = -1;
this.minorVersion = -1;
this.patchVersion = -1;
return;
}

Expand All @@ -117,20 +131,22 @@ public ForgeVersion(String combined) {
this.forgeVersion = combined;
}

int dotIndex = forgeVersion.indexOf('.');
int major;
int major, minor, patch;

try {
if (dotIndex >= 0) {
major = Integer.parseInt(forgeVersion.substring(0, dotIndex));
} else {
major = Integer.parseInt(forgeVersion);
}
} catch (NumberFormatException e) {
String[] versionComponents = forgeVersion.split("\\.");
major = Integer.parseInt(versionComponents[0]);
minor = Integer.parseInt(versionComponents[1]);
patch = Integer.parseInt(versionComponents[2]);
} catch (Exception e) {
major = -1;
minor = -1;
patch = -1;
}

this.majorVersion = major;
this.minorVersion = minor;
this.patchVersion = patch;
}

public String getCombined() {
Expand All @@ -148,5 +164,13 @@ public String getForgeVersion() {
public int getMajorVersion() {
return majorVersion;
}

public int getMinorVersion() {
return minorVersion;
}

public int getPatchVersion() {
return patchVersion;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

package net.fabricmc.loom.configuration.providers.forge;

import java.io.File;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -110,12 +111,21 @@ public void applyTo(RunConfigSettings settings, ConfigValue.Resolver configValue
settings.getEnvironmentVariables().putIfAbsent(key, resolved);
});

final ForgeProvider forgeProvider = settings.getExtension().getForgeProvider();

// Add MOD_CLASSES, this is something that ForgeGradle does
settings.getEnvironmentVariables().computeIfAbsent("MOD_CLASSES", $ -> ConfigValue.of("{source_roots}").resolve(configValueResolver));
settings.getEnvironmentVariables().computeIfAbsent("MOD_CLASSES", $ -> {
String modClasses = ConfigValue.of("{source_roots}").resolve(configValueResolver);

final ForgeProvider forgeProvider = settings.getExtension().getForgeProvider();
if (File.pathSeparatorChar == ':' && forgeProvider.usesBootstrapDev()) {
// bs-dev has a bug where ';' is used instead of File.pathSeparatorChar
modClasses = modClasses.replaceAll(":", ";");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
modClasses = modClasses.replaceAll(":", ";");
modClasses = modClasses.replace(":", ";");

No need to use regex here

}

return modClasses;
});

if (settings.getExtension().isForge() && forgeProvider.getVersion().getMajorVersion() >= Constants.Forge.MIN_UNION_RELAUNCHER_VERSION) {
if (settings.getExtension().isForge() && forgeProvider.usesUnionRelauncher()) {
settings.defaultMainClass(Constants.Forge.UNION_RELAUNCHER_MAIN_CLASS);
settings.property(Constants.Forge.UNION_RELAUNCHER_MAIN_CLASS_PROPERTY, main);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.gradle.api.Project;
import org.gradle.api.logging.LogLevel;
import org.gradle.api.logging.Logger;
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
Expand Down Expand Up @@ -111,6 +112,8 @@ public class MinecraftPatchedProvider {
private Path minecraftPatchedIntermediateJar;
// Step 3: Access Transform
private Path minecraftPatchedIntermediateAtJar;
// Forge 1.20.6: Step 3.5: Remap Patched AT and Forge to mojmaps
private Path minecraftPatchedMojangAtJar;
// Step 4: Remap Patched AT & Forge to official
private Path minecraftPatchedJar;
private Path minecraftClientExtra;
Expand Down Expand Up @@ -151,6 +154,11 @@ private void initPatchedFiles() {
minecraftIntermediateJar = forgeWorkingDir.resolve("minecraft-" + type.id + "-" + intermediateId + ".jar");
minecraftPatchedIntermediateJar = forgeWorkingDir.resolve("minecraft-" + type.id + "-" + intermediateId + "-patched.jar");
minecraftPatchedIntermediateAtJar = forgeWorkingDir.resolve("minecraft-" + type.id + "-" + intermediateId + "-at-patched.jar");

if (getExtension().isForge() && getExtension().getForgeProvider().usesMojangAtRuntime()) {
minecraftPatchedMojangAtJar = forgeWorkingDir.resolve("minecraft-" + type.id + "-mojang-at-patched.jar");
}

minecraftPatchedJar = forgeWorkingDir.resolve("minecraft-" + type.id + "-patched.jar");
minecraftClientExtra = forgeWorkingDir.resolve("client-extra.jar");
}
Expand All @@ -162,13 +170,14 @@ private void cleanAllCache() throws IOException {
}

private Path[] getGlobalCaches() {
Path[] files = {
Path[] files = Stream.of(
minecraftIntermediateJar,
minecraftPatchedIntermediateJar,
minecraftPatchedIntermediateAtJar,
minecraftPatchedMojangAtJar,
minecraftPatchedJar,
minecraftClientExtra,
};
minecraftClientExtra
).filter(Objects::nonNull).toArray(Path[]::new);

return files;
}
Expand Down Expand Up @@ -201,7 +210,7 @@ public void provide() throws Exception {
patchJars();
}

if (dirty || Files.notExists(minecraftPatchedIntermediateAtJar)) {
if (dirty || Files.notExists(minecraftPatchedIntermediateAtJar) || (getExtension().isForge() && getExtension().getForgeProvider().usesMojangAtRuntime() && Files.notExists(minecraftPatchedMojangAtJar))) {
this.dirty = true;
accessTransformForge();
}
Expand All @@ -227,14 +236,16 @@ private void fillClientExtraJar() throws IOException {
}

private TinyRemapper buildRemapper(SharedServiceManager serviceManager, Path input) throws IOException {
final MappingOption mappingOption = MappingOption.forPlatform(getExtension());
return buildRemapper(MappingOption.forPlatform(getExtension()), IntermediaryNamespaces.intermediary(project), "official", serviceManager, input);
}

private TinyRemapper buildRemapper(final MappingOption mappingOption, final String sourceNamespace, final String to, SharedServiceManager serviceManager, Path input) throws IOException {
TinyMappingsService mappingsService = getExtension().getMappingConfiguration().getMappingsService(serviceManager, mappingOption);
final String sourceNamespace = IntermediaryNamespaces.intermediary(project);
MemoryMappingTree mappings = mappingsService.getMappingTree();

TinyRemapper.Builder builder = TinyRemapper.newRemapper()
.withMappings(TinyRemapperHelper.create(mappings, sourceNamespace, "official", true))
.withMappings(InnerClassRemapper.of(InnerClassRemapper.readClassNames(input), mappings, sourceNamespace, "official"))
.withMappings(TinyRemapperHelper.create(mappings, sourceNamespace, to, true))
.withMappings(InnerClassRemapper.of(InnerClassRemapper.readClassNames(input), mappings, sourceNamespace, to))
.renameInvalidLocals(true)
.rebuildSourceFilenames(true);

Expand Down Expand Up @@ -409,33 +420,51 @@ public static void accessTransform(Project project, Path input, Path target) thr
}

private void remapPatchedJar(SharedServiceManager serviceManager) throws Exception {
logger.lifecycle(":remapping minecraft (TinyRemapper, srg -> official)");
Path mcInput = minecraftPatchedIntermediateAtJar;
Path mcPatchedAt = minecraftPatchedMojangAtJar;
Path mcOutput = minecraftPatchedJar;
Path forgeJar = getForgeJar().toPath();
Path forgeUserdevJar = getForgeUserdevJar().toPath();

if (mcPatchedAt != null) {
Files.deleteIfExists(mcPatchedAt);
}

Files.deleteIfExists(mcOutput);

TinyRemapper remapper = buildRemapper(serviceManager, mcInput);
if (getExtension().isForge() && getExtension().getForgeProvider().usesMojangAtRuntime()) {
logger.lifecycle(":remapping minecraft (TinyRemapper, srg -> mojang)");
TinyRemapper remapper = buildRemapper(MappingOption.WITH_SRG, "srg", "mojang", serviceManager, mcInput);
remapJar(remapper, serviceManager, mcInput, mcPatchedAt, forgeJar, forgeUserdevJar, false);
logger.lifecycle(":remapping minecraft (TinyRemapper, mojang -> official)");
TinyRemapper remapper2 = buildRemapper(MappingOption.WITH_MOJANG, "mojang", "official", serviceManager, mcInput);
remapJar(remapper2, serviceManager, mcPatchedAt, mcOutput, null, null, true);
Comment on lines +436 to +441
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the game remapped twice? Remapping the game is slow, so it should be avoided.

} else {
logger.lifecycle(":remapping minecraft (TinyRemapper, %s -> official)".formatted(getExtension().isForge() ? "srg" : "mojang"));
TinyRemapper remapper = buildRemapper(serviceManager, mcInput);
remapJar(remapper, serviceManager, mcInput, mcOutput, forgeJar, forgeUserdevJar, true);
}
}

private void remapJar(TinyRemapper remapper, SharedServiceManager serviceManager, Path mcInput, Path mcOutput, @Nullable Path forgeJar, @Nullable Path forgeUserdevJar, boolean remapCoreMods) throws Exception {
try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(mcOutput).build()) {
outputConsumer.addNonClassFiles(mcInput);
outputConsumer.addNonClassFiles(forgeJar, NonClassCopyMode.FIX_META_INF, remapper);
if (forgeJar != null) outputConsumer.addNonClassFiles(forgeJar, NonClassCopyMode.FIX_META_INF, remapper);

InputTag mcTag = remapper.createInputTag();
InputTag forgeTag = remapper.createInputTag();
List<CompletableFuture<?>> futures = new ArrayList<>();
futures.add(remapper.readInputsAsync(mcTag, mcInput));
futures.add(remapper.readInputsAsync(forgeTag, forgeJar, forgeUserdevJar));
if (forgeJar != null) futures.add(remapper.readInputsAsync(forgeTag, forgeJar, forgeUserdevJar));
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
remapper.apply(outputConsumer, mcTag);
remapper.apply(outputConsumer, forgeTag);
} finally {
remapper.finish();
}

copyUserdevFiles(forgeUserdevJar, mcOutput);
remapCoreMods(mcOutput, serviceManager);
if (forgeUserdevJar != null) copyUserdevFiles(forgeUserdevJar, mcOutput);
if (remapCoreMods) remapCoreMods(mcOutput, serviceManager);
applyLoomPatchVersion(mcOutput);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class MappingConfiguration {
private boolean hasUnpickDefinitions;
private UnpickMetadata unpickMetadata;
private Map<String, String> signatureFixes;
private LoomGradleExtension extension;

protected MappingConfiguration(String mappingsIdentifier, Path mappingsWorkingDir) {
this.mappingsIdentifier = mappingsIdentifier;
Expand Down Expand Up @@ -164,6 +165,11 @@ public TinyMappingsService getMappingsService(SharedServiceManager serviceManage
}

public TinyMappingsService getMappingsService(SharedServiceManager serviceManager, MappingOption mappingOption) {
if (extension.isForge() && extension.getForgeProvider().usesMojangAtRuntime() && mappingOption == MappingOption.WITH_MOJANG) {
// Mojang mappings are merged into the SRG file.
return getMappingsService(serviceManager, MappingOption.WITH_SRG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return getMappingsService(serviceManager, MappingOption.WITH_SRG);
mappingOption = MappingOption.WITH_SRG;

No need to recurse

}

final Path tinyMappings = switch (mappingOption) {
case WITH_SRG -> {
if (Files.notExists(this.tinyMappingsWithSrg)) {
Expand Down Expand Up @@ -205,7 +211,7 @@ protected void setup(Project project, SharedServiceManager serviceManager, Minec
}

public void setupPost(Project project) throws IOException {
LoomGradleExtension extension = LoomGradleExtension.get(project);
this.extension = LoomGradleExtension.get(project);

if (extension.isNeoForge()) {
// Generate the Mojmap-merged mappings if needed.
Expand Down
Loading