Skip to content

fix(compat): render ArchitectureCraft blocks via the vanilla dispatcher - #103

Merged
DHJComical merged 2 commits into
mainfrom
fix/issue101-architecturecraft-render-compat
Sep 1, 2026
Merged

fix(compat): render ArchitectureCraft blocks via the vanilla dispatcher#103
DHJComical merged 2 commits into
mainfrom
fix/issue101-architecturecraft-render-compat

Conversation

@DHJComical

Copy link
Copy Markdown
Owner

问题 / Issue

Closes #101

ArchitectureCraft(TridenMC 3.108 / Spocel 3.109)的所有方块不可见;alpha-0.0.6 上还会在构建 chunk mesh 时崩溃。

根因 / Root cause

ArchitectureCraft 的世界渲染完全不依赖烘焙模型:

  • 它在 postInit 通过 CustomBlockDispatcher.inject()Minecraft.blockRenderDispatcher 替换为自己的 dispatcher,shape / sawbench 等方块的真实几何(OBJSON 模型)由 dispatcher.renderBlock 拦截后直接写入 BufferBuilder。
  • 其 blockstate 运行时由 ConcreteResourcePack 模板生成,只有 normal variant,而方块都带 facing 属性——烘焙注册表里 architecturecraft:sawbench#facing=south 等状态本来就是 Forge 的 FancyMissingModel(模组设计如此,烘焙模型仅作粒子占位)。
  • Actinium 的 fast chunk path 直接读 BlockModelShapes.getModelForState,绕过被替换的 dispatcher,拿到 missing model 后被 MissingModelCompatfix(terrain): skip missing models and wire compat renderer to quad transformers #90)跳过 → 方块不可见。
  • 0.0.6 崩溃:FancyMissingModel.getQuads 惰性渲染 "MISSING" 字样,字体渲染在 meshing worker 线程要求 GL 上下文(fix(terrain): skip missing models and wire compat renderer to quad transformers #90 已把该崩溃转为跳过)。

修复 / Fix

复用 SnowRealMagicCompat(#35)已验证的 vanilla dispatcher 回退管线:

  • 新增 compat/architecturecraft/ArchitectureCraftCompat:按 registry namespace architecturecraft 识别该模组方块(不引用其任何类),强制走 dispatcher.renderBlock 回退。此时 dispatcher 已是 AC 替换后的实例,真实几何写入 vanilla BufferBuilder,再由既有的 convertVanillaDataToCeleritasData 并进 chunk mesh。
  • 线程安全:AC 的世界渲染目标 RenderTargetWorld 继承 RenderTargetBase,纯 BufferBuilder 顶点写入 + CPU 光照计算,无 GL 依赖,在 meshing worker 线程安全。
  • compatBridge 未触碰,celeritasleafculling 的第三方 mixin 绑定契约(JarTest 锁定)不受影响。
  • 判定逻辑提取为无 FML 环境依赖的 ArchitectureCraftRenderRouting,配套单元测试。

验证 / Verification

  • ./gradlew build --no-daemon 全绿(含桥契约 JarTest、MixinConfigurationTest)。
  • 新增 ArchitectureCraftRenderRoutingTest 通过。
  • dev 环境加入 curse.maven:architecturecraft-tridev-277631:4344128(3.108)实机验证通过(shape / sawbench 渲染与光照正常)。

ArchitectureCraft (TridenMC/Spocel, issue #101) replaces
Minecraft.blockRenderDispatcher with CustomBlockDispatcher during
postInit and emits its shape geometry through that entry point; its
baked-model slots stay empty (blockstates only publish a normal
variant, so facing=* states resolve to Forge's FancyMissingModel).
The fast chunk path reads BlockModelShapes.getModelForState directly,
hits the missing model and skipped the block, so every
ArchitectureCraft block was invisible (0.0.6 crashed on the fancy
missing model's lazy font rendering before #90 made it a skip).

Force blocks registered under the architecturecraft namespace down the
existing vanilla dispatcher fallback (the SnowRealMagicCompat route);
the replaced dispatcher then supplies the real geometry. Its
RenderTargetWorld target writes into a BufferBuilder without touching
GL, so it stays safe on mesh worker threads. The routing decision is
extracted into ArchitectureCraftRenderRouting so it can be tested
without an FML bootstrap, and the compat-bridge renderer is untouched,
keeping the third-party mixin binding contract intact.
@Microcat98

Copy link
Copy Markdown

This solved the issue. Sorry for the delay.

@DHJComical
DHJComical merged commit 7d9d667 into main Sep 1, 2026
1 check passed
@DHJComical
DHJComical deleted the fix/issue101-architecturecraft-render-compat branch September 2, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ArchitectureCraft blocks are invisible

2 participants