Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Registry-related get methods

未关闭
#13 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
停滞
技术栈
java
领域
tooling

调研方向

首先定位 issue 中列出的 Registry、HolderGetter、HolderLookup、RegistryAccess 和 BootstapContext 方法,然后比较 #10 所采用的方法。跟踪 ResourceKey 或 TagKey 参数来自 static 字段的调用点,并识别受影响的局部变量。完成的标准是:在列出的方法中,适用的变量始终使用从这些字段派生的名称。

由索引模型根据 Issue 内容生成。

描述

enhancement

A lot of the methods on Registry, HolderGetter, HolderLookup, RegistryAccess take ResourceKey as the sole parameter returning something. A lot of the time, those ResourceKey arguments are obtained from static final fields somewhere which makes choosing the name for the local var very easy.

Something like

Holder<Structure> structure1 = registry.getHolder(BuiltinStructures.NETHER_FOSSIL);

can be changed to

Holder<Structure> netherForsilStructure = registry.getHolder(BuiltinStructures.NETHER_FOSSIL);

This is similar to #10 and how the various is and has methods are handled, by looking at the field used in the parameter.

A non-exhaustive list of methods that this could apply to are:

TagKey
  • TagKey#create(ResourceKey, ResourceLocation)
ResourceKey
  • ResourceKey#create(ResourceKey, ResourceLocation)
Registry
  • Registry#get(ResourceKey)
  • Registry#getHolder(ResourceKey)
  • Registry#getOptional(ResourceKey)
  • Registry#getOrThrow(ResourceKey)
  • Registry#containsKey(ResourceKey)
  • Registry#getHolder(ResourceKey)
  • Registry#getTag(TagKey)
  • Registry#getTagOrEmpty(TagKey)
  • Registry#getOrCreateTag(TagKey)
RegistryAccess, RegistryAccess$Frozen, HolderLookup$Provider
  • RegistryAccess#lookup(ResourceKey)
  • RegistryAccess#lookupOrThrow(ResourceKey)
  • RegistryAccess#registry(ResourceKey)
  • RegistryAccess#registryOrThrow(ResourceKey)
HolderGetter, HolderLookup
  • HolderGetter#get(ResourceKey)
  • HolderGetter#getOrThrow(ResourceKey)
  • HolderGetter#get(TagKey)
  • HolderGetter#getOrThrow(TagKey)
BootstapContext

(yes there is a typo in Bootstap in the vanilla source)

  • Bootstap#register(ResourceKey, Object, Lifecycle)
  • Bootstap#register(ResourceKey, Object)
  • Bootstap#lookup(ResourceKey)
主要语言
Java
星标
24
派生
1
平均合并
2 分钟
30 天内合并 PR
1

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PaperMC/codebook 的其他 Issue

查看 PaperMC/codebook 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。