[Bug] 1.20.4 使用自动安装同时下载 OptiFine 与 Forge 会导致兼容性问题
问题 1:自动安装无法在已经有 Forge 的情况下安装 OptiFine
1.20.4 Forge 主类变为了 net.minecraftforge.bootstrap.ForgeBootstrap,需要加入白名单
问题 2:自动安装同时下载 OptiFine 与 Forge 会导致兼容性问题
1.20.4 Forge 的 ClasspathLocator 不再受到环境的限制。它曾今在非开发环境是被禁用的,但现在在任何环境均会启用 https://github.com/MinecraftForge/MinecraftForge/blob/1.20.1/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java#L41-L42 https://github.com/MinecraftForge/MinecraftForge/blob/1.20.x/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java#L40 导致 OptiFine 在模组文件夹下时,因其带有 ITransformationService 的实现不被加载为普通模组 但放置在 classpath 内时,不会有上述逻辑而被直接加载为普通模组,但其实内部根本没有 @ Mod 标识的类
目前我们讨论有两种方案(@burningtnt)
- 在安装 OptiFine 前,将 META-INF\mod.toml 删除,然后再安装(或者安装完会后将 libraries 的 OptiFine installer.jar 的 META-INF\mod.toml 删除)
- 打一个 javaagent 进去强行让 ClasspathLocator 禁用
- 打一个类进入 OptiFine 的 JAR,标上
@Mod("optifine")
还在继续讨论中...
目前待定的方案是:
当 Minecraft 版本 >=1.20.4 时,在安装完 OptiFine 步骤后,将 libraries 的 optifine installer.jar 的 META-INF/mod.toml 删除
BCMLAPI 下下来的 OptiFine 根本就不标准,直接删掉会爆炸的。。。
BCMLAPI 下下来的 OptiFine 根本就不标准,直接删掉会爆炸的。。。
什么不标准?
就,PCL 下的 OptiFine 删掉 mods.toml 加载不了 官网下的删掉就完全没问题。。。
就,PCL 下的 OptiFine 删掉 mods.toml 加载不了 官网下的删掉就完全没问题。。。
对比一下?
就,PCL 下的 OptiFine 删掉 mods.toml 加载不了 官网下的删掉就完全没问题。。。
Are you talking about installing OptiFine from 自动安装? It is different from the OptiFine downloaded from the official OptiFine website or from the PCL2 手动安装包. When selecting both OptiFine and Forge, the OptiFine jar installed from 自动安装 is missing the patch folder, and some other files.
Edit: When only Minecraft and OptiFine are installed, the file contents are different from when Forge and OptiFine are installed at the same time.
Edit: I read https://github.com/Hex-Dragon/PCL2/discussions/3678 carefully and tested further. When I use HMCL to execute the same process as zkitefly, I get consistent results; but when I use PCL2 to execute the same process as allMagicNB, the results are consistent with wuliaodexiaoluo. It seems that HMCL actually uses the complete file OptiFine-1.20.4_HD_U_I8_pre4-installer.jar. After deleting the mods.toml in it, the game can be launched smoothly. PCL2 only generated an OptiFine-1.20.4_HD_U_I8_pre4.jar file with slightly changed content. After deleting the mods.toml in it, the game window appeared for about one second and then disappeared. If I am wrong, please point it out.
(THis is the issue of HMCL.)
The OptiFine downloaded by HMCL '自动安装' works same as installed with OptiFine Installer.
(THis is the issue of HMCL.)
The OptiFine downloaded by HMCL '自动安装' works same as installed with OptiFine Installer.
Whoops, sorry. And I understand.
It seems that HMCL actually uses the complete file OptiFine-1.20.4_HD_U_I8_pre4-installer.jar. After deleting the mods.toml in it, the game can be launched smoothly. PCL2 only generated an OptiFine-1.20.4_HD_U_I8_pre4.jar file with slightly changed content. After deleting the mods.toml in it, the game window appeared for about one second and then disappeared. If I am wrong, please point it out.
You are right. That's what PCL2 should do, not HMCL.
结束,那就是 PCL2 实现的有问题
PS:喂这是 HMCL 的 Issue 啊,不是 MCLF-CN 之类的公共讨论区啊
手动安装没有问题 但是自动补全大小不对。。。只有 6.5M
经过一些测试得出,
使用 OptiFine Jar Install 方法的启动器(如 PCL )无法使用 1 号方法
在安装 OptiFine 前,将 META-INF\mod.toml 删除,然后再安装(或者安装完会后将 libraries 的 OptiFine installer.jar 的 META-INF\mod.toml 删除)
测试步骤
- 安装 1.20.4 原版
- 下载 OptiFine Jar
- 打开 Jar 并选择安装
- 回到 HMCL,到 自动安装 页面安装 Forge
- 按照 1 号方法去除文件(测试路径
.minecraft/libraries/optifine/OptiFine/1.20.4_HD_U_I8_pre4和 PCL 相似) - 启动游戏,启动失败
而使用 HMCL 自动安装安装出来的 OptiFine 然后按照 1 号方法却是正常的
补充:PCL 用 OptiFine Jar 的 Install 方法,然后单独安装 Forge,最后将 client json 合并