diff options
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/custommodels/ItemRendererTintContextPatch.java')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/custommodels/ItemRendererTintContextPatch.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/custommodels/ItemRendererTintContextPatch.java b/src/main/java/moe/nea/firmament/mixins/custommodels/ItemRendererTintContextPatch.java index 66feced..8c5411b 100644 --- a/src/main/java/moe/nea/firmament/mixins/custommodels/ItemRendererTintContextPatch.java +++ b/src/main/java/moe/nea/firmament/mixins/custommodels/ItemRendererTintContextPatch.java @@ -18,7 +18,8 @@ public class ItemRendererTintContextPatch { @Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;ZF)V", at = @At(value = "HEAD"), allow = 1) private void onStartRendering(ItemStack stack, ModelTransformationMode transformationMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, boolean useInventoryModel, float z, CallbackInfo ci) { - if (model instanceof BakedModelExtra extra) { + var extra = BakedModelExtra.cast(model); + if (extra != null) { TintOverrides.Companion.enter(extra.getTintOverrides_firmament()); } } @@ -26,7 +27,8 @@ public class ItemRendererTintContextPatch { @Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;ZF)V", at = @At("TAIL"), allow = 1) private void onEndRendering(ItemStack stack, ModelTransformationMode transformationMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, boolean useInventoryModel, float z, CallbackInfo ci) { - if (model instanceof BakedModelExtra extra) { + var extra = BakedModelExtra.cast(model); + if (extra != null) { TintOverrides.Companion.exit(extra.getTintOverrides_firmament()); } } |