aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks
diff options
context:
space:
mode:
authorDJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com>2020-09-09 10:15:38 -0400
committerDJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com>2020-09-09 10:16:13 -0400
commitbed926539ae75971011a44a7022b215ab9ffcf29 (patch)
treea9610603db6f4df60a86f1fb81cf0ecc53b2b552 /src/main/java/me/djtheredstoner/perspectivemod/asm/hooks
parent07c0bb61e381293fc85ecf9ad01ab727e00efb00 (diff)
downloadPerspectiveModv4-bed926539ae75971011a44a7022b215ab9ffcf29.tar.gz
PerspectiveModv4-bed926539ae75971011a44a7022b215ab9ffcf29.tar.bz2
PerspectiveModv4-bed926539ae75971011a44a7022b215ab9ffcf29.zip
Did someone say ASM Rewrite???!!!
Diffstat (limited to 'src/main/java/me/djtheredstoner/perspectivemod/asm/hooks')
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java29
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java16
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java15
3 files changed, 60 insertions, 0 deletions
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();
+ }
+
+}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java
new file mode 100644
index 0000000..e502232
--- /dev/null
+++ b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java
@@ -0,0 +1,16 @@
+package me.djtheredstoner.perspectivemod.asm.hooks;
+
+import me.djtheredstoner.perspectivemod.PerspectiveMod;
+import net.minecraft.client.settings.GameSettings;
+
+public class MinecraftHook {
+
+ public static void thirdPersonHook(GameSettings gameSettings, int value) {
+ if(PerspectiveMod.perspectiveToggled) {
+ PerspectiveMod.resetPerspective();
+ } else {
+ gameSettings.thirdPersonView = value;
+ }
+ }
+
+}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java
new file mode 100644
index 0000000..3373378
--- /dev/null
+++ b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java
@@ -0,0 +1,15 @@
+package me.djtheredstoner.perspectivemod.asm.hooks;
+
+import me.djtheredstoner.perspectivemod.PerspectiveMod;
+import net.minecraft.client.renderer.entity.RenderManager;
+
+public class RenderManagerHook {
+
+ public static void playerViewXHook(RenderManager renderManager, float value) {
+ renderManager.playerViewX = PerspectiveMod.perspectiveToggled ? PerspectiveMod.cameraPitch : value;
+ }
+
+ public static void playerViewYHook(RenderManager renderManager, float value) {
+ renderManager.playerViewY = PerspectiveMod.perspectiveToggled ? PerspectiveMod.cameraYaw : value;
+ }
+}