Skip to content

Commit b5a3b8a

Browse files
feat: allow enabling runtime md remapping using system properties
1 parent 42c5164 commit b5a3b8a

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

src/main/java/net/fabricmc/loader/impl/FabricLoaderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void load() {
207207
}
208208

209209
private void setup() throws ModResolutionException {
210-
boolean remapRegularMods = isDevelopmentEnvironment();
210+
boolean remapRegularMods = FabricLauncherBase.getLauncher().isRemapMods();
211211
VersionOverrides versionOverrides = new VersionOverrides();
212212
DependencyOverrides depOverrides = new DependencyOverrides(configDir);
213213

src/main/java/net/fabricmc/loader/impl/launch/FabricLauncher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public interface FabricLauncher {
5757

5858
boolean isDevelopment();
5959

60+
boolean isRemapMods();
61+
6062
String getEntrypoint();
6163

6264
String getDefaultRuntimeNamespace();

src/main/java/net/fabricmc/loader/impl/launch/FabricLauncherBase.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ public final boolean isDevelopment() {
5454
return IS_DEVELOPMENT;
5555
}
5656

57+
@Override
58+
public final boolean isRemapMods() {
59+
String ret = System.getProperty(SystemProperties.REMAP_MODS);
60+
if (ret != null) return SystemProperties.isSet(SystemProperties.REMAP_MODS);
61+
62+
return IS_DEVELOPMENT;
63+
}
64+
5765
@Override
5866
public MappingConfiguration getMappingConfiguration() {
5967
return mappingConfiguration;

src/main/java/net/fabricmc/loader/impl/launch/FabricMixinBootstrap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static void init(EnvType side, FabricLoaderImpl loader) {
6060

6161
MixinBootstrap.init();
6262

63-
if (FabricLauncherBase.getLauncher().isDevelopment()) {
63+
if (FabricLauncherBase.getLauncher().isRemapMods()) {
6464
MappingConfiguration mappingConfiguration = FabricLauncherBase.getLauncher().getMappingConfiguration();
6565
MappingTree mappings = mappingConfiguration.getMappings();
6666
final String modNs = MappingConfiguration.INTERMEDIARY_NAMESPACE;
@@ -76,9 +76,9 @@ public static void init(EnvType side, FabricLoaderImpl loader) {
7676
try {
7777
MixinIntermediaryDevRemapper remapper = new MixinIntermediaryDevRemapper(mappings, modNs, runtimeNs);
7878
MixinEnvironment.getDefaultEnvironment().getRemappers().add(remapper);
79-
Log.info(LogCategory.MIXIN, "Loaded Fabric development mappings for mixin remapper!");
79+
Log.info(LogCategory.MIXIN, "Loaded Fabric refmap remapping mappings for mixin remapper!");
8080
} catch (Exception e) {
81-
Log.error(LogCategory.MIXIN, "Fabric development environment setup error - the game will probably crash soon!", e);
81+
Log.error(LogCategory.MIXIN, "Fabric refmap remapping setup error - the game will probably crash soon!", e);
8282
}
8383
}
8484
}

src/main/java/net/fabricmc/loader/impl/util/SystemProperties.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public final class SystemProperties {
2828
public static final String GAME_MAPPING_NAMESPACE = "fabric.gameMappingNamespace";
2929
// mapping namespace to use at runtime, defaults to named if DEVELOPMENT is set or intermediary otherwise
3030
public static final String RUNTIME_MAPPING_NAMESPACE = "fabric.runtimeMappingNamespace";
31+
// remaps mods to the runtime mapping namespace, defaults to true if DEVELOPMENT is set or false otherwise
32+
public static final String REMAP_MODS = "fabric.remapMods";
3133
// skips the embedded MC game provider, letting ServiceLoader-provided ones take over
3234
public static final String SKIP_MC_PROVIDER = "fabric.skipMcProvider";
3335
// game jar paths for common/client/server, replaces lookup from class path if present, env specific takes precedence

0 commit comments

Comments
 (0)