Merge 1.19.4 into 1.20

This commit is contained in:
embeddedt 2023-07-05 14:50:28 -04:00
commit 2a16229056
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
3 changed files with 21 additions and 5 deletions

View File

@ -162,6 +162,7 @@ public class ModernFixEarlyConfig {
.put("mixin.perf.faster_item_rendering", false)
.put("mixin.feature.spam_thread_dump", false)
.put("mixin.feature.snapshot_easter_egg", true)
.put("mixin.feature.warn_missing_perf_mods", true)
.put("mixin.feature.spark_profile_launch", false)
.put("mixin.devenv", isDevEnv)
.put("mixin.perf.remove_spawn_chunks", isDevEnv)

View File

@ -3,6 +3,8 @@
"key.modernfix.config": "Open config screen",
"modernfix.jei_load": "Loading JEI, this may take a while",
"modernfix.no_lazydfu": "LazyDFU is not installed. If Minecraft needs to update game data from an older version, there may be noticeable lag.",
"modernfix.no_ferritecore": "FerriteCore is not installed. Memory usage will be very high.",
"modernfix.perf_mod_warning": "It is recommended to install the mods, but the warning(s) can be disabled in the ModernFix config.",
"modernfix.config": "ModernFix mixin config",
"modernfix.config.done_restart": "Done (restart required)",
"modernfix.option.on": "on",

View File

@ -1,5 +1,6 @@
package org.embeddedt.modernfix.forge.init;
import com.google.common.collect.ImmutableList;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraftforge.api.distmarker.Dist;
@ -19,6 +20,7 @@ import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegisterEvent;
import net.minecraftforge.server.ServerLifecycleHooks;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
import org.embeddedt.modernfix.forge.classloading.ClassLoadHack;
import org.embeddedt.modernfix.forge.classloading.ModFileScanDataDeduplicator;
import org.embeddedt.modernfix.forge.ModernFixConfig;
@ -27,6 +29,8 @@ import org.embeddedt.modernfix.forge.config.ConfigFixer;
import org.embeddedt.modernfix.forge.packet.PacketHandler;
import org.embeddedt.modernfix.forge.registry.ObjectHolderClearer;
import java.util.List;
@Mod(ModernFix.MODID)
public class ModernFixForge {
private static ModernFix commonMod;
@ -66,15 +70,24 @@ public class ModernFixForge {
}
}
private static boolean dfuModPresent() {
return true; /* new DFU isn't worth warning about */
}
private static final List<Pair<List<String>, String>> MOD_WARNINGS = ImmutableList.of(
Pair.of(ImmutableList.of("ferritecore"), "modernfix.no_ferritecore")
);
@SubscribeEvent
public void commonSetup(FMLCommonSetupEvent event) {
if(!dfuModPresent()) {
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.warn_missing_perf_mods.Warnings")) {
event.enqueueWork(() -> {
ModLoader.get().addWarning(new ModLoadingWarning(ModLoadingContext.get().getActiveContainer().getModInfo(), ModLoadingStage.COMMON_SETUP, "modernfix.no_lazydfu"));
boolean atLeastOneWarning = false;
for(Pair<List<String>, String> warning : MOD_WARNINGS) {
boolean isPresent = !FMLLoader.isProduction() || warning.getLeft().stream().anyMatch(name -> ModList.get().isLoaded(name));
if(!isPresent) {
atLeastOneWarning = true;
ModLoader.get().addWarning(new ModLoadingWarning(ModLoadingContext.get().getActiveContainer().getModInfo(), ModLoadingStage.COMMON_SETUP, warning.getRight()));
}
}
if(atLeastOneWarning)
ModLoader.get().addWarning(new ModLoadingWarning(ModLoadingContext.get().getActiveContainer().getModInfo(), ModLoadingStage.COMMON_SETUP, "modernfix.perf_mod_warning"));
});
}
ObjectHolderClearer.clearThrowables();