diff options
author | UserTeemu <20520700+UserTeemu@users.noreply.github.com> | 2021-02-27 17:58:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-27 10:58:53 -0500 |
commit | 7a42b12aa3bbb389dd1cdc9c1bd2d81b8a4da2bb (patch) | |
tree | 992c4a5348fe725f2be0dfe6ce3ab25006001936 /src | |
parent | 1ed4bd9177d3a6f3c23fd927e2096dd4da96f98e (diff) | |
download | PerspectiveModv4-7a42b12aa3bbb389dd1cdc9c1bd2d81b8a4da2bb.tar.gz PerspectiveModv4-7a42b12aa3bbb389dd1cdc9c1bd2d81b8a4da2bb.tar.bz2 PerspectiveModv4-7a42b12aa3bbb389dd1cdc9c1bd2d81b8a4da2bb.zip |
Simplify entering and exiting (#11)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java b/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java index 7adc1f5..dd48d4c 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java @@ -75,15 +75,13 @@ public class PerspectiveMod { public void onPressed(boolean state) { if (config.modEnabled) { if (state) { - perspectiveToggled = !perspectiveToggled; cameraYaw = mc.thePlayer.rotationYaw; cameraPitch = mc.thePlayer.rotationPitch; if (perspectiveToggled) { - previousPerspective = mc.gameSettings.thirdPersonView; - mc.gameSettings.thirdPersonView = 1; + resetPerspective(); } else { - mc.gameSettings.thirdPersonView = previousPerspective; + enterPerspective(); } } else if (config.holdMode) { resetPerspective(); @@ -93,6 +91,17 @@ public class PerspectiveMod { } } + public void enterPerspective() { + perspectiveToggled = true; + previousPerspective = mc.gameSettings.thirdPersonView; + mc.gameSettings.thirdPersonView = 1; + } + + public void resetPerspective() { + perspectiveToggled = false; + mc.gameSettings.thirdPersonView = previousPerspective; + } + public boolean overrideMouse() { if (mc.inGameHasFocus && Display.isActive()) { if (!perspectiveToggled) { @@ -120,9 +129,4 @@ public class PerspectiveMod { return false; } - - public void resetPerspective() { - perspectiveToggled = false; - mc.gameSettings.thirdPersonView = previousPerspective; - } } |