From 5281f84a2ac8eb2e36ce004124454d85d7cc73f2 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Mon, 1 Jul 2024 02:11:49 +0200 Subject: [PATCH] fix: useAO out of bounds because not using model id --- .../reframed/client/model/RetexturingBakedModel.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java b/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java index 8edad70..6c1b92c 100644 --- a/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java +++ b/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java @@ -190,9 +190,14 @@ public abstract class RetexturingBakedModel extends ForwardingBakedModel { public boolean useAmbientOcclusion(BlockRenderView view, BlockPos pos) { if (!(view.getBlockEntity(pos) instanceof ThemeableBlockEntity frame_entity)) return false; + BlockState theme = frame_entity.getTheme(theme_index); CamoAppearance appearance = appearance_manager - .getCamoAppearance(view, frame_entity.getTheme(theme_index), pos, theme_index, false); - return appearance.getAO(theme_index); + .getCamoAppearance(view, theme, pos, theme_index, false); + + long seed = theme.getRenderingSeed(pos); + int model_id = 0; + if (appearance instanceof WeightedComputedAppearance wca) model_id = wca.getAppearanceIndex(seed); + return appearance.getAO(model_id); } protected Mesh getRetexturedMesh(MeshCacheKey key, BlockState state) {