Runtime Registry Extender
一个极其扭曲的库类模组,用于在同样极其扭曲的 Minecraft 注册表(registries)中于运行时添加条目。
请注意,此处的“运行时”仅限于游戏循环的几个阶段,以避免出现随机的破坏性故障。
此外,出于稳定性考虑,此模组仅允许向上述注册表添加新条目,而不允许修改其冻结的基础数据。
这些限制的核心目的是允许服务器/世界为玩家的游戏提供额外的值以供其考量,而无需每次重启游戏或启动完全不同的配置。
目前,只有注册表条目受到影响。任何相关资产(模型、纹理、翻译等)仍必须本地存在或通过其他方式提供(例如服务器资源包、本地存在的资产)。
为了避免给模组作者带来不得不摆弄毫无意义且错综复杂的注册表结构的负担,此模组提供了一些入口点(entrypoints),让模组作者能够相当轻松地设置一切:
runtime_registry_extender:extension_setup:必须是 ExtendableRegistryInitializer 类型
- 在注册表的初始化之前执行!注意你的静态值!
- 允许提供需要使哪些注册表变为可扩展的注册表键。
- 其他注册表不会被设为可扩展!请确保为你所有的需求提供它。
- 允许提供无效方块状态适配器(invalid block states adapters),从而用另一个未知的方块状态替换任何未知状态。
- 这些仅在方块状态下执行。未来将致力于支持其他数据类型。
- 这仅影响方块状态,方块实体数据尚未(?)能通过此类方式适配。
- 适配器仅接收从区域文件中读取的原始 NBT 格式数据,并返回理论上有效的 NBT 数据。
runtime_registry_extender:values_loader:必须是 RegistryExtensionLoader 类型
- 允许注册扩展值。为未设为可扩展的注册表提供的任何值都会导致问题。
它分为内置注册表的扩展值注册和可重载注册表的扩展值注册,以确保值既不过早也不过晚注册,同时仍能访问适当的数据源。(即允许基于数据驱动的功能注册条目)
- 在数据重载开始时执行,在其他重载之前进行,以确保为后续阶段提供扩展条目。(例如,确保在加载标签时能够访问扩展条目)
- 允许提供无效元素适配器(invalid elements adapters),从而用另一个未知元素替换任何未知元素。
- 未来将支持其他数据类型。
- 适配器仅接收从区域文件中读取的原始 NBT 格式数据,并返回理论上有效的 NBT 数据。
- 你只能针对每个元素命名空间和每个适配器名称,为每种元素类型(方块状态、物品堆叠...)注册一个适配器。尝试注册重复项将被忽略。
- 截至目前,适配器支持以下类型:方块状态、流体状态、物品堆叠、生物效果(mob effects)和方块实体类型。
- 该入口点始终提供一个辅助工具,用于注册各种更为棘手的元素类型,这些类型可能需要一些注册后处理,或者不是标准注册的。例如,方块和流体注册辅助方法将自动处理注册适当的方块状态和流体状态。
平台
此模组专为 Fabric 加载器制作,并且将仅支持 Fabric。
我毫不怀疑此模组会在基于 Forge 的加载器上崩溃。
并且尝试使用 Sinytra 加载它可能也无法工作。
此模组以与基于 Forge 的工具链不兼容的方式重新实现了注册表,而我既不愿意投入精力为其 NeoForge 制作等效版本,也不赞同人们为此移植此模组。如果你想知道,许可证禁止分发未经授权的移植版,并且我预先通知你对移植到上述工具链或其前身版本的严格拒绝态度。
Runtime Registry Extender
An absurdly twisted library mod to add entries at runtime to the just as absurdly
twisted Minecraft registries.
Please note that "runtime" here is limited to a few phases of the game loop to
avoid random breakage.
Additionally, this only allows adding new entries to the aforementioned
registries but not modifying their frozen base, also as a matter of stability.
The core point of these limitations is to allow servers/worlds to provide extra
values for the players' games to take into account, without having to restart the
game or launch a whole other configuration every time.
Right now, only registry entries are affected. Any related asset (models,
textures, translations, etc.) will still have to be either present locally or
provided by some other mean (e.g. server resource pack, locally present assets)
To avoid imposing on mod authors having to meddle with the pointlessly intricate
registries structure, this mod provides a few entrypoints allowing mod authors to
set everything up quite easily:
runtime_registry_extender:extension_setup: must be of type
ExtendableRegistryInitializer
- Is executed before registries’ initialisation! Mind your static values!
- Allows providing registry keys for which to make registries extendable.
- Other registries will not be made extendable! Make sure to provide it
for all of your needs.
- Allows providing invalid block states adapters, allowing to replace any
unknown block state with another one.
- These are only executed for block states. Work will be put towards
supporting other data types.
- This only affects the block state, block entity data is not (yet?)
adaptable via such means.
- Adapters only receive raw data in a NBT format, as read from the region
files, and return theoretically valid NBT data.
runtime_registry_extender:values_loader: must be of type
RegistryExtensionLoader
- Allows registering the extension values. Any value provided for a registry
that wasn't made extendable will cause issues.
It is split between builtin registries' extension values registration and
reloadable registries' extension values registration to ensure that values
aren't registered too early nor too late, while still providing access to the
appropriate data source. (i.e. to allow registering entries based on
data-driven capabilities)
- Is executed at the beginning of data reloading, before other giving way to
other reloading, to ensure providing extension entries to the following phases.
(e.g. making sure that extension entries can be reached upon loading tags)
- Allows providing invalid elements adapters, allowing to replace any unknown
element with another one.
- Other data types will be supported in the future.
- Adapters only receive raw data in a NBT format, as read from the region
files, and return theoretically valid NBT data.
- You can only register one adapter per element type (block state, item stack...)
per element namespace and per adapter name. Trying to register a duplicate will
be ignored.
- So far adapters support the following: block states, fluid states, item stacks,
mob effects and block entity types.
- The entrypoint is always provided with a helper for registering various more
tricky element types that either might require some post-registration processing
or hare not standardly registered. For instance, the block and fluid registration
helper methods will automatically handle registering appropriate block states and
fluid states.
Platform
This mod is made for the Fabric modloader, and will only ever support Fabric.
I have little to no doubt that this mod will break on forge-based loaders.
And attempting to load it with Sinytra likely will not work either.
This mod reimplements registries in ways that are incompatible with the
forge-based toolchain, and I am neither willing to put in the work to make
an equivalent for NeoForge, nor endorsing people porting this mod for it.
In case you may wonder, the licence does prevent distribution of unauthorised
ports, and I preventively inform you of a strict refusal of any port
to the aforementioned toolchain, or its predecessor.
评论 0
登录后参与评分
还没有评论,来抢沙发吧