Repository navigation
[26.1] Share structure previews 共用结构渲染与只读界面预览 - #287
Merged
Merged
Conversation
- 迁移隔离结构沙盒、相机拾取与原生界面浮窗 - 提供自定义界面注册和附加渲染接口,解除对手册的依赖 - 适配当前游戏版本的渲染与透明度补丁 - 补充通用翻译、接口说明及只读作用域回归检查
🌿 Roseau API Breaking Change Report
|
Gugle2308
reviewed
Nov 14, 2026
Gugle2308
left a comment
There was a problem hiding this comment.
结论:PR #287 已合并(squash 6ae5db92,dev/26.1 tip,合并树与 head b8899558 完全一致,2026-11-14T18:43:32Z)。26.1 的 6 处注入我逐个用未混淆 client.jar 的方法表 + 字节码核对过:全部命中,且两个 @ModifyArgs �� args.set(11, color) 都精确落在 BlitRenderState 的 14 参规范构造器上;需要跟进的是「复用真实相机剔除实体」「沙盒染色/海平面与旧线不一致」「时钟注册表缺席时静默无时钟」三点。
一、合并态与范围
| 判据 | 结果 |
|---|---|
| state / merged / merged_at | closed / true / 2026-11-14T18:43:32Z |
| merge_commit_sha | 6ae5db924e462dd8f88a3c3d2a29e1ef572f5e77 = dev/26.1 tip |
| 合并树 vs head | 空 diff ⇒ 进主干的就是 b8899558 |
| 规模 | 34 文件 +3317/−0,与收到的 diff 一致 |
| head CI | build / build ✅ |
| 既有评论 | 仅 Roseau API 报告 |
| 语言文件 | en_us / en_ud / zh_cn 各 107 条 ✅ |
二、注入点逐条核实(26.1.2 未混淆 jar)
| 注入 | 核对结果 |
|---|---|
innerBlit(RenderPipeline, GpuTextureView, GpuSampler, IIII, FFFF, I) ordinal=4 |
该方法在 GuiGraphicsExtractor 里有两个重载(Identifier 版与 GpuTextureView+GpuSampler 版),mixin 用了完整描述符锁定后者 ✅;int 位序 = 4 坐标 + color,ordinal=4 = 第 5 个 int = color ✅ |
innerFill(…, IIIII, Integer) 两个 handler |
单重载(code=59)⇒ ordinal=4 = color ✅;尾部 Integer handler 匹配渐变参数 ✅ |
innerTiledBlit(…, IIIIII, FFFF, I) ordinal=6 |
code=61;共 7 个 int(6 坐标 + color)⇒ ordinal=6 = 第 7 个 = color ✅ |
text(Font, FormattedCharSequence, IIIZ) ordinal=2 |
类里有 III 与 IIIZ 两个 text 重载,mixin 按描述符锁定 IIIZ ✅;ordinal=2 = 第 3 个 int = color ✅ |
Screen.extractBackground(GuiGraphicsExtractor, int, int, float) |
public code=53 ✅(26.1 的 extract 体系,替代 1.21.11 的 renderBackground) |
RecipeBookComponent.isVisibleAccordingToBookData()Z |
private code=15 ✅ |
GuiRenderer.submitBlitFromItemAtlas(GuiItemRenderState, GuiItemAtlas$SlotView) |
private code=82 ✅(26.1 改了签名,mixin 只按方法名 + 内部 INVOKE 定位,不受影响) |
PictureInPictureRenderer.blitTexture(PictureInPictureRenderState, GuiRenderState) |
protected code=73 ✅,父类构造器 (BufferSource) ✅ |
BlitRenderState.<init> 14 参 + args.set(11, …) |
字节码显示 submitBlitFromItemAtlas 与 blitTexture 各自只调用一次 14 参规范构造器,参数序 …IIII、FFFF、I(color, index 11)、两个 ScreenRectangle ⇒ 下标与注入点都正确 ✅ |
三、需要跟进(合并后)
- PiP 里复用真实世界相机做剔除(与 1.21.8 / 1.21.11 同源问题):
renderToTexture取gameRenderState.levelRenderState.cameraRenderState传给entityRenderDispatcher.submit(...)与blockEntityRenderer.submit(state, pose, nodes, camera),实体裁剪距离、shouldRender、阴影判定都按玩家真实视角算 ⇒ 结构里位于玩家背后或超出视距的实体不会出现在预览窗。建议构造与预览state.transform()对齐的CameraRenderState。 SandboxRenderLevel的染色与海平面:本线implements BlockAndTintGetter且getBlockTint(...)恒返回-1、cardinalLighting()恒返回CardinalLighting.DEFAULT、getSeaLevel()返回 0(1.21.4 / 1.21.8 是63)。渲染走ProjectionScene(mc.level)所以当前观感可能没问题,但任何直接以沙盒为BlockAndTintGetter的扩展都会拿到「无染色 + 默认朝向光照」;海平面 0 也会让依赖它的流体/高度逻辑与旧线不一致。createClientClockManager在注册表缺席时静默无时钟:registryAccess.lookup(Registries.WORLD_CLOCK).flatMap(lookup -> lookup.get(WorldClocks.OVERWORLD))为空时clockManager里没有任何时钟数据,依赖clockManager()的渲染会拿到空/默认值且没有任何日志。建议else打一条 warn(一次性),否则这类「预览里时间相关表现怪」的问题很难定位。defaultRequire: 1+required: true下 pin 死 record 构造器没有运行时保险:两个@ModifyArgs精确绑定BlitRenderState的 14 参构造器,而build/previewTest不加载 mixin,CI 绿不能证明命中(本次由字节码手工证)。建议给这两个纯视觉注入加require = 0。mixins.json的compatibilityLevel在本线也是JAVA_8(1.21.1 / 1.21.4 / 1.21.8 为JAVA_21;1.21.11 同样JAVA_8)——既有配置,但新增 6 个 mixin 后建议跨线统一,避免以后有人用 record/pattern 等新特性踩坑。- 每帧新建渲染器对象:
renderToTexture里new ProjectionScene(...)、new ModelBlockRenderer(...)、new FluidRenderer(...)每帧一次;建议提到字段(ModelBlockRenderer依赖ambientOcclusion选项,可在配置变更时重建)。 - 既有项(跨线通病):
getFilledBlocks()返回复用的MutableBlockPos;StructureGuiProviders.register冲突直接抛IllegalStateException(客户端初始化期);StructureBlockEntityDetails.describe/StructureDetailsPager仍无生产调用方(107×3 条 lang 随之闲置)。
四、与 1.21.11 的差异对照(26.1 适配点,均已核实)
| 维度 | 1.21.11 | 26.1(本 PR) |
|---|---|---|
| GUI 上下文 | GuiGraphics |
GuiGraphicsExtractor(submit* → inner*,drawString → text,renderBackground → extractBackground) |
| 纹理提交 | submitBlit / submitTiledBlit / submitColoredRectangle |
innerBlit(两个重载)/ innerTiledBlit / innerFill |
BlitRenderState 位置 |
client.gui.render.state |
client.renderer.state.gui |
| PiP 包 | client.gui.render.pip |
client.gui.render.pip(状态类迁到 client.renderer.state.gui.pip) |
| GUI 缩放 | window.getGuiScale() |
gameRenderState.windowRenderState.guiScale |
| 亮度常量 | LightTexture.FULL_BRIGHT |
LightCoordsUtil.FULL_BRIGHT |
| 方块/流体渲染 | BlockRenderDispatcher.renderBatched/renderLiquid |
new ModelBlockRenderer(...) + FluidRenderer,按 quad.materialInfo().itemRenderType().hasBlending() 分流,并使用 Sheets.translucentBlockSheet() ✅(比 1.21.8 只有 item sheet 更好) |
| 沙盒 | 无时钟 | 新增 ClientClockManager / EnvironmentAttributeSystem / CardinalLighting |
| 语言文件 | 107 × 3 | 107 × 3(一致) |
五、验证边界
未执行 Gradle 构建、runClient 与游戏内实测(PR 自述「客户端画面尚未实测」);previewTest 只覆盖 provider 注册、renderOnly 嵌套/异常恢复与缓动函数,不加载 mixin、不渲染。本文结论来自静态读码 + 26.1.2 未混淆 client.jar 的方法表与字节码(上表逐项给出方法/描述符/code= 与构造器调用唯一性)+ 合并树/head 对账 + head CI + 三份 lang 键数比对。建议实机补测:真实容器屏在不同 GUI scale 下的浮窗裁剪与层级、F3 隐藏 GUI、结构内实体位于玩家背后/远处的可见性(对应第三节第一条)、大尺寸物品淡出、时钟/时间相关渲染(对应第三节第三条),以及同一结构在 1.21.11 与 26.1 上的观感一致性。
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.
将结构渲染、隔离沙盒、相机拾取和只读 GUI 浮窗移入砧库,让手册与机器界面共用实现,避免机器功能依赖手册模组。
验证:
:anvillib-rendering-neoforge-26.1:build(含previewTest)与git diff --check通过;已对照当前版本源码核查 Mixin 目标。客户端画面尚未实测。