Fix dragging in ModLoader too early

This commit is contained in:
embeddedt 2023-07-23 19:21:00 -04:00
parent 2246b79a85
commit 7fa6c45f07
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
5 changed files with 16 additions and 5 deletions

View File

@ -41,7 +41,7 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
if (option.isUserDefined()) {
source = "user configuration";
} else if (!ModernFixPlatformHooks.isLoadingNormally()) {
} else if (!ModernFixPlatformHooks.isEarlyLoadingNormally()) {
source = "load error";
} else if (option.isModDefined()) {
source = "mods [" + String.join(", ", option.getDefiningMods()) + "]";

View File

@ -245,7 +245,7 @@ public class ModernFixEarlyConfig {
private void disableIfModPresent(String configName, String... ids) {
for(String id : ids) {
if(!ModernFixPlatformHooks.isLoadingNormally() || modPresent(id)) {
if(!ModernFixPlatformHooks.isEarlyLoadingNormally() || modPresent(id)) {
Option option = this.options.get(configName);
if(option != null)
option.addModOverride(false, id);

View File

@ -57,6 +57,11 @@ public class ModernFixPlatformHooks {
throw new AssertionError();
}
@ExpectPlatform
public static boolean isEarlyLoadingNormally() {
throw new AssertionError();
}
@ExpectPlatform
public static boolean isLoadingNormally() {
throw new AssertionError();

View File

@ -59,6 +59,10 @@ public class ModernFixPlatformHooksImpl {
return ModernFixFabric.theServer.get();
}
public static boolean isEarlyLoadingNormally() {
return true;
}
public static boolean isLoadingNormally() {
return true;
}

View File

@ -85,10 +85,12 @@ public class ModernFixPlatformHooksImpl {
return ServerLifecycleHooks.getCurrentServer();
}
public static boolean isEarlyLoadingNormally() {
return LoadingModList.get().getErrors().isEmpty();
}
public static boolean isLoadingNormally() {
if(!LoadingModList.get().getErrors().isEmpty())
return false;
return ModLoader.isLoadingStateValid();
return isEarlyLoadingNormally() && ModLoader.isLoadingStateValid();
}