aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java
blob: a6ea7880805cc9629eee2a42afa25602f269fb18 (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
29
30
31
32
package me.djtheredstoner.perspectivemod.asm.hooks;

import me.djtheredstoner.perspectivemod.PerspectiveMod;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;

public class EntityRendererHook {

    public static float rotationYawHook(Entity entity) {
        return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraYaw : entity.rotationYaw;
    }

    public static float prevRotationYawHook(Entity entity) {
        return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraYaw : entity.prevRotationYaw;
    }

    public static float rotationPitchHook(Entity entity) {
        return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraPitch : entity.rotationPitch;
    }

    public static float prevRotationPitchHook(Entity entity) {
        return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraPitch : entity.prevRotationPitch;
    }

    public static boolean mouseHook(Minecraft minecraft) {
        return PerspectiveMod.instance == null ? minecraft.inGameHasFocus : PerspectiveMod.instance.overrideMouse();
    }

    public static double distanceHook(double value) {
        return value;
    }
}