From 861690226b18d6091a656f94633f3f7e3a55577b Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Thu, 28 Mar 2024 20:25:04 +0100 Subject: [PATCH] Bump CoreMods and ModLauncher --- gradle.properties | 5 +- .../java/net/neoforged/fml/ModLoader.java | 1 - .../fml/core/ParallelTransition.java | 4 +- .../neoforged/fml/loading/FMLEnvironment.java | 2 - .../net/neoforged/fml/loading/FMLLoader.java | 18 +--- .../fml/loading/FMLServiceProvider.java | 4 +- .../neoforged/fml/loading/LoadingModList.java | 4 +- .../fml/loading/MCPNamingService.java | 90 ------------------- .../MixinSyntheticPackageProvider.java | 2 +- .../loading/ModDirTransformerDiscoverer.java | 4 +- .../fml/loading/ModJarURLHandler.java | 4 +- .../fml/loading/moddiscovery/CoreModFile.java | 10 +-- .../moddiscovery/InvalidModIdentifier.java | 20 ++--- .../fml/loading/moddiscovery/ModFile.java | 2 +- .../fml/loading/moddiscovery/ModFileInfo.java | 6 +- .../moddiscovery/ModsFolderLocator.java | 5 +- .../targets/CommonClientLaunchHandler.java | 2 +- .../targets/CommonDevLaunchHandler.java | 1 - .../loading/targets/CommonLaunchHandler.java | 8 -- .../targets/CommonServerLaunchHandler.java | 2 +- .../fml/util/ObfuscationReflectionHelper.java | 21 +---- 21 files changed, 41 insertions(+), 174 deletions(-) delete mode 100644 loader/src/main/java/net/neoforged/fml/loading/MCPNamingService.java diff --git a/gradle.properties b/gradle.properties index 313cc51f9..6ceb013fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,8 @@ mergetool_version=2.0.0 accesstransformers_version=10.0.1 -# TODO fix veresion -coremods_version=6.0.6 +coremods_version=7.0.3 eventbus_version=7.0.16 -modlauncher_version=10.0.9 +modlauncher_version=10.1.10 securejarhandler_version=2.1.23 bootstraplauncher_version=1.1.2 asm_version=9.5 diff --git a/loader/src/main/java/net/neoforged/fml/ModLoader.java b/loader/src/main/java/net/neoforged/fml/ModLoader.java index 2fdcb0212..b557725bf 100644 --- a/loader/src/main/java/net/neoforged/fml/ModLoader.java +++ b/loader/src/main/java/net/neoforged/fml/ModLoader.java @@ -114,7 +114,6 @@ private ModLoader() this.stateManager = new ModStateManager(); CrashReportCallables.registerCrashCallable("ModLauncher", FMLLoader::getLauncherInfo); CrashReportCallables.registerCrashCallable("ModLauncher launch target", FMLLoader::launcherHandlerName); - CrashReportCallables.registerCrashCallable("ModLauncher naming", FMLLoader::getNaming); CrashReportCallables.registerCrashCallable("ModLauncher services", this::computeModLauncherServiceList); CrashReportCallables.registerCrashCallable("FML Language Providers", this::computeLanguageList); } diff --git a/loader/src/main/java/net/neoforged/fml/core/ParallelTransition.java b/loader/src/main/java/net/neoforged/fml/core/ParallelTransition.java index bb9469c7e..076e618c8 100644 --- a/loader/src/main/java/net/neoforged/fml/core/ParallelTransition.java +++ b/loader/src/main/java/net/neoforged/fml/core/ParallelTransition.java @@ -5,7 +5,7 @@ package net.neoforged.fml.core; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import net.neoforged.fml.IModStateTransition; import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModLoadingStage; @@ -21,7 +21,7 @@ record ParallelTransition(ModLoadingStage stage, Class event) implements IModStateTransition { @Override public Supplier>> eventFunctionStream() { - return () -> Stream.of(IModStateTransition.EventGenerator.fromFunction(LamdbaExceptionUtils.rethrowFunction((ModContainer mc) -> event.getConstructor(ModContainer.class, ModLoadingStage.class).newInstance(mc, stage)))); + return () -> Stream.of(IModStateTransition.EventGenerator.fromFunction(LambdaExceptionUtils.rethrowFunction((ModContainer mc) -> event.getConstructor(ModContainer.class, ModLoadingStage.class).newInstance(mc, stage)))); } @Override diff --git a/loader/src/main/java/net/neoforged/fml/loading/FMLEnvironment.java b/loader/src/main/java/net/neoforged/fml/loading/FMLEnvironment.java index ee5725b3e..089567b9f 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/FMLEnvironment.java +++ b/loader/src/main/java/net/neoforged/fml/loading/FMLEnvironment.java @@ -15,12 +15,10 @@ public class FMLEnvironment { public static final Dist dist = FMLLoader.getDist(); - public static final String naming = FMLLoader.getNaming(); public static final boolean production = FMLLoader.isProduction() || System.getProperties().containsKey("production"); public static final boolean secureJarsEnabled = FMLLoader.isSecureJarEnabled(); static void setupInteropEnvironment(IEnvironment environment) { - environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), v->naming); environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), v->dist); } diff --git a/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java b/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java index 6eb48e82d..45093b1d8 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java +++ b/loader/src/main/java/net/neoforged/fml/loading/FMLLoader.java @@ -11,7 +11,7 @@ import cpw.mods.modlauncher.util.ServiceLoaderUtils; import net.neoforged.accesstransformer.api.AccessTransformerEngine; import net.neoforged.accesstransformer.ml.AccessTransformerService; -import net.neoforged.coremod.CoreModEngine; +import net.neoforged.coremod.CoreModScriptingEngine; import net.neoforged.fml.common.asm.RuntimeDistCleaner; import net.neoforged.fml.loading.mixin.DeferredMixinConfigRegistration; import net.neoforged.fml.loading.moddiscovery.BackgroundScanHandler; @@ -35,10 +35,9 @@ public class FMLLoader private static final Logger LOGGER = LogUtils.getLogger(); private static AccessTransformerEngine accessTransformer; private static ModDiscoverer modDiscoverer; - private static CoreModEngine coreModEngine; + private static CoreModScriptingEngine coreModEngine; private static LanguageLoadingProvider languageLoadingProvider; private static Dist dist; - private static String naming; private static LoadingModList loadingModList; private static RuntimeDistCleaner runtimeDistCleaner; private static Path gamePath; @@ -88,7 +87,7 @@ static void onInitialLoad(IEnvironment environment, Set otherServices) t }); LOGGER.debug(LogMarkers.CORE, "Found Runtime Dist Cleaner"); - coreModEngine = new CoreModEngine(); + coreModEngine = new CoreModScriptingEngine(); LOGGER.debug(LogMarkers.CORE, "FML found CoreMods version : {}", coreModEngine.getClass().getPackage().getImplementationVersion()); LOGGER.debug(LogMarkers.CORE, "Found ForgeSPI package implementation version {}", Environment.class.getPackage().getImplementationVersion()); @@ -126,7 +125,6 @@ static void setupLaunchHandler(final IEnvironment environment, final Map completeScan(IModuleLayerMan return List.of(modValidator.getModResources()); } - static CoreModEngine getCoreModEngine() { + static CoreModScriptingEngine getCoreModEngine() { return coreModEngine; } @@ -206,14 +204,6 @@ public static Path getGamePath() return gamePath; } - public static String getNaming() { - return naming; - } - - public static Optional> getNameFunction(final String naming) { - return Launcher.INSTANCE.environment().findNameMapping(naming); - } - public static String getLauncherInfo() { return Launcher.INSTANCE.environment().getProperty(IEnvironment.Keys.MLIMPL_VERSION.get()).orElse("MISSING"); } diff --git a/loader/src/main/java/net/neoforged/fml/loading/FMLServiceProvider.java b/loader/src/main/java/net/neoforged/fml/loading/FMLServiceProvider.java index 9ed97d0f2..5391667ba 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/FMLServiceProvider.java +++ b/loader/src/main/java/net/neoforged/fml/loading/FMLServiceProvider.java @@ -131,10 +131,10 @@ public void argumentValues(OptionResult option) } @Override - public @NotNull List transformers() + public @NotNull List> transformers() { LOGGER.debug(CORE, "Loading coremod transformers"); - return (List) FMLLoader.getCoreModEngine().initializeCoreMods(); + return FMLLoader.getCoreModEngine().initializeCoreMods(); } } diff --git a/loader/src/main/java/net/neoforged/fml/loading/LoadingModList.java b/loader/src/main/java/net/neoforged/fml/loading/LoadingModList.java index fd1245432..b118d717c 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/LoadingModList.java +++ b/loader/src/main/java/net/neoforged/fml/loading/LoadingModList.java @@ -5,7 +5,7 @@ package net.neoforged.fml.loading; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import net.neoforged.fml.loading.mixin.DeferredMixinConfigRegistration; import net.neoforged.fml.loading.moddiscovery.BackgroundScanHandler; import net.neoforged.fml.loading.moddiscovery.ModFile; @@ -151,7 +151,7 @@ private URL findNextURL() { final ModFileInfo next = modFileIterator.next(); final Path resource = next.getFile().findResource(resourceName); if (Files.exists(resource)) { - return LamdbaExceptionUtils.uncheck(()->new URL("modjar://" + next.getMods().get(0).getModId() + "/" + resourceName)); + return LambdaExceptionUtils.uncheck(()->new URL("modjar://" + next.getMods().get(0).getModId() + "/" + resourceName)); } } return null; diff --git a/loader/src/main/java/net/neoforged/fml/loading/MCPNamingService.java b/loader/src/main/java/net/neoforged/fml/loading/MCPNamingService.java deleted file mode 100644 index b10b54069..000000000 --- a/loader/src/main/java/net/neoforged/fml/loading/MCPNamingService.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.fml.loading; - -import com.mojang.logging.LogUtils; -import cpw.mods.modlauncher.api.INameMappingService; -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.function.BiConsumer; -import java.util.function.BiFunction; - -public class MCPNamingService implements INameMappingService { - private static final Logger LOGGER = LogUtils.getLogger(); - private HashMap methods; - private HashMap fields; - - @Override - public String mappingName() { - return "srgtomcp"; - } - - @Override - public String mappingVersion() { - return "1234"; //TODO: Minecraft Version? - } - - @Override - public Map.Entry understanding() { - return Pair.of("srg", "mcp"); - } - - @Override - public BiFunction namingFunction() { - return this::findMapping; - } - - private String findMapping(final Domain domain, final String srgName) { - switch (domain) { - case CLASS: - return srgName; - case FIELD: - return findFieldMapping(srgName); - case METHOD: - return findMethodMapping(srgName); - } - return srgName; - } - - private String findMethodMapping(final String origin) { - if (methods == null) { - HashMap tmpmethods = new HashMap<>(1000); - loadMappings("methods.csv", tmpmethods::put); - methods = tmpmethods; - LOGGER.debug(LogMarkers.CORE, "Loaded {} method mappings from methods.csv", methods.size()); - } - return methods.getOrDefault(origin, origin); - } - - private String findFieldMapping(final String origin) { - if (fields == null) { - HashMap tmpfields = new HashMap<>(1000); - loadMappings("fields.csv", tmpfields::put); - fields = tmpfields; - LOGGER.debug(LogMarkers.CORE, "Loaded {} field mappings from fields.csv", fields.size()); - } - return fields.getOrDefault(origin, origin); - } - - private static void loadMappings(final String mappingFileName, BiConsumer mapStore) { - URL path = ClassLoader.getSystemResource(mappingFileName); //We EXPLICITLY go through the SystemClassLoader here because this is dev-time only. And will be on the root classpath. - if (path == null) - return; - - try (BufferedReader reader = new BufferedReader(new InputStreamReader(path.openStream()))) { - reader.lines().skip(1).map(e -> e.split(",")).forEach(e -> mapStore.accept(e[0], e[1])); - } catch (IOException e1) { - LOGGER.error(LogMarkers.CORE, "Error reading mappings", e1); - } - } -} diff --git a/loader/src/main/java/net/neoforged/fml/loading/MixinSyntheticPackageProvider.java b/loader/src/main/java/net/neoforged/fml/loading/MixinSyntheticPackageProvider.java index ffdeeb740..b17f100df 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/MixinSyntheticPackageProvider.java +++ b/loader/src/main/java/net/neoforged/fml/loading/MixinSyntheticPackageProvider.java @@ -49,7 +49,7 @@ public List beginScanning(IEnvironment environment) { } @Override - public @NotNull List transformers() { + public @NotNull List> transformers() { return List.of(); } } diff --git a/loader/src/main/java/net/neoforged/fml/loading/ModDirTransformerDiscoverer.java b/loader/src/main/java/net/neoforged/fml/loading/ModDirTransformerDiscoverer.java index e5afd2afb..791824127 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/ModDirTransformerDiscoverer.java +++ b/loader/src/main/java/net/neoforged/fml/loading/ModDirTransformerDiscoverer.java @@ -6,7 +6,7 @@ package net.neoforged.fml.loading; import com.mojang.logging.LogUtils; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import cpw.mods.modlauncher.api.NamedPath; import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService; import org.slf4j.Logger; @@ -88,7 +88,7 @@ private static void scan(final Path gameDirectory) { private static boolean shouldLoadInServiceLayer(Path path) { if (!Files.isRegularFile(path)) return false; if (!path.toString().endsWith(".jar")) return false; - if (LamdbaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return false; + if (LambdaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return false; return TransformerDiscovererConstants.shouldLoadInServiceLayer(path); } diff --git a/loader/src/main/java/net/neoforged/fml/loading/ModJarURLHandler.java b/loader/src/main/java/net/neoforged/fml/loading/ModJarURLHandler.java index 7d9ddee65..114e87691 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/ModJarURLHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/ModJarURLHandler.java @@ -6,7 +6,7 @@ package net.neoforged.fml.loading; import com.mojang.logging.LogUtils; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import org.slf4j.Logger; import java.io.IOException; @@ -84,7 +84,7 @@ public long getContentLengthLong() { // Used to cache protectiondomains by "top level object" aka the modid @Override public URL getURL() { - return LamdbaExceptionUtils.uncheck(()->new URL("modjar://"+modid)); + return LambdaExceptionUtils.uncheck(()->new URL("modjar://"+modid)); } public Optional getManifest() { diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/CoreModFile.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/CoreModFile.java index e6775bb7e..727690c39 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/CoreModFile.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/CoreModFile.java @@ -5,14 +5,14 @@ package net.neoforged.fml.loading.moddiscovery; -import net.neoforged.coremod.ICoreModFile; +import net.neoforged.coremod.ICoreModScriptSource; import java.io.IOException; import java.io.Reader; import java.nio.file.Files; import java.nio.file.Path; -public class CoreModFile implements ICoreModFile { +public class CoreModFile implements ICoreModScriptSource { private final Path internalPath; private final ModFile file; private final String name; @@ -29,8 +29,8 @@ public Reader readCoreMod() throws IOException { } @Override - public Path getPath() { - return this.internalPath; + public String getDebugSource() { + return this.internalPath.toString(); } @Override @@ -45,6 +45,6 @@ public String getOwnerId() { @Override public String toString() { - return "{Name: " + name + ", Owner: " + getOwnerId() + " @ " + getPath() + "}"; + return "{Name: " + name + ", Owner: " + getOwnerId() + " @ " + getDebugSource() + "}"; } } diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/InvalidModIdentifier.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/InvalidModIdentifier.java index d028c25d2..6f45d1e19 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/InvalidModIdentifier.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/InvalidModIdentifier.java @@ -5,7 +5,7 @@ package net.neoforged.fml.loading.moddiscovery; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils.Supplier_WithExceptions; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import net.neoforged.fml.loading.StringUtils; import java.nio.file.Path; @@ -14,8 +14,6 @@ import java.util.function.BiPredicate; import java.util.zip.ZipFile; -import static cpw.mods.modlauncher.api.LamdbaExceptionUtils.*; - public enum InvalidModIdentifier { OLDFORGE(filePresent("mcmod.info")), @@ -39,12 +37,12 @@ private String getReason() public static Optional identifyJarProblem(Path path) { - Optional zfo = optionalFromException(() -> new ZipFile(path.toFile())); + Optional zfo = tryOpenFile(path); Optional result = Arrays.stream(values()). filter(i -> i.ident.test(path, zfo)). map(InvalidModIdentifier::getReason). findAny(); - zfo.ifPresent(rethrowConsumer(ZipFile::close)); + zfo.ifPresent(LambdaExceptionUtils.rethrowConsumer(ZipFile::close)); return result; } @@ -53,14 +51,10 @@ private static BiPredicate> filePresent(String filename) return (f, zfo) -> zfo.map(zf -> zf.getEntry(filename) != null).orElse(false); } - private static Optional optionalFromException(Supplier_WithExceptions supp) - { - try - { - return Optional.of(supp.get()); - } - catch (Exception e) - { + private static Optional tryOpenFile(Path path) { + try { + return Optional.of(new ZipFile(path.toFile())); + } catch (Exception ignored) { return Optional.empty(); } } diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java index a84b31f22..15944d890 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java @@ -105,7 +105,7 @@ public boolean identifyMods() { if (this.modFileInfo == null) return this.getType() != Type.MOD; LOGGER.debug(LogMarkers.LOADING,"Loading mod file {} with languages {}", this.getFilePath(), this.modFileInfo.requiredLanguageLoaders()); this.coreMods = ModFileParser.getCoreMods(this); - this.coreMods.forEach(mi-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {}", mi.getPath())); + this.coreMods.forEach(mi-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {}", mi.getDebugSource())); this.mixinConfigs = ModFileParser.getMixinConfigs(this.modFileInfo); this.mixinConfigs.forEach(mc -> LOGGER.debug(LogMarkers.LOADING,"Found mixin config {}", mc)); this.accessTransformers = ModFileParser.getAccessTransformers(this.modFileInfo) diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFileInfo.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFileInfo.java index 548cb3d88..0c283f317 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFileInfo.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFileInfo.java @@ -7,7 +7,7 @@ import com.google.common.base.Strings; import com.mojang.logging.LogUtils; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import net.neoforged.fml.loading.LogMarkers; import net.neoforged.fml.loading.StringUtils; import net.neoforged.neoforgespi.language.IConfigurable; @@ -173,8 +173,8 @@ public Optional getCodeSigningFingerprint() { return (signers == null ? Stream.of() : Arrays.stream(signers)) .flatMap(csa->csa.getSignerCertPath().getCertificates().stream()) .findFirst() - .map(LamdbaExceptionUtils.rethrowFunction(Certificate::getEncoded)) - .map(bytes->LamdbaExceptionUtils.uncheck(()->MessageDigest.getInstance("SHA-256")).digest(bytes)) + .map(LambdaExceptionUtils.rethrowFunction(Certificate::getEncoded)) + .map(bytes->LambdaExceptionUtils.uncheck(()->MessageDigest.getInstance("SHA-256")).digest(bytes)) .map(StringUtils::binToHex) .map(str-> String.join(":", str.split("(?<=\\G.{2})"))); } diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModsFolderLocator.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModsFolderLocator.java index 004f7af48..327da710e 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModsFolderLocator.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModsFolderLocator.java @@ -6,6 +6,7 @@ package net.neoforged.fml.loading.moddiscovery; import com.mojang.logging.LogUtils; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import net.neoforged.fml.loading.FMLPaths; import net.neoforged.fml.loading.LogMarkers; import net.neoforged.fml.loading.ModDirTransformerDiscoverer; @@ -18,8 +19,6 @@ import java.util.Map; import java.util.stream.Stream; -import static cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck; - /** * Support loading mods located in JAR files in the mods folder */ @@ -48,7 +47,7 @@ public Stream scanCandidates() { LOGGER.debug(LogMarkers.SCAN,"Scanning mods dir {} for mods", this.modFolder); var excluded = ModDirTransformerDiscoverer.allExcluded(); - return uncheck(()-> Files.list(this.modFolder)) + return LambdaExceptionUtils.uncheck(()-> Files.list(this.modFolder)) .filter(p-> !excluded.contains(p) && StringUtils.toLowerCase(p.getFileName().toString()).endsWith(SUFFIX)) .sorted(Comparator.comparing(path-> StringUtils.toLowerCase(path.getFileName().toString()))); } diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonClientLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonClientLaunchHandler.java index f59b95fa5..72f68044c 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonClientLaunchHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonClientLaunchHandler.java @@ -16,7 +16,7 @@ public abstract class CommonClientLaunchHandler extends CommonLaunchHandler { @Override public Dist getDist() { return Dist.CLIENT; } - @Override public String getNaming() { return "srg"; } + @Override public boolean isProduction() { return true; } @Override diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonDevLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonDevLaunchHandler.java index 47cf690fe..d2dfa1113 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonDevLaunchHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonDevLaunchHandler.java @@ -21,7 +21,6 @@ import java.util.stream.Stream; public abstract class CommonDevLaunchHandler extends CommonLaunchHandler { - @Override public String getNaming() { return "mcp"; } @Override public boolean isProduction() { return false; } @Override diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java index 4725f020e..af9dd5dab 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonLaunchHandler.java @@ -7,7 +7,6 @@ import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.ILaunchHandlerService; -import cpw.mods.modlauncher.api.ITransformingClassLoaderBuilder; import cpw.mods.modlauncher.api.ServiceRunner; import cpw.mods.niofs.union.UnionPathFilter; import net.neoforged.fml.loading.FMLLoader; @@ -39,8 +38,6 @@ public record LocatedPaths(List minecraftPaths, UnionPathFilter minecraftF public abstract Dist getDist(); - public abstract String getNaming(); - public boolean isProduction() { return false; } @@ -51,11 +48,6 @@ public boolean isData() { public abstract LocatedPaths getMinecraftPaths(); - @Override - public void configureTransformationClassLoader(final ITransformingClassLoaderBuilder builder) { - - } - protected String[] preLaunch(String[] arguments, ModuleLayer layer) { // In dev, do not overwrite the logging configuration if the user explicitly set another one. // In production, always overwrite the vanilla configuration. diff --git a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonServerLaunchHandler.java b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonServerLaunchHandler.java index b2fe86d00..8d9537acc 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/targets/CommonServerLaunchHandler.java +++ b/loader/src/main/java/net/neoforged/fml/loading/targets/CommonServerLaunchHandler.java @@ -18,7 +18,7 @@ public abstract class CommonServerLaunchHandler extends CommonLaunchHandler { @Override public Dist getDist() { return Dist.DEDICATED_SERVER; } - @Override public String getNaming() { return "srg"; } + @Override public boolean isProduction() { return true; } @Override diff --git a/loader/src/main/java/net/neoforged/fml/util/ObfuscationReflectionHelper.java b/loader/src/main/java/net/neoforged/fml/util/ObfuscationReflectionHelper.java index 152af4dc0..15b666735 100644 --- a/loader/src/main/java/net/neoforged/fml/util/ObfuscationReflectionHelper.java +++ b/loader/src/main/java/net/neoforged/fml/util/ObfuscationReflectionHelper.java @@ -9,7 +9,6 @@ import java.lang.reflect.Method; import java.util.StringJoiner; -import cpw.mods.modlauncher.api.INameMappingService; import net.neoforged.fml.loading.FMLLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -37,18 +36,6 @@ public class ObfuscationReflectionHelper private static final Logger LOGGER = LogManager.getLogger(); private static final Marker REFLECTION = MarkerManager.getMarker("REFLECTION"); - /** - * Remaps a name using the SRG naming function - * @param domain The {@link INameMappingService.Domain} to use to remap the name. - * @param name The name to try and remap. - * @return The remapped name, or the original name if it couldn't be remapped. - */ - @NotNull - public static String remapName(INameMappingService.Domain domain, String name) - { - return FMLLoader.getNameFunction("srg").map(f->f.apply(domain, name)).orElse(name); - } - /** * Gets the value a field with the specified name in the given class. * Note: For performance, use {@link #findField(Class, String)} if you are getting the value more than once. @@ -73,12 +60,12 @@ public static T getPrivateValue(Class classToAccess, E instanc } catch (UnableToFindFieldException e) { - LOGGER.error(REFLECTION,"Unable to locate field {} ({}) on type {}", fieldName, remapName(INameMappingService.Domain.FIELD, fieldName), classToAccess.getName(), e); + LOGGER.error(REFLECTION,"Unable to locate field {} ({}) on type {}", fieldName, fieldName, classToAccess.getName(), e); throw e; } catch (IllegalAccessException e) { - LOGGER.error(REFLECTION,"Unable to access field {} ({}) on type {}", fieldName, remapName(INameMappingService.Domain.FIELD, fieldName), classToAccess.getName(), e); + LOGGER.error(REFLECTION,"Unable to access field {} ({}) on type {}", fieldName, fieldName, classToAccess.getName(), e); throw new UnableToAccessFieldException(e); } } @@ -142,7 +129,7 @@ public static Method findMethod(@NotNull final Class clazz, @NotNull final St try { - Method m = clazz.getDeclaredMethod(remapName(INameMappingService.Domain.METHOD, methodName), parameterTypes); + Method m = clazz.getDeclaredMethod(methodName, parameterTypes); m.setAccessible(true); return m; } @@ -218,7 +205,7 @@ public static Field findField(@NotNull final Class clazz, @NotNul try { - Field f = clazz.getDeclaredField(remapName(INameMappingService.Domain.FIELD, fieldName)); + Field f = clazz.getDeclaredField(fieldName); f.setAccessible(true); return f; }