Fix mod mixins not being disabled if there is an early load error

This commit is contained in:
embeddedt 2023-07-23 18:32:50 -04:00
parent 4cdf5e6b3d
commit 2246b79a85
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
4 changed files with 8 additions and 1 deletions

View File

@ -41,6 +41,8 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
if (option.isUserDefined()) {
source = "user configuration";
} else if (!ModernFixPlatformHooks.isLoadingNormally()) {
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(modPresent(id)) {
if(!ModernFixPlatformHooks.isLoadingNormally() || modPresent(id)) {
Option option = this.options.get(configName);
if(option != null)
option.addModOverride(false, id);

View File

@ -26,6 +26,7 @@ import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.Property;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.api.entrypoint.ModernFixClientIntegration;
import org.embeddedt.modernfix.platform.ModernFixPlatformHooks;
import java.io.IOException;
import java.io.InputStream;
@ -116,6 +117,8 @@ public class ModelBakeryHelpers {
Set<ResourceLocation> modelFiles, UnbakedModel missingModel,
Function<JsonElement, BlockModel> modelDeserializer,
Function<ResourceLocation, UnbakedModel> bakeryModelGetter) {
if(!ModernFixPlatformHooks.isLoadingNormally())
return;
Stopwatch stopwatch = Stopwatch.createStarted();
final Object2IntOpenHashMap<String> blockstateErrors = new Object2IntOpenHashMap<>();
/*

View File

@ -86,6 +86,8 @@ public class ModernFixPlatformHooksImpl {
}
public static boolean isLoadingNormally() {
if(!LoadingModList.get().getErrors().isEmpty())
return false;
return ModLoader.isLoadingStateValid();
}