File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
common/src/main/java/org/embeddedt/modernfix
common/mixin/perf/dynamic_resources Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 33import net .minecraft .client .renderer .block .BlockModelShaper ;
44import net .minecraft .client .resources .model .BakedModel ;
55import net .minecraft .client .resources .model .ModelManager ;
6+ import net .minecraft .client .resources .model .ModelResourceLocation ;
67import net .minecraft .world .level .block .state .BlockState ;
78import org .embeddedt .modernfix .annotation .ClientOnlyMixin ;
89import org .embeddedt .modernfix .dynamicresources .ModelLocationCache ;
@@ -37,9 +38,14 @@ private void replaceModelMap(CallbackInfo ci) {
3738 public void rebuildCache () {
3839 }
3940
41+ /**
42+ * @author embeddedt
43+ * @reason get the model from the dynamic model provider
44+ */
4045 @ Overwrite
4146 public BakedModel getBlockModel (BlockState state ) {
42- BakedModel model = modelManager .getModel (ModelLocationCache .get (state ));
47+ ModelResourceLocation mrl = ModelLocationCache .get (state );
48+ BakedModel model = mrl == null ? null : modelManager .getModel (mrl );
4349 if (model == null ) {
4450 model = modelManager .getMissingModel ();
4551 }
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ public ModelResourceLocation load(Item key) throws Exception {
3131 });
3232
3333 public static ModelResourceLocation get (BlockState state ) {
34+ if (state == null )
35+ return null ;
3436 try {
3537 return blockLocationCache .get (state );
3638 } catch (ExecutionException e ) {
@@ -39,6 +41,8 @@ public static ModelResourceLocation get(BlockState state) {
3941 }
4042
4143 public static ModelResourceLocation get (Item item ) {
44+ if (item == null )
45+ return null ;
4246 try {
4347 return itemLocationCache .get (item );
4448 } catch (ExecutionException e ) {
You can’t perform that action at this time.
0 commit comments