File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/dynamic_resources Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .embeddedt .modernfix .common .mixin .perf .dynamic_resources ;
2+
3+ import net .minecraft .client .resources .model .BakedModel ;
4+ import net .minecraft .client .resources .model .ModelManager ;
5+ import net .minecraft .resources .ResourceLocation ;
6+ import org .spongepowered .asm .mixin .Mixin ;
7+ import org .spongepowered .asm .mixin .Shadow ;
8+ import org .spongepowered .asm .mixin .injection .At ;
9+ import org .spongepowered .asm .mixin .injection .Inject ;
10+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
11+
12+ import java .util .HashMap ;
13+ import java .util .Map ;
14+
15+ @ Mixin (ModelManager .class )
16+ public class ModelManagerMixin {
17+ @ Shadow private Map <ResourceLocation , BakedModel > bakedRegistry ;
18+
19+ @ Inject (method = "<init>" , at = @ At ("RETURN" ))
20+ private void injectDummyBakedRegistry (CallbackInfo ci ) {
21+ if (this .bakedRegistry == null ) {
22+ // Create a dummy baked registry. This prevents NPEs when mods query block models too early
23+ this .bakedRegistry = new HashMap <>();
24+ }
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments