From bed926539ae75971011a44a7022b215ab9ffcf29 Mon Sep 17 00:00:00 2001 From: DJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com> Date: Wed, 9 Sep 2020 10:15:38 -0400 Subject: Did someone say ASM Rewrite???!!! --- .../asm/hooks/EntityRendererHook.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java (limited to 'src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java') diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java new file mode 100644 index 0000000..3ee3c9e --- /dev/null +++ b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java @@ -0,0 +1,29 @@ +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.perspectiveToggled ? PerspectiveMod.cameraYaw : entity.rotationYaw; + } + + public static float prevRotationYawHook(Entity entity) { + return PerspectiveMod.perspectiveToggled ? PerspectiveMod.cameraYaw : entity.prevRotationYaw; + } + + public static float rotationPitchHook(Entity entity) { + return PerspectiveMod.perspectiveToggled ? PerspectiveMod.cameraPitch : entity.rotationPitch; + } + + public static float prevRotationPitchHook(Entity entity) { + return PerspectiveMod.perspectiveToggled ? PerspectiveMod.cameraPitch : entity.prevRotationPitch; + } + + public static boolean mouseHook(Minecraft minecraft) { + return PerspectiveMod.overrideMouse(); + } + +} -- cgit