本模组仅更新至 1.21.4,因为 1.21.5 完全更改了 SNBT 解析器和访问方式,这让我对该项目的开发热情略有降低。(可能是 26.1)
Function Compiler
此模组允许服务器在加载时从数据包中编译函数为 Java 字节码,从而提高性能,因为编译后的代码可以一次性运行所有内容,而不是逐个运行命令。
使用此模组时会自动收集一些统计数据。欢迎查看 代码 以了解具体报告内容,主要内容包括:耗时、函数数量、指令数量、异常/崩溃(这些可能包含用于调试的命令)。
为了提高性能,此模组将不遵守 maxCommandChainLength 游戏规则,否则编译后的代码需要检查已运行的命令数量,这可能会很慢。
使用方法
将所有依赖项一起放置在 Fabric 服务器上,该模组将自动尝试优化所有支持的函数和命令。
如果遇到任何崩溃,它们将被自动报告。如果您有更多关于如何触发崩溃的背景信息,请在 问题追踪器 上报告。
支持的命令
当然,此模组无法支持所有命令,因此它只会生成仅包含支持命令的函数的代码。目前,这将不会编译带有宏的每个函数。 由于某些宏中的值可以被解释为任何方式,这使得仅依靠编译时已知信息进行实现变得困难,但有些情况是可以推测的。
截至 0.3.2-alpha.2 版本的支持命令列表可以在 命令支持 文件中找到。
支持的选择器
所有选择器及其选项均受支持。
工作原理
此模组通过 Java 类加载器工作:它在运行时为函数生成字节码并加载它们。如果您感兴趣,可以随时查看源代码 这里。
This mod has only been updated up to 1.21.4, because 1.21.5 completely changed the SNBT parser and accessing, which made me slightly less motivated to work on this project. (perhaps 26.1)
Function Compiler
This mod allows the server to compile functions from datapacks on load to Java bytecode, which results in increased performance, because compiled code can run everything at once instead of running commands one by one.
Some statistics are automatically collected when using this mod. Feel free to check the code to check what is reported, but the main things are: timings, function counts, instruction counts, exceptions/crashes (those might contain the commands for debugging).
This mod will not respect the maxCommandChainLength gamerule to improve performance, otherwise it would require the compiled code to check the amount of commands ran, which could be slow.
Usage
Put the mod on a fabric server with all the dependencies, the mod will automatically try to optimize all functions and commands which are supported.
If you encounter any crashes, they will be automatically reported. If you have more context to how to trigger a crash, please report it on the issue tracker.
Supported Commands
Of course this mod can't support every command, so it will only generate code for functions which contain only commands which are supported. Currently, this will not compile every function with macros. It can't compile some macros because any value could be interpreted in any way, which is hard to implement using only things known at compile-time, but some things could be guessed.
The list of commands supported currently as of 0.3.2-alpha.2 can be found in the Command Support file.
Supported Selectors
All the selectors are supported, and all their options.
How it works
This mod works by using Java's class loader: It generates bytecode for the functions at runtime and loads them. If you'd like you can always look at the source here.
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Function Compiler
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
在文本中添加了 selector 支持
在以下功能中添加了宏支持:
xp(所有整数参数)
新增配置选项:
profiler_collect_memory_usage(默认值为true)—— 是否启用性能分析器收集内存使用情况(禁用此选项可使性能分析器运行更快)
修复了以下问题:
- 当分数未定义时,
execute unless score命令不再执行后续指令
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
评论 0
登录后参与评分
还没有评论,来抢沙发吧