blob: 54b4d45bab998a0192eb03cc21bcae1bb2dae0f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package dulkirmod.mixins;
import dulkirmod.features.ItemAnimations;
import net.minecraft.client.entity.AbstractClientPlayer;
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();
}
@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();
}
}
|