From 4833da8de9526e0efb75c6156f0a203e0253bd01 Mon Sep 17 00:00:00 2001 From: Past Ennui Date: Sun, 8 Dec 2019 02:17:31 -0300 Subject: [PATCH] Get 1.0.0 Ready. --- build.gradle | 2 +- .../io/github/joaoh1/okzoomer/OkZoomer.java | 116 +++++++++--------- .../joaoh1/okzoomer/OkZoomerConfig.java | 12 +- .../resources/assets/okzoomer/lang/en_us.json | 5 +- 4 files changed, 71 insertions(+), 64 deletions(-) diff --git a/build.gradle b/build.gradle index e40ad30e..a7487f01 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_13 +sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 archivesBaseName = project.archives_base_name diff --git a/src/main/java/io/github/joaoh1/okzoomer/OkZoomer.java b/src/main/java/io/github/joaoh1/okzoomer/OkZoomer.java index ee892c5d..9cff9801 100644 --- a/src/main/java/io/github/joaoh1/okzoomer/OkZoomer.java +++ b/src/main/java/io/github/joaoh1/okzoomer/OkZoomer.java @@ -50,6 +50,7 @@ public static double round(double number, int places) { Double smoothing = 1.0 - 0.5; Integer cinematicModeToggleCooldown = 1; + Integer timesToRepeatZoomCheck = 1; Integer zoomProgress = 0; Integer zoomToggleCooldown = 1; @@ -81,66 +82,72 @@ public void onInitializeClient() { } else { minecraft.options.smoothCameraEnabled = false; } - } - - if (zoomKeyBinding.isPressed() || zoomProgress == 1) { - if (config.zoomToggle) { - zoomPressed = toggleBooleanByKeybind(zoomPressed, zoomToggleCooldown); - zoomToggleCooldown = 3; - } else { - zoomPressed = true; - } + } + + if (config.smoothTransition) { + timesToRepeatZoomCheck = 4; + } else { + timesToRepeatZoomCheck = 1; + } - if (zoomPressed && zoomProgress != 2) { - smoothing = round(smoothing * 2, 4); - zoomProgress = 1; - if (!config.smoothTransition || config.zoomMultiplier == 1.0) { - smoothing = config.zoomMultiplier; - } - if (smoothing >= config.zoomMultiplier) { - smoothing = config.zoomMultiplier / config.smoothDivisor; - minecraft.options.fov = realFov * config.zoomMultiplier; - fovProcessing = false; - zoomProgress = 2; - } else { - if (config.zoomMultiplier > 1.0) { - minecraft.options.fov = realFov * (1.0 + smoothing); - } else { - minecraft.options.fov = realFov * (1.0 - smoothing); - } + for (int i = 0; i < timesToRepeatZoomCheck; i++) { + if (zoomKeyBinding.isPressed() || zoomProgress == 1) { + if (config.zoomToggle) { + zoomPressed = toggleBooleanByKeybind(zoomPressed, zoomToggleCooldown); + zoomToggleCooldown = 3; + } else { + zoomPressed = true; } - } else if ((!zoomPressed && zoomProgress == 2)|| zoomProgress == 1) { + + if (zoomPressed && zoomProgress != 2) { smoothing = round(smoothing * 2, 4); zoomProgress = 1; if (!config.smoothTransition || config.zoomMultiplier == 1.0) { - smoothing = config.zoomMultiplier; - } - if (smoothing >= config.zoomMultiplier) { - smoothing = config.zoomMultiplier / config.smoothDivisor; - minecraft.options.fov = realFov; - fovProcessing = true; - zoomProgress = 0; + smoothing = config.zoomMultiplier; + } + if (smoothing >= config.zoomMultiplier) { + smoothing = config.zoomMultiplier / config.smoothDivisor; + minecraft.options.fov = realFov * config.zoomMultiplier; + fovProcessing = false; + zoomProgress = 2; } else { if (config.zoomMultiplier > 1.0) { - minecraft.options.fov = realFov * (config.zoomMultiplier - smoothing); + minecraft.options.fov = realFov * (1.0 + smoothing); } else { - minecraft.options.fov = realFov * (config.zoomMultiplier + smoothing); + minecraft.options.fov = realFov * (1.0 - smoothing); } } - } - } else { - if (config.zoomToggle) { - zoomToggleCooldown = 1; - } else { - if (zoomProgress != 0 || !fovProcessing || zoomProgress == 1) { + } else if ((!zoomPressed && zoomProgress == 2)|| zoomProgress == 1) { + smoothing = round(smoothing * 2, 4); + zoomProgress = 1; + if (!config.smoothTransition || config.zoomMultiplier == 1.0) { + smoothing = config.zoomMultiplier; + } + if (smoothing >= config.zoomMultiplier) { + smoothing = config.zoomMultiplier / config.smoothDivisor; + minecraft.options.fov = realFov; + fovProcessing = true; + zoomProgress = 0; + } else { + if (config.zoomMultiplier > 1.0) { + minecraft.options.fov = realFov * (config.zoomMultiplier - smoothing); + } else { + minecraft.options.fov = realFov * (config.zoomMultiplier + smoothing); + } + } + } + } else { + if (config.zoomToggle) { + zoomToggleCooldown = 1; + } else if (zoomProgress != 0 || !fovProcessing || zoomProgress == 1) { smoothing = round(smoothing * 2, 4); zoomProgress = 0; if (!config.smoothTransition || config.zoomMultiplier == 1.0) { - smoothing = config.zoomMultiplier; - } - if (smoothing >= config.zoomMultiplier) { - smoothing = config.zoomMultiplier / config.smoothDivisor; - minecraft.options.fov = realFov; + smoothing = config.zoomMultiplier; + } + if (smoothing >= config.zoomMultiplier) { + smoothing = config.zoomMultiplier / config.smoothDivisor; + minecraft.options.fov = realFov; fovProcessing = true; zoomProgress = 0; zoomPressed = false; @@ -149,14 +156,13 @@ public void onInitializeClient() { } else { minecraft.options.fov = realFov * (config.zoomMultiplier + smoothing); } - } - } - - if (fovProcessing && zoomProgress == 0) { - smoothing = config.zoomMultiplier / config.smoothDivisor; - realFov = minecraft.options.fov; - } - } + } + if (fovProcessing && zoomProgress == 0) { + smoothing = config.zoomMultiplier / config.smoothDivisor; + realFov = minecraft.options.fov; + } + } + } }); } } diff --git a/src/main/java/io/github/joaoh1/okzoomer/OkZoomerConfig.java b/src/main/java/io/github/joaoh1/okzoomer/OkZoomerConfig.java index 18e904ff..918e5b73 100644 --- a/src/main/java/io/github/joaoh1/okzoomer/OkZoomerConfig.java +++ b/src/main/java/io/github/joaoh1/okzoomer/OkZoomerConfig.java @@ -6,19 +6,19 @@ @Config(name = "okzoomer") public class OkZoomerConfig implements ConfigData { - @Comment("Enables Smooth Camera while zooming, interfers with Cinematic Mode but shouldn't be anything negative.") + @Comment("Enables Smooth Camera while zooming, interfers with Cinematic Mode but it shouldn't be anything negative.") @ConfigEntry.Gui.Tooltip(count = 2) boolean smoothCamera = true; - @Comment("Enables Smooth Transitions when zooming in and out. WARNING: It might be prone to breakage, be careful.") + @Comment("Enables Smooth Transitions when zooming in and out.\nWARNING: It might be prone to breakage, be careful.") @ConfigEntry.Gui.Tooltip(count = 2) boolean smoothTransition = false; - @Comment("The divisor used while applying smoothing, less is faster, more is slower.") - @ConfigEntry.Gui.Tooltip() - int smoothDivisor = 32; + @Comment("The divisor used while applying smoothing, smaller number zooms faster, higher is slower.") + @ConfigEntry.Gui.Tooltip(count = 2) + int smoothDivisor = 64; @Comment("Enables the ability to toggle zooming.") @ConfigEntry.Gui.Tooltip() boolean zoomToggle = false; - @Comment("The multiplier applied to the FOV when zooming. 1.25 is the recommended maximum,\nanything above that will break the FOV.") + @Comment("The multiplier applied to the FOV when zooming.\n1.25 is the recommended maximum, anything above that will break the FOV.") @ConfigEntry.Gui.Tooltip(count = 3) double zoomMultiplier = 0.5; diff --git a/src/main/resources/assets/okzoomer/lang/en_us.json b/src/main/resources/assets/okzoomer/lang/en_us.json index 8ee6185d..b14df8f7 100644 --- a/src/main/resources/assets/okzoomer/lang/en_us.json +++ b/src/main/resources/assets/okzoomer/lang/en_us.json @@ -2,9 +2,10 @@ "key.okzoomer.zoom": "Zoom", "text.autoconfig.okzoomer.option.smoothCamera": "Smooth Camera", "text.autoconfig.okzoomer.option.smoothCamera.@Tooltip[0]": "Enables Smooth Camera while zooming,", - "text.autoconfig.okzoomer.option.smoothCamera.@Tooltip[1]":"interfers with Cinematic Mode but shouldn't be anything negative.", + "text.autoconfig.okzoomer.option.smoothCamera.@Tooltip[1]":"interfers with Cinematic Mode but it shouldn't be anything negative.", "text.autoconfig.okzoomer.option.smoothDivisor": "Smooth Zoom Divisor", - "text.autoconfig.okzoomer.option.smoothDivisor.@Tooltip": "Enables the ability to toggle zooming.", + "text.autoconfig.okzoomer.option.smoothDivisor.@Tooltip[0]": "The divisor used while applying smoothing,", + "text.autoconfig.okzoomer.option.smoothDivisor.@Tooltip[1]": "smaller number zooms faster, higher is slower.", "text.autoconfig.okzoomer.option.zoomMultiplier": "Zoom Multiplier", "text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[0]": "The multiplier applied to the FOV when zooming.", "text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[1]": "1.25 is the recommended maximum,",