Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 1.20.4 使用自动安装同时下载 OptiFine 与 Forge 会导致兼容性问题 #2975

Open
burningtnt opened this issue Apr 6, 2024 · 13 comments · May be fixed by #3023
Open

[Bug] 1.20.4 使用自动安装同时下载 OptiFine 与 Forge 会导致兼容性问题 #2975

burningtnt opened this issue Apr 6, 2024 · 13 comments · May be fixed by #3023
Labels

Comments

@burningtnt
Copy link
Member

burningtnt commented Apr 6, 2024

问题 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 标识的类

@zkitefly
Copy link
Member

zkitefly commented Apr 6, 2024

目前我们讨论有两种方案(@burningtnt

  1. 在安装 OptiFine 前,将 META-INF\mod.toml 删除,然后再安装(或者安装完会后将 libraries 的 OptiFine installer.jar 的 META-INF\mod.toml 删除)
  2. 打一个 javaagent 进去强行让 ClasspathLocator 禁用
  3. 打一个类进入 OptiFine 的 JAR,标上 @Mod("optifine")

还在继续讨论中...

@zkitefly
Copy link
Member

zkitefly commented Apr 6, 2024

目前待定的方案是:

当 Minecraft 版本 >=1.20.4 时,在安装完 OptiFine 步骤后,将 libraries 的 optifine installer.jar 的 META-INF/mod.toml 删除

@wuliaodexiaoluo
Copy link

BCMLAPI 下下来的 OptiFine 根本就不标准,直接删掉会爆炸的。。。

@zkitefly
Copy link
Member

BCMLAPI 下下来的 OptiFine 根本就不标准,直接删掉会爆炸的。。。

什么不标准?

@wuliaodexiaoluo
Copy link

就,PCL 下的 OptiFine 删掉 mods.toml 加载不了
官网下的删掉就完全没问题。。。

@hejiehao
Copy link
Contributor

就,PCL 下的 OptiFine 删掉 mods.toml 加载不了 官网下的删掉就完全没问题。。。

对比一下?

@3gf8jv4dv

This comment was marked as off-topic.

@burningtnt
Copy link
Member Author

(THis is the issue of HMCL.)

The OptiFine downloaded by HMCL '自动安装' works same as installed with OptiFine Installer.

@3gf8jv4dv
Copy link
Contributor

(THis is the issue of HMCL.)

The OptiFine downloaded by HMCL '自动安装' works same as installed with OptiFine Installer.

Whoops, sorry. And I understand.

@burningtnt
Copy link
Member Author

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.

@burningtnt
Copy link
Member Author

结束,那就是 PCL2 实现的有问题

PS:喂这是 HMCL 的 Issue 啊,不是 MCLF-CN 之类的公共讨论区啊

@wuliaodexiaoluo
Copy link

手动安装没有问题
但是自动补全大小不对。。。只有 6.5M

@zkitefly
Copy link
Member

zkitefly commented Apr 20, 2024

经过一些测试得出,

使用 OptiFine Jar Install 方法的启动器(如 PCL )无法使用 1 号方法

在安装 OptiFine 前,将 META-INF\mod.toml 删除,然后再安装(或者安装完会后将 libraries 的 OptiFine installer.jar 的 META-INF\mod.toml 删除)

测试步骤

  1. 安装 1.20.4 原版
  2. 下载 OptiFine Jar
  3. 打开 Jar 并选择安装
  4. 回到 HMCL,到 自动安装 页面安装 Forge
  5. 按照 1 号方法去除文件(测试路径 .minecraft/libraries/optifine/OptiFine/1.20.4_HD_U_I8_pre4 和 PCL 相似)
  6. 启动游戏,启动失败

而使用 HMCL 自动安装安装出来的 OptiFine 然后按照 1 号方法却是正常的

补充:PCL 用 OptiFine Jar 的 Install 方法,然后单独安装 Forge,最后将 client json 合并

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants