2727import io .github .axolotlclient .oldanimations .util .*;
2828import net .minecraft .block .Block ;
2929import net .minecraft .client .Minecraft ;
30+ import net .minecraft .client .render .item .ItemModelShaper ;
3031import net .minecraft .client .render .item .ItemRenderer ;
3132import net .minecraft .client .render .model .block .ModelTransformations ;
3233import net .minecraft .client .render .texture .TextureManager ;
34+ import net .minecraft .client .resource .ModelIdentifier ;
3335import net .minecraft .client .resource .model .BakedModel ;
3436import net .minecraft .client .resource .model .BakedQuad ;
3537import net .minecraft .entity .living .LivingEntity ;
@@ -69,6 +71,9 @@ public abstract class ItemRendererMixin {
6971 @ Shadow
7072 public abstract boolean isGui3d (ItemStack itemStack );
7173
74+ @ Shadow
75+ public abstract ItemModelShaper getModelShaper ();
76+
7277 @ Unique
7378 private boolean axolotlclient$isGui ;
7479
@@ -114,7 +119,7 @@ public abstract class ItemRendererMixin {
114119
115120 @ ModifyArg (method = "renderItem" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/render/item/ItemRenderer;renderEnchantmentGlint(Lnet/minecraft/client/resource/model/BakedModel;)V" ))
116121 public BakedModel axolotlclient$replaceModel (BakedModel model ) {
117- return OldAnimationsConfig .isEnabled () && OldAnimationsConfig .instance .oldGlint .get () ? GlintModel .getModel (model ) : model ;
122+ return OldAnimationsConfig .isEnabled () && OldAnimationsConfig .instance .oldGlint .get () ? GlintHandler .getModel (model ) : model ;
118123 }
119124
120125 @ ModifyArg (method = "render(Lnet/minecraft/client/resource/model/BakedModel;I)V" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/render/item/ItemRenderer;render(Lnet/minecraft/client/resource/model/BakedModel;ILnet/minecraft/item/ItemStack;)V" ), index = 1 )
@@ -125,11 +130,13 @@ public abstract class ItemRendererMixin {
125130
126131 @ Inject (method = "renderEnchantmentGlint" , at = @ At ("HEAD" ), cancellable = true )
127132 private void axolotlclient$disableDefaultGlint (CallbackInfo ci ) {
128- if (OldAnimationsConfig .isEnabled () && OldAnimationsConfig .instance .oldGuiGlint .get () && axolotlclient$isGui ) {
129- ci .cancel ();
130- }
131- if (OldAnimationsConfig .isEnabled () && OldAnimationsConfig .instance .fastItems .get () && !axolotlclient$isGui && !axolotlclient$isHeld ) {
132- ci .cancel ();
133+ if (OldAnimationsConfig .isEnabled ()) {
134+ if (OldAnimationsConfig .instance .oldGuiGlint .get () && axolotlclient$isGui ) {
135+ ci .cancel ();
136+ }
137+ if (OldAnimationsConfig .instance .fastItems .get () && !axolotlclient$isGui && !axolotlclient$isHeld ) {
138+ ci .cancel ();
139+ }
133140 }
134141 }
135142
@@ -177,7 +184,7 @@ public abstract class ItemRendererMixin {
177184 !axolotlclient$isGui && stack .getItem () instanceof PotionItem &&
178185 /* just to be safe, let's skip rendering while projectiles and dropped items are 2d */
179186 (!OldAnimationsConfig .instance .fastItems .get () || axolotlclient$isHeld )) {
180- model = ModelUtil . getModel ("bottle_overlay" );
187+ model = axolotlclient$ getModel ("bottle_overlay" );
181188 }
182189 original .call (instance , model , stack );
183190 }
@@ -191,7 +198,7 @@ public abstract class ItemRendererMixin {
191198 /* renders the splash/drinkable bottle AFTER the glint rendering like in 1.7 */
192199 String id = PotionItem .isSplashPotion (stack .getMetadata ()) ? "bottle_splash_empty" : "bottle_drinkable_empty" ;
193200 /* hacky way of rendering the bottle without using the potion's overlay color */
194- render (ModelUtil . getModel (id ), DummyItem .getStack ());
201+ render (axolotlclient$ getModel (id ), ItemUtil . DummyItem .getStack ());
195202 }
196203 }
197204
@@ -265,4 +272,9 @@ public abstract class ItemRendererMixin {
265272 }
266273 }
267274 }
275+
276+ @ Unique
277+ private BakedModel axolotlclient$getModel (String model ) {
278+ return getModelShaper ().getManager ().getModel (new ModelIdentifier (model , "inventory" ));
279+ }
268280}
0 commit comments