aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/djtheredstoner/perspectivemod/mixins/MixinRenderManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/djtheredstoner/perspectivemod/mixins/MixinRenderManager.java')
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/mixins/MixinRenderManager.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/mixins/MixinRenderManager.java b/src/main/java/me/djtheredstoner/perspectivemod/mixins/MixinRenderManager.java
new file mode 100644
index 0000000..469d7fa
--- /dev/null
+++ b/src/main/java/me/djtheredstoner/perspectivemod/mixins/MixinRenderManager.java
@@ -0,0 +1,24 @@
+package me.djtheredstoner.perspectivemod.mixins;
+
+import me.djtheredstoner.perspectivemod.PerspectiveMod;
+import net.minecraft.client.renderer.entity.RenderManager;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+import static org.objectweb.asm.Opcodes.*;
+
+@Mixin(RenderManager.class)
+public class MixinRenderManager {
+
+ @Redirect(method = "cacheActiveRenderInfo", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/RenderManager;playerViewX:F", opcode = PUTFIELD))
+ public void getPlayerViewX(RenderManager renderManager, float value) {
+ renderManager.playerViewX = PerspectiveMod.perspectiveToggled ? PerspectiveMod.cameraPitch : value;
+ }
+
+ @Redirect(method = "cacheActiveRenderInfo", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/RenderManager;playerViewY:F", opcode = PUTFIELD))
+ public void getPlayerViewY(RenderManager renderManager, float value) {
+ renderManager.playerViewY = PerspectiveMod.perspectiveToggled ? PerspectiveMod.cameraYaw : value;
+ }
+
+}