44import net .minecraft .client .resources .model .BakedModel ;
55import net .minecraft .client .resources .model .ModelManager ;
66import net .minecraft .client .resources .model .ModelResourceLocation ;
7- import net .minecraft .core .Holder ;
87import net .minecraft .resources .ResourceLocation ;
98import net .minecraft .world .item .Item ;
109import net .neoforged .neoforge .client .model .RegistryAwareItemModelShaper ;
2322@ Mixin (RegistryAwareItemModelShaper .class )
2423@ ClientOnlyMixin
2524public abstract class ItemModelMesherForgeMixin extends ItemModelShaper {
26- @ Shadow (remap = false ) @ Final @ Mutable private Map <Holder . Reference < Item > , ModelResourceLocation > locations ;
25+ @ Shadow (remap = false ) @ Final @ Mutable private Map <Item , ModelResourceLocation > locations ;
2726
28- private Map <Holder . Reference < Item > , ModelResourceLocation > overrideLocations ;
27+ private Map <Item , ModelResourceLocation > overrideLocations ;
2928
30- private final DynamicModelCache <Holder . Reference < Item >> mfix$modelCache = new DynamicModelCache <>(k -> this .mfix$getModelSlow ((Holder . Reference < Item > )k ), true );
29+ private final DynamicModelCache <Item > mfix$modelCache = new DynamicModelCache <>(k -> this .mfix$getModelSlow ((Item )k ), true );
3130
3231 public ItemModelMesherForgeMixin (ModelManager arg ) {
3332 super (arg );
@@ -43,16 +42,16 @@ private void replaceLocationMap(CallbackInfo ci) {
4342 }
4443
4544 @ Unique
46- private ModelResourceLocation mfix$getLocationForge (Holder . Reference < Item > item ) {
45+ private ModelResourceLocation mfix$getLocationForge (Item item ) {
4746 ModelResourceLocation map = overrideLocations .getOrDefault (item , SENTINEL );
4847 if (map == SENTINEL ) {
4948 /* generate the appropriate location from our cache */
50- map = ModelLocationCache .get (item . value () );
49+ map = ModelLocationCache .get (item );
5150 }
5251 return map ;
5352 }
5453
55- private BakedModel mfix$getModelSlow (Holder . Reference < Item > key ) {
54+ private BakedModel mfix$getModelSlow (Item key ) {
5655 ModelResourceLocation map = mfix$getLocationForge (key );
5756 return map == null ? null : getModelManager ().getModel (map );
5857 }
@@ -65,7 +64,7 @@ private void replaceLocationMap(CallbackInfo ci) {
6564 @ Overwrite
6665 @ Override
6766 public BakedModel getItemModel (Item item ) {
68- return this .mfix$modelCache .get (item . builtInRegistryHolder () );
67+ return this .mfix$modelCache .get (item );
6968 }
7069
7170 /**
@@ -76,7 +75,7 @@ public BakedModel getItemModel(Item item) {
7675 @ Overwrite
7776 @ Override
7877 public void register (Item item , ModelResourceLocation location ) {
79- overrideLocations .put (item . builtInRegistryHolder () , location );
78+ overrideLocations .put (item , location );
8079 }
8180
8281 /**
0 commit comments