|
24 | 24 |
|
25 | 25 | public class EssentialTransformationService implements ITransformationService { |
26 | 26 | private static final Logger LOGGER = LogManager.getLogger(EssentialTransformationService.class); |
27 | | - private static final Map<String, String> COMPATIBILITY_IMPLEMENTATIONS = Map.of( |
| 27 | + private static final Map<String, String> ML_COMPATIBILITY_IMPLEMENTATIONS = Map.of( |
28 | 28 | "11.", "ML11CompatibilityLayer", |
29 | 29 | "10.", "ML10CompatibilityLayer", |
30 | 30 | "9.", "ML9CompatibilityLayer" |
31 | 31 | ); |
| 32 | + // NeoForge as of 1.21.7 has merged ModLauncher into FancyModLoader and reports the version of that instead of |
| 33 | + // ModLauncher. |
| 34 | + private static final Map<String, String> FMLML_COMPATIBILITY_IMPLEMENTATIONS = Map.of( |
| 35 | + "9.", "ML11CompatibilityLayer" |
| 36 | + ); |
32 | 37 | private static CompatibilityLayer compatibilityLayer; |
33 | 38 |
|
34 | 39 | private final Path gameDir; |
@@ -82,7 +87,13 @@ public void initialize(IEnvironment environment) { |
82 | 87 | @SuppressWarnings("unchecked") |
83 | 88 | private CompatibilityLayer findCompatibilityLayerImpl(String mlVersion) { |
84 | 89 | String implementation = null; |
85 | | - for (Map.Entry<String, String> entry : COMPATIBILITY_IMPLEMENTATIONS.entrySet()) { |
| 90 | + Map<String, String> impls; |
| 91 | + if ("fml_loader".equals(ITransformationService.class.getModule().getName())) { |
| 92 | + impls = FMLML_COMPATIBILITY_IMPLEMENTATIONS; |
| 93 | + } else { |
| 94 | + impls = ML_COMPATIBILITY_IMPLEMENTATIONS; |
| 95 | + } |
| 96 | + for (Map.Entry<String, String> entry : impls.entrySet()) { |
86 | 97 | if (mlVersion.startsWith(entry.getKey())) { |
87 | 98 | implementation = entry.getValue(); |
88 | 99 | break; |
|
0 commit comments