LWJGL3ify
将 LWJGL3 和现代 Java 版本引入 Minecraft 1.7.10。捆绑了 RetroFuturaBootstrap 作为灵活的早期加载插件系统。
使用方法:只需确保主 jar 文件位于 mods/ 目录中,并按常规配置使用 Java 8 启动即可。在启动时,应会出现一个窗口,提示你选择一个现代 Java 版本以重新启动,并配置该 Java 安装的 JVM 设置。如果未出现此类窗口,请从你偏好的供应商处下载并安装现代 Java 版本,目前推荐使用的版本为 Java 17 和 21。
兼容性
尽管该模组力求实现最大程度的兼容,但仍会有一些模组目前无法与 lwjgl3ify 配合使用。请检查我们的问题追踪器(issue tracker)是否已列出相关问题;若未列出,请提交一个新的 issue,附上崩溃报告(如有)、游戏日志以及关于具体无法正常运作部分的说明。
调整配置
如果你想调整窗口选项、原始鼠标输入、OpenGL 上下文属性或其他更高级的设置,请在首次启动后查看 config/lwjgl3ify.cfg 中的配置文件,或在游戏内访问 lwjgl3ify Mod Options。
服务器安装
首先,通过整合包 zip 文件或 Forge 安装程序安装一个正常工作的 Forge 服务器。然后,将模组 jar 文件(以及按需的 unimixins、hodgepodge 和 gtnhlib)放入 mods/ 目录,并下载 forgePatches jar 文件。将 forgePatches jar 文件放置在与你的 forge-universal 和 minecraft server jar 文件相同的文件夹中。不支持 Thermos/Crucible/Hybrid 服务器!Lwjgl3ify 还依赖于 Unimixins。将 forgePatches jar 重命名为 lwjgl3ify-forgePatches.jar。从此模组的源代码中获取 java9args.txt 文件。现在你可以使用如下命令启动服务器(假设 PATH 中的第一个 java 可执行文件是 java 17/21 或更高版本):
java -Xmx6G -Xms6G @java9args.txt -jar lwjgl3ify-forgePatches.jar nogui
它是如何工作的?(非常技术性的细节)
在旧版 Minecraft 版本上启用现代 Java 和 LWJGL 涉及几个组件,lwjgl3ify 专门实现了以下部分:
- 一个游戏重新启动器,用于修改加载到 Java 类路径中的库列表——以安装 LWJGL3 以及我们包含 ASM 9 或新版 Apache Commons 等库的 forgePatches jar。
- 一个自定义服务器启动器 jar,其中包含经过修改的
Class-PathMETA-INF 清单条目(已集成到我们提供的 forgePatches jar 中)。 - 一个自由开源的 launchwrapper 替代品,具备 Java 9+ 兼容的类路径发现机制和更广泛的转换器能力,详见 。
- 大量用于 JVM 的 add-opens 标志,以允许对 JVM 内部进行反射操作。遗憾的是,许多库和模组依赖于此才能正常运行,甚至包括像 Netty 这样奇怪的库(例如
java.text或 nio 内部实现)。 - 一个部分自动生成的兼容性垫片,将 lwjgl2 API 调用重定向至对应的 lwjgl3 调用(位于
src/main/java/org/lwjglx、src/generated/java/org/lwjglx),生成器代码在src/util/java中。 - 虚拟的
org/lwjgl/*类,用于匹配从 lwjgl3 中移除的类(例如 Display),以便那些依赖在类路径中该位置找到这些类的模组能够正常工作——例如用于 mixin 元数据。 - 崩溃报告用 GL 厂商信息提供程序的替换方案,旧版本如果在没有有效 OpenGL 上下文的线程中使用会导致 JVM 崩溃。
- ASM 转换器:
- 在所有其他转换完成后,将任何对
org/lwjgl的访问重命名为org/lwjglx的 ASM 转换器——位于LwjglRedirectTransformer.java。 javax/xml/bind->jakarta/xml/bind/的 ASM 转换器以及 jakarta.xml.bind 的阴影版本(shaded version),因为该 API 已从 JRE 11 中移除。- 可扩展枚举转换器(从 Minecraft 1.19.3 的 Forge 复制并采用 LGPL 许可证),用于替换大量的 EnumHelper 用法。
- Object holders unfinalizer,用于移除在 Forge 中覆盖
static final字段的需求。 FixConstantPoolInterfaceMethodRefHelper是一个转换器,用于修复 javac 8/asm 5.0 reobfuscator 的一个 bug:当使用接口方法的 MethodHandle 时,它会在常量池中生成错误的条目。
- 在所有其他转换完成后,将任何对
- Mixins:
- Object holder 修改,使其不再写入
static final字段。 - JarDiscoverer 更改为忽略
module-info.class和META-INF/versions/*类,因为它不具备 Java 9 感知能力。 - PostMixinTransformInjector,用于将我们的 ASM 转换器移至 mixin 处理之后运行。
- Object holder 修改,使其不再写入
- 来自 Modern Forge 的
UnsafeHacks类,经过修改以适用于更多用例,用于在某些无法轻易移除 final 的情况下替换一些static final写入操作。 - Forge 补丁,这些是 Forge 中被修改的类,由于它们加载过早而无法通过常规方式转换——因此我们在类路径中先于 Forge 加载一个
forgePatchesjar 来替换它们:- EventSubscriptionTransformer:子类注解描述符的格式在 Java 17 中略有变化,此补丁使注解发现同时兼容新旧格式。
- TerminalTransformer:修改以接受比 asm5 支持更新的 classfiles。
- ClassPatchManager:将 Pack200 实现切换为 Apache Commons Compress,因为后者已从较新的 JDK 中移除。
- TracingPrintStream:commons-compress 会关闭 System.out,此补丁阻止这种情况发生。
- CoreModManager:解决系统类加载器不再是 URLClassLoader 的问题。
- FMLSecurityManager:修复一些数组索引越界异常;它在 Java 17 中已被弃用,待新 API 可用后需要被替换。
- EnumHelper:使用基于可扩展枚举转换器和 UnsafeHacks 的新变体替换所有 EnumHelper API。
- 利用 LWJGL3 特性的额外性能增强 mixins:
- 基于 STB_image 的图像加载器,比 Image4J 快得多。
- 基于 STB_rectpack 的纹理拼接器,面对数万个纹理时几乎是瞬间完成,而原版代码拼接如此多的纹理到一张图集上则需要数秒时间。
LWJGL3ify
Brings LWJGL3 and modern Java versions to Minecraft 1.7.10. Bundles RetroFuturaBootstrap as a flexible early load plugin system.
To use, just make sure the main jar is in the mods/ directory and configure to launch with Java 8 as usual. On startup, a window should appear prompting you to select a modern Java version to relaunch with, and the JVM settings for that Java installation. If none appear, you should download a modern Java version from your preferred vendor and install it, Java 17 and 21 are the currently recommended versions.
Compatibility
While the mods strives for maximum compatibility, there will inevitably be mods that currently do not work with lwjgl3ify, please check if our issue tracker has them listed and if not open an issue, including the crash report if any, game logs and information about what doesn't work properly.
Tweaking configs
If you want to tweak your window options, raw mouse input, OpenGL context properties or other more advanced settings, check out the config file in config/lwjgl3ify.cfg after the first startup, or the lwjgl3ify Mod Options in game.
Server installation
First, install a working Forge server, from a modpack zip or using forge's installer. Then, install the mod jar (and unimixins, hodgepodge and gtnhlib as needed) in mods/, and download the forgePatches jar. Put the forgePatches jar in the same folder as your forge-universal and minecraft server jars. Thermos/Crucible/Hybrid servers are not supported!. Lwjgl3ify also depends on Unimixins. Rename the forgePatches jar to just lwjgl3ify-forgePatches.jar. Grab java9args.txt from the sources of this mod. You can now launch the server with a command like the following, assuming the first java executable on your PATH is java 17/21/newer:
java -Xmx6G -Xms6G @java9args.txt -jar lwjgl3ify-forgePatches.jar nogui
How does it work? (Very technical details)
There are a few components to enabling modern Java and LWJGL usage on old Minecraft versions, lwjgl3ify implements these specifically:
- A game relauncher to modify the library list loaded into the java classpath - to install LWJGL3, and our forgePatches jar that includes libraries such as ASM 9 or new Apache Commons.
- A custom server launcher jar with the modified
Class-PathMETA-INF manifest entry (integrated into our forgePatches jar) - A Free and Open Source replacement for launchwrapper with a java 9+-compatible classpath discovery mechanism and wider-reaching transformer capabilities at .
- A lot of add-opens flags for the JVM to allow reflection into JVM internals. Unfortunately a lot of libraries and mods depend on this to work, even weird ones like
java.textorniointernals in case of Netty. - A partially auto-generated compatibility shim redirecting lwjgl2 api calls into the matching lwjgl3 calls (in
src/main/java/org/lwjglx,src/generated/java/org/lwjglx), the generator is insrc/util/java - Dummy
org/lwjgl/*classes matching the classes removed from lwjgl3 (e.g. Display) for mods that rely on finding them under that location in the classpath - e.g. for mixin metadata - Replacement GL vendor information provider for crash reports, the old one caused JVM crashes if it was used from a thread without a valid OpenGL context
- Asm transformers:
- Asm transformer renaming any access to org/lwjgl to org/lwjglx after all other transformations have been done to the class - in
LwjglRedirectTransformer.java javax/xml/bind->jakarta/xml/bind/asm transformer and a shaded version of jakarta.xml.bind, because that API was removed from JRE 11- Extensible enum transformer (copied under the lgpl license from Forge for minecraft 1.19.3) to replace a lot of the EnumHelper usages
- Object holders unfinalizer, to remove the need for overwriting
static finalfields in Forge. FixConstantPoolInterfaceMethodRefHelperis a transformer to fix a javac 8/asm 5.0 reobfuscator bug which generated wrong entries in the constant pool if method handles to interface methods were used
- Asm transformer renaming any access to org/lwjgl to org/lwjglx after all other transformations have been done to the class - in
- Mixins:
- Object holder modifications to no longer write to
static finalfields - JarDiscoverer change to ignore
module-info.classandMETA-INF/versions/*classes because it's not Java 9-aware - PostMixinTransformInjector used to move our asm transformer to run after the mixin processing
- Object holder modifications to no longer write to
UnsafeHacksclass from modern forge, modified to work in more usecases, for replacing somestatic finalwrites where it was not feasible/easy to remove final.- Forge patches, which are modified classes from Forge that cannot be transformed because they are loaded too early - so we load a
forgePatchesjar before Forge in the classpath to replace them:- EventSubscriptionTransformer: the format of subclass annotation descriptors has slightly changed in Java 17, this makes the annotation discovery compatible with both
- TerminalTransformer: modify to accept classfiles newer than what asm5 supported
- ClassPatchManager: switches the Pack200 implementation to an Apache Commons Compress one because it was removed from newer JDKs
- TracingPrintStream: commons-compress closes System.out, this blocks this from happening
- CoreModManager: work around the fact that the system classloader is no longer a URLClassLoader
- FMLSecurityManager: fix some array index out of bounds exceptions, it is also deprecated in java 17 and will need to be replaced once a new API is available
- EnumHelper: replace all the enumhelper apis with new variants using the extensible enum transformer and unsafe hacks.
- Additional performance-enhancing mixins making use of LWJGL3 features:
- STB_image-based image loader, much faster than Image4J
- STB_rectpack-based texture sticher, it's nearly instant with tens of thousands of textures, compared to the vanilla code which takes many seconds to stitch that many textures into an atlas
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
下载 lwjgl3ify
更新内容
- 通过 @micvog 在 修复了 BetterQuesting 文本字段在未列出的屏幕上的输入问题
新贡献者
- @micvog 在 完成了首次贡献
完整更改记录:
更新内容
- [Bug Fix] 修复 Xaero's Minimap
onClosemixin 注入失败的问题,由 @glektarssza 在 中提交 - 修复 BetterQuesting、BiblioCraft、StevesFactory、LogisticsPipes 的中文输入法支持问题,由 @paulzzh 在 中提交
- 合并排队中的鼠标运动事件,以防止按钮事件被驱逐,由 @Algent 在 中提交
新贡献者
- @glektarssza 在 中首次提交贡献
- @paulzzh 在 中首次提交贡献
完整变更日志:
完整更新日志:
更新内容
- 由 @eigenraven 在 中生成实例存档,以支持即将推出的原生 CurseForge lwjgl3ify 功能
完整变更日志:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
缓冲的原始输入和线程化的事件轮询
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
原版世界生成优化模组
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
评论 0
登录后参与评分
还没有评论,来抢沙发吧