aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dulkirmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dulkirmod')
-rw-r--r--src/main/java/dulkirmod/mixins/ItemRendererMixin.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/dulkirmod/mixins/ItemRendererMixin.java b/src/main/java/dulkirmod/mixins/ItemRendererMixin.java
index 54b4d45..18fd72a 100644
--- a/src/main/java/dulkirmod/mixins/ItemRendererMixin.java
+++ b/src/main/java/dulkirmod/mixins/ItemRendererMixin.java
@@ -3,7 +3,11 @@ package dulkirmod.mixins;
import dulkirmod.features.ItemAnimations;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.client.renderer.entity.RenderItem;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -11,6 +15,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = {ItemRenderer.class})
public class ItemRendererMixin {
+ @Shadow @Final private RenderItem itemRenderer;
+
+ @Shadow private ItemStack itemToRender;
+
@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();
@@ -24,5 +32,6 @@ public class ItemRendererMixin {
@Inject(method ={"performDrinking"}, at = @At("HEAD"), cancellable = true)
public void drinkTransform(AbstractClientPlayer clientPlayer, float partialTicks, CallbackInfo ci) {
if (ItemAnimations.INSTANCE.rotationlessDrink(clientPlayer, partialTicks)) ci.cancel();
+ if (ItemAnimations.INSTANCE.scaledDrinking(clientPlayer, partialTicks, itemToRender)) ci.cancel();
}
}