aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dulkirmod/mixins/MixinEntityRenderer.java
blob: f754f2c8e893b93b537af309885493906ec04873 (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
package dulkirmod.mixins;

import dulkirmod.features.HurtCamSlider;
import dulkirmod.features.ViewBobbing;
import net.minecraft.client.renderer.EntityRenderer;
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(EntityRenderer.class)
public class MixinEntityRenderer {

    @Inject(method = "hurtCameraEffect", at = @At("HEAD"), cancellable = true)
    private void hurtCameraEffect(float partialTicks, CallbackInfo ci) {
        if (HurtCamSlider.INSTANCE.renderHurt(partialTicks))
            ci.cancel();
    }

    @Inject(method = "setupViewBobbing", at = @At("HEAD"), cancellable = true)
    private void modifyViewBobbing(float partialTicks, CallbackInfo ci) {
        if (ViewBobbing.INSTANCE.renderBob(partialTicks))
            ci.cancel();
    }
}