Skip to content

Commit

Permalink
Reset block predicate when model is loaded
Browse files Browse the repository at this point in the history
Should help invalidate Embeddium's cache
  • Loading branch information
embeddedt committed Dec 19, 2023
1 parent aa53a76 commit 9c00f72
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ private void refreshLayerHacks() {
if(original == null)
original = DEFAULT_PREDICATE;
blockRenderChecks.put(block.delegate, original);
ItemBlockRenderTypes.setRenderLayer(block, type -> this.useOverrideIfPresent(block.delegate, type));
updateBlockPredicate(block);
}
}
}

private void updateBlockPredicate(Block block) {
ItemBlockRenderTypes.setRenderLayer(block, type -> this.useOverrideIfPresent(block.delegate, type));
}

private boolean useOverrideIfPresent(IRegistryDelegate<Block> delegate, RenderType type) {
Predicate<RenderType> override = renderCheckOverrides.get(delegate);
if(override == null)
Expand Down Expand Up @@ -97,6 +101,7 @@ public BakedModel onBakedModelLoad(ResourceLocation location, UnbakedModel baseM
Predicate<RenderType> newPredicate = this.getLayerCheck(state, originalModel);
if(newPredicate != null) {
renderCheckOverrides.put(block.delegate, newPredicate);
updateBlockPredicate(block);
return originalModel;
}
}
Expand Down

0 comments on commit 9c00f72

Please sign in to comment.