From 7a51edca3e9c60a7d93ea68de4cc79fa7002154a Mon Sep 17 00:00:00 2001 From: JellySquid Date: Tue, 24 Dec 2024 14:20:09 -0600 Subject: [PATCH] Fix handling of delegated Fabric models --- .../render/chunk/compile/pipeline/BlockRenderer.java | 9 ++++++++- .../frapi/render/NonTerrainBlockRenderContext.java | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer.java index e042e129d7..0a9aef6735 100644 --- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer.java +++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer.java @@ -102,7 +102,14 @@ public void renderModel(BakedModel model, BlockState state, BlockPos pos, BlockP for (RenderType type : renderTypes) { this.type = type; - ((FabricBakedModel) model).emitBlockQuads(getEmitter(), this.level, state, pos, this.randomSupplier, this::isFaceCulled); + + var fabricModel = (FabricBakedModel) model; + + if (fabricModel.isVanillaAdapter()) { + this.bufferDefaultModel(model, state, this::isFaceCulled); + } else { + fabricModel.emitBlockQuads(this.getEmitter(), this.level, state, pos, this.randomSupplier, this::isFaceCulled); + } } type = null; diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java index 7c0a26cf11..dfcd696599 100644 --- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java +++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java @@ -76,7 +76,13 @@ public void renderModel(BlockAndTintGetter blockView, BakedModel model, BlockSta this.prepareCulling(cull); this.prepareAoInfo(model.useAmbientOcclusion()); - ((FabricBakedModel) model).emitBlockQuads(getEmitter(), blockView, state, pos, this.randomSupplier, this::isFaceCulled); + var fabricModel = (FabricBakedModel) model; + + if (fabricModel.isVanillaAdapter()) { + this.bufferDefaultModel(model, state, this::isFaceCulled); + } else { + fabricModel.emitBlockQuads(this.getEmitter(), blockView, state, pos, this.randomSupplier, this::isFaceCulled); + } this.level = null; this.type = null;