From fe28d56ba048a0d38a4c7287e58f150ef0d4dfcf Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 16 Jul 2021 15:40:28 +1000 Subject: [PATCH 1/2] Add config option for perspective direction --- gradle.properties | 2 +- src/main/java/pm/c7/pmr/PerspectiveMod.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 617223c..86ddcaf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2G # boilerplate modId = pmr modName = PerspectiveModRedux -version = 0.0.4 +version = 0.0.5 acceptedMinecraftVersions = [1.8.9] minecraftVersion = 1.8.9 forgeVersion = 11.15.1.2318-1.8.9 diff --git a/src/main/java/pm/c7/pmr/PerspectiveMod.java b/src/main/java/pm/c7/pmr/PerspectiveMod.java index 310043e..b66c485 100644 --- a/src/main/java/pm/c7/pmr/PerspectiveMod.java +++ b/src/main/java/pm/c7/pmr/PerspectiveMod.java @@ -41,6 +41,7 @@ public class PerspectiveMod private boolean showConfig = false; private static boolean holdToUse = false; + private static boolean lookForwards = false; public boolean perspectiveEnabled = false; public float cameraPitch; @@ -109,7 +110,11 @@ public void onKey(InputEvent.KeyInputEvent event) { this.held = true; this.cameraPitch = this.client.thePlayer.rotationPitch; - this.cameraYaw = this.client.thePlayer.rotationYaw + 180.0F; + if(lookForwards) { + this.cameraYaw = this.client.thePlayer.rotationYaw - 180.0F; + } else { + this.cameraYaw = this.client.thePlayer.rotationYaw; + } this.client.gameSettings.thirdPersonView = 1; } @@ -118,7 +123,11 @@ public void onKey(InputEvent.KeyInputEvent event) { this.perspectiveEnabled = !this.perspectiveEnabled; this.cameraPitch = this.client.thePlayer.rotationPitch; - this.cameraYaw = this.client.thePlayer.rotationYaw; + if(lookForwards) { + this.cameraYaw = this.client.thePlayer.rotationYaw - 180.0F; + } else { + this.cameraYaw = this.client.thePlayer.rotationYaw; + } this.client.gameSettings.thirdPersonView = this.perspectiveEnabled ? 1 : 0; } @@ -136,7 +145,7 @@ public void cameraSetup(EntityViewRenderEvent.CameraSetup event) { public static void saveConfig() { holdToUse = config.getBoolean("Hold To Use", "main", false, null); - + lookForwards = config.getBoolean("Look Forwards", "main", false, null); config.save(); } From 55a4b13c5fecc8031a0b93c2456657ed25b2ade7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 16 Jul 2021 16:25:07 +1000 Subject: [PATCH 2/2] Change default direction to align with other versions --- src/main/java/pm/c7/pmr/PerspectiveMod.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pm/c7/pmr/PerspectiveMod.java b/src/main/java/pm/c7/pmr/PerspectiveMod.java index b66c485..d8b0733 100644 --- a/src/main/java/pm/c7/pmr/PerspectiveMod.java +++ b/src/main/java/pm/c7/pmr/PerspectiveMod.java @@ -145,7 +145,7 @@ public void cameraSetup(EntityViewRenderEvent.CameraSetup event) { public static void saveConfig() { holdToUse = config.getBoolean("Hold To Use", "main", false, null); - lookForwards = config.getBoolean("Look Forwards", "main", false, null); + lookForwards = config.getBoolean("Look Forwards", "main", true, null); config.save(); }