aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dulkirmod/mixins/ItemRendererMixin.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dulkirmod/mixins/ItemRendererMixin.java')
-rw-r--r--src/main/java/dulkirmod/mixins/ItemRendererMixin.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/dulkirmod/mixins/ItemRendererMixin.java b/src/main/java/dulkirmod/mixins/ItemRendererMixin.java
new file mode 100644
index 0000000..9db5c9d
--- /dev/null
+++ b/src/main/java/dulkirmod/mixins/ItemRendererMixin.java
@@ -0,0 +1,22 @@
+package dulkirmod.mixins;
+
+import dulkirmod.features.ItemAnimations;
+import net.minecraft.client.renderer.ItemRenderer;
+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.CallbackInfo;
+
+@Mixin(value = {ItemRenderer.class})
+public class ItemRendererMixin {
+
+ @Inject(method = {"transformFirstPersonItem(FF)V"}, at = @At("HEAD"), cancellable = true)
+ public void itemTransform(float equipProgress, float swingProgress, CallbackInfo ci) {
+ if (ItemAnimations.INSTANCE.itemTransforHook(equipProgress, swingProgress)) ci.cancel();
+ }
+
+ @Inject(method = {"doItemUsedTransformations"}, at = @At("HEAD"), cancellable = true)
+ public void useTransform(float swingProgress, CallbackInfo ci){
+ if (ItemAnimations.INSTANCE.scaledSwing(swingProgress)) ci.cancel();
+ }
+}