aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ItemRendererMixin.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ItemRendererMixin.java')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ItemRendererMixin.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ItemRendererMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ItemRendererMixin.java
new file mode 100644
index 0000000..1679188
--- /dev/null
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ItemRendererMixin.java
@@ -0,0 +1,25 @@
+package shcm.shsupercm.fabric.citresewn.mixin;
+
+import net.minecraft.client.render.item.ItemRenderer;
+import net.minecraft.client.render.model.BakedModel;
+import net.minecraft.entity.LivingEntity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+import shcm.shsupercm.fabric.citresewn.CITResewn;
+
+@Mixin(ItemRenderer.class)
+public class ItemRendererMixin {
+ @Inject(method = "getHeldItemModel", cancellable = true, at = @At("RETURN"))
+ public void getItemModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) {
+ if (CITResewn.INSTANCE.activeCITs == null)
+ return;
+
+ BakedModel citModel = CITResewn.INSTANCE.activeCITs.getItemModel(stack, cir.getReturnValue());
+ if (citModel != null)
+ cir.setReturnValue(citModel);
+ }
+}