Add drawAdditionalCallback to StructurePipRenderingState#50
Merged
Gu-ZT merged 2 commits intoJun 21, 2026
Conversation
ZhuRuoLing
commented
Jun 21, 2026
ZhuRuoLing
left a comment
Contributor
Author
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved ✅ (0 critical, 0 warnings, 3 suggestions)
PR: #50 -- Add drawAdditionalCallback to StructurePipRenderingState
Author: @ZhuRuoLing
Files changed: 3 (+136 -20)
Suggestion
-
StructurePipRenderer.java -- renderAllFeatures() 从循环内移到循环外后, features 从按 BE 交错渲染变成了累积统一渲染。建议实际游戏内视觉验证一下渲染顺序/z-order 是否有可感知的变化(如方块轮廓, 流体覆盖等场景)。
-
StructurePipRenderer.java -- bufferSource.endBatch() 的位置从循环内移到了所有渲染的最后。考虑在 callback 与 renderAllFeatures() 之间也放一个 endBatch(), 把 BE 渲染残留的 buffer 冲刷干净, 避免 callback 提交的节点拿到脏 buffer。
-
GuiRenderExtras.java -- 第三个新重载硬编码了 scale=32.0f, ambientOcclusion=false, glitched=false。建议将 32.0f 提取为命名常量(如 DEFAULT_PIP_SCALE)增强可读性和维护性。
Looks Good
- Backward compatibility 干净 -- 现有方法传 null, 零调用方改动。
- 性能优化扎实 -- RenderBuffers, SubmitNodeStorage, GameRenderer, FeatureRenderDispatcher 初始化和 renderAllFeatures() 都移出了循环, 显著减少每 BE 的分配开销。
- poseStack.isEmpty() 防御检查 -- 好的防御性编程习惯。
- Record compact constructor 参数顺序正确 -- drawAdditionalCallback 在 this() 调用中的位置与 canonical constructor 的 component 声明一致, 避免了参数交换 bug。
- @nullable + not-null 守卫到位, 空安全规范。
Reviewed by Hermes Agent
Gu-ZT
approved these changes
Jun 21, 2026
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.
Add Support for Additional Draw Callbacks in Structure Picture-in-Picture Rendering
What's Changed
This PR adds support for custom drawing callbacks in the structure picture-in-picture (PiP) rendering system, enabling more flexible rendering of additional elements during structure visualization.
Changes Summary
GuiRenderExtras.java
submitStructure()methods that accept aBiConsumer<SubmitNodeCollector, PoseStack>callback parameter for drawing additional elementssubmitStructure()calls to passnullas the new callback parameter for backward compatibilityBiConsumerandSubmitNodeCollectorStructurePipRenderer.java
RenderBuffers,SubmitNodeStorage,GameRenderer, andFeatureRenderDispatcherinitialization outside the loop to improve performanceendBatch()callStructurePipRenderingState.java
drawAdditionalCallbackfieldBiConsumerandSubmitNodeCollectorBenefits
Type of Change