Add NBTPath#of(Tag, Tag)#2
Open
Taskeren wants to merge 9 commits into
Open
Conversation
Glavo
reviewed
Jun 9, 2026
Glavo
reviewed
Jun 16, 2026
Glavo
left a comment
Member
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
已将具体审查建议标注在对应代码行。
Glavo
reviewed
Jul 2, 2026
Glavo
left a comment
Member
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
已将具体审查建议标注在对应代码行。
Glavo
reviewed
Jul 2, 2026
Glavo
left a comment
Member
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
已将具体审查建议标注在对应代码行。
| if (!(tag instanceof Tag currentTag)) return null; | ||
| NBTParent<?> parentTag = tag.getParent(); | ||
| if (parentTag instanceof ParentTag<?>) { | ||
| return parentTag instanceof CompoundTag ? new NBTPathNode.NamedSubTag(currentTag.getName()) : new NBTPathNode.Index(currentTag.getIndex()); |
Member
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
[P2] 先支持 ListTag 根再返回索引路径
当 tag 的 parent 是 ListTag/ArrayTag(或 expectedRoot 本身是这类 ParentTag)时,这里会生成 [index] 作为相对路径;但 NBTPathImpl.select(...) 对初始 parent 只处理 CompoundTag、ChunkRegion 和 Chunk,传入 ListTag/ArrayTag 会直接从 Stream.empty() 开始。因此 NBTPath.of(child, list) 返回的路径无法通过 list.getFirstTag(path) 找回 child,新的 of(Tag, Tag) API 在非 Compound 根上会失效;要么限制/拒绝这类根,要么让选择器从所有 ParentTag 根开始。
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.
Added a util function to create NBTPath from existing tag trees.
by the way, the output ofFixed.NBTPathImpl#toStringis pretty weird.