From 8feac3582fae2af6d670cdf761b6e831f1195933 Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Thu, 2 Nov 2023 19:52:33 +0200 Subject: [PATCH] Fix (Neo)Forge builtin coremods not being remapped Fixes #146. --- .../providers/forge/MinecraftPatchedProvider.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 7f1667ed4..1feedbf17 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 @@ -89,12 +89,14 @@ import net.fabricmc.loom.util.function.FsPathConsumer; import net.fabricmc.loom.util.service.ScopedSharedServiceManager; import net.fabricmc.loom.util.service.SharedServiceManager; +import net.fabricmc.loom.util.srg.CoreModClassRemapper; import net.fabricmc.loom.util.srg.InnerClassRemapper; +import net.fabricmc.mappingio.tree.MappingTree; import net.fabricmc.mappingio.tree.MemoryMappingTree; public class MinecraftPatchedProvider { private static final String LOOM_PATCH_VERSION_KEY = "Loom-Patch-Version"; - private static final String CURRENT_LOOM_PATCH_VERSION = "8"; + private static final String CURRENT_LOOM_PATCH_VERSION = "9"; private static final String NAME_MAPPING_SERVICE_PATH = "/inject/META-INF/services/cpw.mods.modlauncher.api.INameMappingService"; private final Project project; @@ -434,9 +436,17 @@ private void remapPatchedJar(SharedServiceManager serviceManager) throws Excepti } copyUserdevFiles(forgeUserdevJar, mcOutput); + remapCoreMods(mcOutput, serviceManager); applyLoomPatchVersion(mcOutput); } + private void remapCoreMods(Path patchedJar, SharedServiceManager serviceManager) throws Exception { + final MappingOption mappingOption = MappingOption.forPlatform(getExtension()); + final TinyMappingsService mappingsService = getExtension().getMappingConfiguration().getMappingsService(serviceManager, mappingOption); + final MappingTree mappings = mappingsService.getMappingTree(); + CoreModClassRemapper.remapJar(project, patchedJar, mappings); + } + private void patchJars() throws Exception { Stopwatch stopwatch = Stopwatch.createStarted(); logger.lifecycle(":patching jars");