Add Opticrash detection
This commit is contained in:
parent
e771af2330
commit
e46910f3c1
|
|
@ -53,6 +53,9 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
|||
this.logger.info("Loaded configuration file for ModernFix: {} options available, {} override(s) found",
|
||||
config.getOptionCount(), config.getOptionOverrideCount());
|
||||
|
||||
if(ModernFixEarlyConfig.OPTIFINE_PRESENT)
|
||||
this.logger.fatal("OptiFine detected. Use of ModernFix with OptiFine is not supported due to its impact on launch time and breakage of Forge features.");
|
||||
|
||||
try {
|
||||
Class.forName("sun.misc.Unsafe").getDeclaredMethod("defineAnonymousClass", Class.class, byte[].class, Object[].class);
|
||||
} catch(ReflectiveOperationException | NullPointerException e) {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,23 @@ public class ModernFixEarlyConfig {
|
|||
|
||||
private final Map<String, Option> options = new HashMap<>();
|
||||
|
||||
public static final boolean OPTIFINE_PRESENT;
|
||||
|
||||
static {
|
||||
boolean hasOfClass = false;
|
||||
try {
|
||||
Class.forName("optifine.OptiFineTransformationService");
|
||||
hasOfClass = true;
|
||||
} catch(Throwable e) {
|
||||
}
|
||||
OPTIFINE_PRESENT = hasOfClass;
|
||||
}
|
||||
|
||||
private static boolean modPresent(String modId) {
|
||||
return FMLLoader.getLoadingModList().getModFileById(modId) != null;
|
||||
if(modId.equals("optifine"))
|
||||
return OPTIFINE_PRESENT;
|
||||
else
|
||||
return FMLLoader.getLoadingModList().getModFileById(modId) != null;
|
||||
}
|
||||
|
||||
private ModernFixEarlyConfig() {
|
||||
|
|
@ -87,11 +102,12 @@ public class ModernFixEarlyConfig {
|
|||
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge");
|
||||
disableIfModPresent("mixin.bugfix.mc218112", "performant");
|
||||
disableIfModPresent("mixin.perf.reuse_datapacks", "tac");
|
||||
disableIfModPresent("mixin.launch.class_search_cache", "optifine");
|
||||
}
|
||||
|
||||
private void disableIfModPresent(String configName, String... ids) {
|
||||
for(String id : ids) {
|
||||
if(FMLLoader.getLoadingModList().getModFileById(id) != null) {
|
||||
if(modPresent(id)) {
|
||||
Option option = this.options.get(configName);
|
||||
if(option != null)
|
||||
option.addModOverride(false, id);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class WindowMixin {
|
|||
* Grab the original width/height from the window and inject them into our state variables.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/loading/progress/EarlyProgressVisualization;handOffWindow(Ljava/util/function/IntSupplier;Ljava/util/function/IntSupplier;Ljava/util/function/Supplier;Ljava/util/function/LongSupplier;)J"))
|
||||
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/loading/progress/EarlyProgressVisualization;handOffWindow(Ljava/util/function/IntSupplier;Ljava/util/function/IntSupplier;Ljava/util/function/Supplier;Ljava/util/function/LongSupplier;)J"), require = 0)
|
||||
private long performHandoff(EarlyProgressVisualization instance, IntSupplier width, IntSupplier height, Supplier<String> title, LongSupplier monitor) {
|
||||
Object visualizer = getEarlyProgressVisualizer();
|
||||
if(visualizer != null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user