Repository navigation
重写 RegistrateLib 1.21.1 并迁移到 Kotlin - #9
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / 目的
完成 RegistrateLib 的 1.21.1 首版重写。目标环境为 Minecraft 1.21.1、NeoForge 21.1.265、Java 21 与 Kotlin 2.4.21。
Implementation Details / 实现细节
RegistryEntry.metadata()暴露 DataGen 和本地化声明。重复 ID 在注册提交时报告,条目回调在 Holder 绑定后执行。@Trans和@TransVariants汇总到 Minecraft 原生语言 JSON。解析阶段处理优先级、冲突、Minecraft 占位符及en_ud。localization-processor子模块提供 JSR 269 与 KSP。DataGen 从所属模组读取索引并合并声明。RegistrateLib与TestMod采用 Java 的@Mod入口。测试模组的 Java 和 Kotlin 注册共用由TestMod创建的Registrate。Outcome / 结果
build通过,其中包含 Spotless 检查。runGameTestServer的 7 个用例全部通过,覆盖混合源码注册、重复 ID、原生翻译 Key 和两种编译期索引。runTestdata --all执行到所有 Provider 完成。Potential Compatibility Issues / 潜在兼容性问题
sourceLocale(MinecraftLocale)。.lang(String)与addRawLang使用该 Locale。annotationProcessor或ksp。NullableSupplier、NullableType和FieldsAreNonnullByDefault已移除。原有调用方需调整空值声明和供应器类型。