fix: useAO out of bounds because not using model id

This commit is contained in:
Adrien1106 2024-07-01 02:11:49 +02:00
parent eac948bf5d
commit 5281f84a2a

View File

@ -190,9 +190,14 @@ public abstract class RetexturingBakedModel extends ForwardingBakedModel {
public boolean useAmbientOcclusion(BlockRenderView view, BlockPos pos) { public boolean useAmbientOcclusion(BlockRenderView view, BlockPos pos) {
if (!(view.getBlockEntity(pos) instanceof ThemeableBlockEntity frame_entity)) return false; if (!(view.getBlockEntity(pos) instanceof ThemeableBlockEntity frame_entity)) return false;
BlockState theme = frame_entity.getTheme(theme_index);
CamoAppearance appearance = appearance_manager CamoAppearance appearance = appearance_manager
.getCamoAppearance(view, frame_entity.getTheme(theme_index), pos, theme_index, false); .getCamoAppearance(view, theme, pos, theme_index, false);
return appearance.getAO(theme_index);
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) { protected Mesh getRetexturedMesh(MeshCacheKey key, BlockState state) {