fix(compat): render ArchitectureCraft blocks via the vanilla dispatcher - #103
Merged
Merged
Conversation
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.
|
This solved the issue. Sorry for the delay. |
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.
问题 / Issue
Closes #101
ArchitectureCraft(TridenMC 3.108 / Spocel 3.109)的所有方块不可见;alpha-0.0.6 上还会在构建 chunk mesh 时崩溃。
根因 / Root cause
ArchitectureCraft 的世界渲染完全不依赖烘焙模型:
CustomBlockDispatcher.inject()把Minecraft.blockRenderDispatcher替换为自己的 dispatcher,shape / sawbench 等方块的真实几何(OBJSON 模型)由dispatcher.renderBlock拦截后直接写入 BufferBuilder。ConcreteResourcePack模板生成,只有normalvariant,而方块都带facing属性——烘焙注册表里architecturecraft:sawbench#facing=south等状态本来就是 Forge 的FancyMissingModel(模组设计如此,烘焙模型仅作粒子占位)。BlockModelShapes.getModelForState,绕过被替换的 dispatcher,拿到 missing model 后被MissingModelCompat(fix(terrain): skip missing models and wire compat renderer to quad transformers #90)跳过 → 方块不可见。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 namespacearchitecturecraft识别该模组方块(不引用其任何类),强制走dispatcher.renderBlock回退。此时 dispatcher 已是 AC 替换后的实例,真实几何写入 vanilla BufferBuilder,再由既有的convertVanillaDataToCeleritasData并进 chunk mesh。RenderTargetWorld继承RenderTargetBase,纯 BufferBuilder 顶点写入 + CPU 光照计算,无 GL 依赖,在 meshing worker 线程安全。compatBridge未触碰,celeritasleafculling 的第三方 mixin 绑定契约(JarTest 锁定)不受影响。ArchitectureCraftRenderRouting,配套单元测试。验证 / Verification
./gradlew build --no-daemon全绿(含桥契约 JarTest、MixinConfigurationTest)。ArchitectureCraftRenderRoutingTest通过。curse.maven:architecturecraft-tridev-277631:4344128(3.108)实机验证通过(shape / sawbench 渲染与光照正常)。