Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void load() {
}

private void setup() throws ModResolutionException {
boolean remapRegularMods = isDevelopmentEnvironment();
boolean remapRegularMods = FabricLauncherBase.getLauncher().isRemapMods();
VersionOverrides versionOverrides = new VersionOverrides();
DependencyOverrides depOverrides = new DependencyOverrides(configDir);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,17 @@ public static final class FindResult {
private static boolean emittedInfo = false;

public static Map<String, Path> deobfuscate(Map<String, Path> inputFileMap, String sourceNamespace, String gameId, String gameVersion, Path gameDir, FabricLauncher launcher) {
Log.debug(LogCategory.GAME_REMAP, "Requesting deobfuscation of %s", inputFileMap);
return deobfuscate(inputFileMap, sourceNamespace, launcher.getMappingConfiguration().getRuntimeNamespace(), gameId, gameVersion, gameDir, launcher);
}

MappingConfiguration mappingConfig = launcher.getMappingConfiguration();
String targetNamespace = mappingConfig.getRuntimeNamespace();
public static Map<String, Path> deobfuscate(Map<String, Path> inputFileMap, String sourceNamespace, String targetNamespace, String gameId, String gameVersion, Path gameDir, FabricLauncher launcher) {
Log.debug(LogCategory.GAME_REMAP, "Requesting deobfuscation of %s", inputFileMap);

if (sourceNamespace.equals(targetNamespace)) {
return inputFileMap;
}

MappingConfiguration mappingConfig = launcher.getMappingConfiguration();
if (!mappingConfig.matches(gameId, gameVersion)) {
String mappingsGameId = mappingConfig.getGameId();
String mappingsGameVersion = mappingConfig.getGameVersion();
Expand All @@ -180,9 +182,7 @@ public static Map<String, Path> deobfuscate(Map<String, Path> inputFileMap, Stri

List<String> namespaces = mappingConfig.getNamespaces();

if (namespaces == null
|| !namespaces.contains(sourceNamespace)
|| !namespaces.contains(targetNamespace)) {
if (namespaces == null) {
Log.debug(LogCategory.GAME_REMAP, "No mappings, using input files");
return inputFileMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public interface FabricLauncher {

boolean isDevelopment();

boolean isRemapMods();

String getEntrypoint();

String getDefaultRuntimeNamespace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ public final boolean isDevelopment() {
return IS_DEVELOPMENT;
}

@Override
public final boolean isRemapMods() {
String ret = System.getProperty(SystemProperties.REMAP_MODS);
if (ret != null) return SystemProperties.isSet(SystemProperties.REMAP_MODS);

return IS_DEVELOPMENT;
}

@Override
public MappingConfiguration getMappingConfiguration() {
return mappingConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void init(EnvType side, FabricLoaderImpl loader) {

MixinBootstrap.init();

if (FabricLauncherBase.getLauncher().isDevelopment()) {
if (FabricLauncherBase.getLauncher().isRemapMods()) {
MappingConfiguration mappingConfiguration = FabricLauncherBase.getLauncher().getMappingConfiguration();
MappingTree mappings = mappingConfiguration.getMappings();
final String modNs = MappingConfiguration.INTERMEDIARY_NAMESPACE;
Expand All @@ -76,9 +76,9 @@ public static void init(EnvType side, FabricLoaderImpl loader) {
try {
MixinIntermediaryDevRemapper remapper = new MixinIntermediaryDevRemapper(mappings, modNs, runtimeNs);
MixinEnvironment.getDefaultEnvironment().getRemappers().add(remapper);
Log.info(LogCategory.MIXIN, "Loaded Fabric development mappings for mixin remapper!");
Log.info(LogCategory.MIXIN, "Loaded Fabric mappings for mixin remapper!");
} catch (Exception e) {
Log.error(LogCategory.MIXIN, "Fabric development environment setup error - the game will probably crash soon!", e);
Log.error(LogCategory.MIXIN, "Fabric mixin remapper setup error - the game will probably crash soon!", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public final class SystemProperties {
public static final String GAME_MAPPING_NAMESPACE = "fabric.gameMappingNamespace";
// mapping namespace to use at runtime, defaults to named if DEVELOPMENT is set or intermediary otherwise
public static final String RUNTIME_MAPPING_NAMESPACE = "fabric.runtimeMappingNamespace";
// remaps mods to the runtime mapping namespace, defaults to true if DEVELOPMENT is set or false otherwise
public static final String REMAP_MODS = "fabric.remapMods";
// skips the embedded MC game provider, letting ServiceLoader-provided ones take over
public static final String SKIP_MC_PROVIDER = "fabric.skipMcProvider";
// game jar paths for common/client/server, replaces lookup from class path if present, env specific takes precedence
Expand Down