Skip to content

Commit

Permalink
Fix handling of delegated Fabric models
Browse files Browse the repository at this point in the history
  • Loading branch information
jellysquid3 committed Dec 24, 2024
1 parent a40937b commit 7a51edc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7a51edc

Please # to comment.