关于 ObserverLib 模组
ObserverLib 是一个库模组,可用于以极小的性能开销可靠地观察可能很大区域内的方块变化。
该库可公开使用,主要面向 1.13+ 的 Astral Sorcery 使用。
本质上,这个模组允许你为一个特定区域注册一个 Observer——它最终观察到什么取决于具体实现。世界中其观察区域内发生的变化会被传递给 Observer。然后观察者可以自行决定这些变化意味着什么;它们是否使观察者的状态失效或有效。例如,结构现在是否完整。
实际检查事物是否有效的调用方式是查询相关位置的 ChangeSubscriber,然后询问其当前状态是否有效。
是什么让这比通常只是反复检查一个大区域更好?如果你想观察的区域大于一个区块会怎样?如果你必须检查的另一个区块被卸载了会怎样?为了确保没有任何变化且结构完好,模组将不得不加载该区块并检查方块。如果这导致大量的区块加载和卸载,可能会成为问题。ObserverLib 的实现确保你可以放心,传递给 notifyChange 实现的变化包含所有必要信息,以确保你正在观察的内容仍然有效或无效。
一个用于检查结构是否正确建造的示例实现可以在这里看到。该检查不是始终检查结构组件的所有内容,而是确保跟踪不正确/不匹配的位置,并且仅基于与匹配器预期不符的差异来工作。
如果你有兴趣将其用于自己的项目,可以从这里的 maven 获取:https://maven.hellfiredev.net/hellfirepvp/observerlib/observerlib/
如需进一步解释和细节,欢迎在 AstralSorcery discord 上提问:https://discord.gg/q37VRcT
如何安装 ObserverLib
With Millida Launcher
Install Millida Launcher
The launcher is free: download it at millida.net/launcher and sign in with any nickname.
Click “Install” on this page
The launcher opens and installs the mod for Minecraft 1.15.2–1.21.1 on Forge or NeoForge automatically.
Launch the game
A profile with it appears in the launcher: click “Play”.
Manually
Install Forge or NeoForge
The loader must match the game version of the mod file, for example Minecraft 1.21.1. After installing it, a separate profile appears in your launcher.
Download the file for your version
In the version list above, pick the file observerlib-1.10.3.jar (112 KB) for your game version and loader.
Put it in the mods folder
The folder is inside .minecraft (Windows: %appdata%\.minecraft\mods). If it does not exist, create it.
Launch the loader profile
Open “Mods” in the main menu: ObserverLib should be in the list.
Minecraft 1.21.1 runs on Java 21: with a different Java version the game may close right after launch.
版本
含依赖项
| Minecraft | 加载器 | 文件 | 日期 | 操作 |
|---|---|---|---|---|
| 1.21.1 | NeoForge | ObserverLib-1.21.1-1.10.3.jar112 KB | ||
| 1.18.2 | Forge | ObserverLib-1.18.2-1.7.1.jar143 KB | ||
| 1.18.2 | Forge | ObserverLib-1.18.2-1.6.0.jar144 KB | ||
| 1.15.2 | — | ObserverLib-1.15.2-1.2.0.jar134 KB |
常见问题
Which Minecraft versions does ObserverLib work on?
There are files for 1.21.1, 1.18.2, 1.15.2. The newest is 1.21.1.
Is ObserverLib for Forge or Fabric?
There are files for Forge: 1.18.2 and for NeoForge: 1.21.1. There are no files for Fabric: a mod for another loader will not start.
Does ObserverLib need other mods?
The author lists no required dependencies: the Forge or NeoForge loader is enough.
Which Java does ObserverLib need?
Minecraft 1.21.1 runs on Java 21. If the game closes right after launch, the usual cause is the wrong Java version in the profile settings.
Where can I download ObserverLib safely?
On this page: the file observerlib-1.10.3.jar (112 KB) is stored on Millida’s server, with no link shorteners. SHA-1 checksum: f8b357513c22b62f0cdbe0259305620541a45fa2.
评价
成为第一个评价 ObserverLib 的人

