Repository navigation
[26.3] Share structure previews 共用结构渲染与只读界面预览 - #289
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 #289 已合并(dev/26.3 合并树与 head dd8b51ea 完全一致,2026-11-14T18:43:39Z)。26.3 这一线的两处关键 API 迁移(渲染相关类型迁到 com.mojang.renderpearl.api.*、VertexConsumer 新增抽象方法 setUv3)都已跟上;6 处注入和两个 args.set(11, …) 点的逐项字节码核对全部命中。这一族跨 6 条版本线的移植至此收尾,剩下的都是各线共通的跟进项(光照不复位、复用真实相机、海平面不一致等),本线没有新增的缺陷类型。
一、合并态与范围
| 判据 | 结果 |
|---|---|
| state / merged / merged_at | closed / true / 2026-11-14T18:43:39Z |
| base / 合并树 vs head | dev/26.3 / 空 diff ⇒ 进主干的就是 dd8b51ea |
| 规模 | 34 文件 +3291/−0,与收到的 diff 一致 |
| head CI | build / build ✅ |
| 既有评论 | 仅 Roseau API 报告 |
| 语言文件 | en_us / en_ud / zh_cn 各 107 条 ✅ |
| mixin 配置 | required: true + defaultRequire: 1,compatibilityLevel: "JAVA_25" |
二、注入口与 API 迁移逐条核实(26.3 未混淆 jar)
| 注入 / 依赖 | 核对结果 |
|---|---|
innerBlit(RenderPipeline, GpuTextureView, GpuSampler, IIII, FFFF, I) ordinal=4 |
两个重载(Identifier 版 code=46、GpuTextureView+GpuSampler 版 code=57),mixin 用完整描述符锁定后者 ✅;ordinal=4 = 第 5 个 int = color ✅ |
| renderpearl 包迁移 | 26.3 把 RenderPipeline/GpuTextureView/GpuSampler 移到 com.mojang.renderpearl.api.*,mixin 描述符与 Effects.render 形参全部同步 ✅(照抄 26.2 即会静默失配,这是本线最容易翻车的地方) |
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 |
code=53 ✅;ordinal=2 = 第 3 个 int = color ✅ |
Screen.extractBackground(GuiGraphicsExtractor, int, int, float) |
public code=56 ✅ |
RecipeBookComponent.isVisibleAccordingToBookData()Z |
private code=15 ✅ |
BlitRenderState.<init> 14 参 + args.set(11, …) |
两个构造器:13 参 Matrix3x2f 版与 14 参 Matrix3x2fc 版;mixin 精确指向后者 ✅;字节码显示 GuiRenderer.submitBlitFromItemAtlas 与 PictureInPictureRenderer.blitTexture 各只调用一次该构造器 ⇒ 命中唯一,index 11 = int color ✅ |
PictureInPictureRenderer |
无参构造器 ()V ✅;renderToTexture(T, PoseStack, SubmitNodeCollector) abstract ✅;blitTexture(T, GuiRenderState) protected ✅;textureView 类型为 Lcom/mojang/renderpearl/api/textures/GpuTextureView;,经 AT(本线为 protected,head 与 base 一致)放宽 ✅ |
VertexConsumer 抽象方法集合 |
26.3 新增 setUv3(float, float);PosedConsumer 已补该 override ✅(漏了就是编译失败,这一处跟得最细) |
Sheets.cutoutBlockItemSheet()/translucentBlockItemSheet()、GuiItemRenderState/OversizedItemRenderState/PictureInPictureRenderState |
均存在且包路径与 mixin import 一致 ✅ |
container.getLeftPos()/getTopPos() |
Mojang client.jar 的 AbstractContainerScreen/Screen 常量池里没有这两个名字 ⇒ 由 NeoForge 补丁提供(客户端 jar 不含补丁);解析由 CI build 证明。属可接受,但意味着上游若改名会先崩在编译期而非运行期 |
三、需要跟进(合并后,与 26.2 同源)
- 光照设置在空 level 早退之前执行、且不恢复:
renderToTexture首行mc.gameRenderer.lighting().setupFor(Lighting.Entry.LEVEL),之后才if (mc.level == null) return;;1.21.x/26.1 版本会保存并恢复RenderSystem.setShaderLights(previousLights),26.2/26.3 完全没有恢复。建议把setupFor移到 null 检查之后并在finally恢复(或注释说明 26.3 为何无需恢复)。 - PiP 内复用真实世界相机剔除实体:
gameRenderer.gameRenderState().levelRenderState.cameraRenderState被传给实体与方块实体的submit(...),裁剪距离/shouldRender/阴影判定按玩家真实视角算 ⇒ 结构里位于玩家背后或超视距的实体不出现在预览窗。 - 跨线沙盒语义不一致:
getSeaLevel()返回 0(dev/1.21.8实测为 63)、getBlockTint(...)恒-1、cardinalLighting()恒DEFAULT。当前渲染走ProjectionScene(mc.level)绕开了它们,但任何以后直接把沙盒当BlockAndTintGetter用的扩展都会拿到「无染色 + 默认朝向光照 + 海平面 0」。 createClientClockManager静默无时钟:registryAccess.lookup(Registries.WORLD_CLOCK)为空时clockManager无任何时钟数据且无日志;建议补一次性 warn(否则「预览里时间相关表现怪」很难定位)。defaultRequire: 1下 pin 死 record 构造器没有运行时保险:这一族自己已两次证明风险真实——26.1→26.2 构造器从Matrix3x2f变Matrix3x2fc,26.2→26.3 包名迁到renderpearl。建议对两个纯视觉@ModifyArgs加require = 0,让上游漂移退化成「静默不淡出」而不是「开不了客户端」。- AT 依赖需要注释:
blitTexture覆盖里读this.textureView,依赖module.rendering/.../accesstransformer.cfg里那条放宽;该行在 base 上已存在,且谓词随版本变过(26.2 写public,26.3 写protected)⇒ 建议在 AT 行与 override 各留一句用途说明,避免被当作冗余清理。 - 混合层流体逐层提交 3 次:
for (ChunkSectionLayer targetLayer : ChunkSectionLayer.values())每次submitCustomGeometry只有一层收到顶点,另两次为空缓冲;可只按fluidModels.get(fluid).layer()提交一次。 - 每帧新建渲染器对象:
new ProjectionScene(...)、new ModelBlockRenderer(...)、new FluidRenderer(...)每帧各一次,建议提到字段。 - 小型清理:
SandboxRenderLevel删掉potionBrewing()/fuelValues()覆写后留下两行空行(recipeAccess()与getBlockTicks()之间)💡;mixins.json的compatibilityLevel本线为JAVA_25、26.2 为JAVA_8、1.21.x 为JAVA_21,建议跨线统一;StructureBlockEntityDetails.describe/StructureDetailsPager仍无生产调用方。
四、这一族 6 条版本线的关键取舍对照(收尾用)
| 维度 | 1.21.1 / 1.21.4 | 1.21.8 | 1.21.11 | 26.1 | 26.2 | 26.3 |
|---|---|---|---|---|---|---|
| 透明度入口 | GuiGraphics 内联 / RenderSystem.setShaderColor |
4 个 submit* |
5 个(+ submitTiledBlit) |
innerBlit/innerFill/innerTiledBlit/text |
同 26.1 | 同 26.2,但类型在 com.mojang.renderpearl.api |
| 覆盖效果回调 | 相机矩阵有效时 | PiP 纹理内 | PiP 纹理内 | PiP 纹理内 | render(state, GpuTextureView, GuiRenderState) |
同 26.2(renderpearl 类型) |
| 背景拦截 | — | renderTransparentBackground |
renderBackground |
extractBackground |
同 26.1 | 同 26.1 |
| 沙盒海平面 | 63 | 63 | 0 | 0 | 0 | 0 |
音效/levelEvent |
委托 | 委托 | 空实现 | 空实现 | 空实现 | 空实现 |
| 语言文件 | 2 份 | 2 份 | 3 份 | 3 份 | 3 份 | 3 份 |
五、验证边界
未执行 Gradle 构建、runClient 与游戏内实测(PR 自述「客户端画面尚未实测」);previewTest 只覆盖 provider 注册、renderOnly 嵌套/异常恢复与缓动函数,不加载 mixin、不渲染。本文结论来自静态读码 + 26.3 未混淆 client.jar 的方法表与字节码(含 BlitRenderState 两个构造器的选择与调用次数、VertexConsumer 抽象方法集合)、accesstransformer.cfg 的 head/base 对照、合并树/head 对账、head CI 与三份 lang 键数比对。建议实机补测:真实容器屏在不同 GUI scale 下的浮窗裁剪与层级、F3 隐藏 GUI、结构内实体位于玩家背后/远处的可见性、大尺寸物品淡出、时钟/时间相关渲染,以及同一结构在 26.2 与 26.3 上的观感一致性(渲染类型迁移与 AT 谓词变化最可能在渲染表现或编译期暴露问题)。
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.3:build(含previewTest)与git diff --check通过;已对照当前版本源码核查 Mixin 目标。客户端画面尚未实测。