Skip to content

Commit

Permalink
It's 1.0.2!
Browse files Browse the repository at this point in the history
  • Loading branch information
Past Ennui committed Dec 15, 2019
1 parent de9cc65 commit b043251
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 67 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.2.6-SNAPSHOT'
id 'fabric-loom' version '0.2.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down
14 changes: 6 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on http://modmuss50.me/fabric.html
minecraft_version=1.15-pre6
yarn_mappings=1.15-pre6+build.3
minecraft_version=1.15.1-pre1
yarn_mappings=1.15.1-pre1+build.1
loader_version=0.7.2+build.174

# Mod Properties
mod_version = 1.0.1
mod_version = 1.0.2
maven_group = io.github.joaoh1
archives_base_name = okzoomer

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.4.20+build.273-1.15
mod_menu_version=1.8.0+build.16
cloth_config_version=2.4-unstable.201911031154
fabric_version=0.4.24+build.279-1.15
mod_menu_version=1.8.1+build.17
cloth_config_version=2.5.2
auto_config_version=1.2.4

33 changes: 12 additions & 21 deletions src/main/java/io/github/joaoh1/okzoomer/OkZoomer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Identifier;

import java.math.BigDecimal;
import java.math.RoundingMode;

import org.lwjgl.glfw.GLFW;

import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
Expand All @@ -35,12 +32,6 @@ private Boolean toggleBooleanByKeybind(Boolean toggledBoolean, Integer cooldown)

return toggledBoolean;
}

public static double round(double number, int places) {
BigDecimal bd = BigDecimal.valueOf(number);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}

Boolean cinematicMode = false;
Boolean fovProcessing = true;
Expand Down Expand Up @@ -72,7 +63,7 @@ public void onInitializeClient() {
if (config.smoothCamera) {
if (minecraft.options.keySmoothCamera.isPressed()) {
cinematicMode = toggleBooleanByKeybind(cinematicMode, cinematicModeToggleCooldown);
cinematicModeToggleCooldown = 3;
cinematicModeToggleCooldown = config.smoothTransitionOptions.timesToRepeatSmoothing;
} else {
cinematicModeToggleCooldown = 1;
}
Expand All @@ -84,7 +75,7 @@ public void onInitializeClient() {
}
}

if (config.smoothTransition) {
if (config.smoothTransitionOptions.smoothTransition) {
timesToRepeatZoomCheck = 4;
} else {
timesToRepeatZoomCheck = 1;
Expand All @@ -100,13 +91,13 @@ public void onInitializeClient() {
}

if (zoomPressed && zoomProgress != 2) {
smoothing = round(smoothing * 2, 4);
smoothing *= 2;
zoomProgress = 1;
if (!config.smoothTransition || config.zoomMultiplier == 1.0) {
if (!config.smoothTransitionOptions.smoothTransition || config.zoomMultiplier == 1.0) {
smoothing = config.zoomMultiplier;
}
if (smoothing >= config.zoomMultiplier) {
smoothing = config.zoomMultiplier / config.smoothDivisor;
smoothing = config.zoomMultiplier / config.smoothTransitionOptions.smoothDivisor;
minecraft.options.fov = realFov * config.zoomMultiplier;
fovProcessing = false;
zoomProgress = 2;
Expand All @@ -118,13 +109,13 @@ public void onInitializeClient() {
}
}
} else if ((!zoomPressed && zoomProgress == 2)|| zoomProgress == 1) {
smoothing = round(smoothing * 2, 4);
smoothing *= 2;
zoomProgress = 1;
if (!config.smoothTransition || config.zoomMultiplier == 1.0) {
if (!config.smoothTransitionOptions.smoothTransition || config.zoomMultiplier == 1.0) {
smoothing = config.zoomMultiplier;
}
if (smoothing >= config.zoomMultiplier) {
smoothing = config.zoomMultiplier / config.smoothDivisor;
smoothing = config.zoomMultiplier / config.smoothTransitionOptions.smoothDivisor;
minecraft.options.fov = realFov;
fovProcessing = true;
zoomProgress = 0;
Expand All @@ -140,13 +131,13 @@ public void onInitializeClient() {
if (config.zoomToggle) {
zoomToggleCooldown = 1;
} else if (zoomProgress != 0 || !fovProcessing || zoomProgress == 1) {
smoothing = round(smoothing * 2, 4);
smoothing *= 2;
zoomProgress = 0;
if (!config.smoothTransition || config.zoomMultiplier == 1.0) {
if (!config.smoothTransitionOptions.smoothTransition || config.zoomMultiplier == 1.0) {
smoothing = config.zoomMultiplier;
}
if (smoothing >= config.zoomMultiplier) {
smoothing = config.zoomMultiplier / config.smoothDivisor;
smoothing = config.zoomMultiplier / config.smoothTransitionOptions.smoothDivisor;
minecraft.options.fov = realFov;
fovProcessing = true;
zoomProgress = 0;
Expand All @@ -158,7 +149,7 @@ public void onInitializeClient() {
}
}
if (fovProcessing && zoomProgress == 0) {
smoothing = config.zoomMultiplier / config.smoothDivisor;
smoothing = config.zoomMultiplier / config.smoothTransitionOptions.smoothDivisor;
realFov = minecraft.options.fov;
}
}
Expand Down
38 changes: 25 additions & 13 deletions src/main/java/io/github/joaoh1/okzoomer/OkZoomerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,32 @@

@Config(name = "okzoomer")
public class OkZoomerConfig implements ConfigData {
@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.\nWARNING: It might be prone to breakage, be careful.")
@ConfigEntry.Gui.Tooltip(count = 2)
@Comment("Enables Smooth Camera while zooming, interferes with Cinematic Mode but it shouldn't be anything negative.")
@ConfigEntry.Gui.Tooltip(count = 2)
boolean smoothCamera = true;

@ConfigEntry.Gui.CollapsibleObject
SmoothTransitionOptions smoothTransitionOptions = new SmoothTransitionOptions();

public static class SmoothTransitionOptions {
@Comment("Enables Smooth Transitions when zooming in and out.")
@ConfigEntry.Gui.Tooltip(count = 1)
boolean smoothTransition = false;

@Comment("The divisor used while applying smoothing, smaller number zooms faster, bigger number zoom 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.\n1.25 is the recommended maximum, anything above that will break the FOV.")
@ConfigEntry.Gui.Tooltip(count = 3)
double zoomMultiplier = 0.5;

int smoothDivisor = 128;

@Comment("The number of times the transition is applied during the zoom press.")
@ConfigEntry.Gui.Tooltip(count = 1)
int timesToRepeatSmoothing = 6;
}

@Comment("Enables the ability to toggle zooming.")
@ConfigEntry.Gui.Tooltip()
boolean zoomToggle = false;

@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;
}
14 changes: 8 additions & 6 deletions src/main/resources/assets/okzoomer/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
"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 it shouldn't be anything negative.",
"text.autoconfig.okzoomer.option.smoothDivisor": "Smooth Transition Divisor",
"text.autoconfig.okzoomer.option.smoothDivisor.@Tooltip[0]": "The divisor used while applying smoothing,",
"text.autoconfig.okzoomer.option.smoothDivisor.@Tooltip[1]": "smaller number zooms faster, bigger number zoom slower.",
"text.autoconfig.okzoomer.option.smoothTransitionOptions": "Smooth Transition Options",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothTransition": "Smooth Transition",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothTransition.@Tooltip": "Enables Smooth Transitions when zooming in and out.",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothDivisor": "Smooth Transition Divisor",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothDivisor.@Tooltip[0]": "The divisor used while applying smoothing,",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothDivisor.@Tooltip[1]": "smaller number zooms faster, bigger number zoom slower.",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.timesToRepeatSmoothing": "Times to Repeat Smoothing",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.timesToRepeatSmoothing.@Tooltip": "The number of times the smoothing is applied during the transition.",
"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,",
"text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[2]": "anything above that will break the FOV.",
"text.autoconfig.okzoomer.option.zoomToggle": "Zoom Toggle",
"text.autoconfig.okzoomer.option.zoomToggle.@Tooltip": "Enables the ability to toggle zooming.",
"text.autoconfig.okzoomer.option.smoothTransition": "Smooth Transition",
"text.autoconfig.okzoomer.option.smoothTransition.@Tooltip[0]": "Enables Smooth Transitions when zooming in and out.",
"text.autoconfig.okzoomer.option.smoothTransition.@Tooltip[1]": "WARNING: It might be prone to breakage, be careful.",
"text.autoconfig.okzoomer.title": "Ok Zoomer Config"
}
28 changes: 15 additions & 13 deletions src/main/resources/assets/okzoomer/lang/pt_br.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"key.okzoomer.zoom": "Zoom",
"text.autoconfig.okzoomer.option.smoothCamera": "Câmera suave",
"text.autoconfig.okzoomer.option.smoothCamera.@Tooltip[0]": "Ativa a câmera suave enquanto dar zoom, interfere com",
"text.autoconfig.okzoomer.option.smoothCamera.@Tooltip[1]": "a câmera cinematográfica mas isso não deve ser nada negativo.",
"text.autoconfig.okzoomer.option.smoothDivisor": "Divisor da transição suave",
"text.autoconfig.okzoomer.option.smoothDivisor.@Tooltip[0]": "O divisor usado enquanto aplica a suavização",
"text.autoconfig.okzoomer.option.smoothDivisor.@Tooltip[1]": "um número menor dá o zoom mais rápido, um número maior é mais lento.",
"text.autoconfig.okzoomer.option.zoomMultiplier": "Multiplicador do zoom",
"text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[0]": "O mulitplicador aplicado no campo visual enquanto dar zoom,",
"text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[1]": "1.25 é o máximo recomendado",
"text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[2]": "qualquer número maior do que isso vai quebrar o campo visual.",
"text.autoconfig.okzoomer.option.smoothCamera.@Tooltip[0]": "Ativa a câmera suave enquanto dar zoom, interfere com",
"text.autoconfig.okzoomer.option.smoothCamera.@Tooltip[1]": "a câmera cinematográfica mas isso não deve ser nada negativo.",
"text.autoconfig.okzoomer.option.smoothTransitionOptions": "Opções da câmera suave",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothTransition": "Transição suave",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothTransition.@Tooltip": "Ativa transições suaves enquanto entra e sai do zoom.",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothDivisor": "Divisor da transição suave",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothDivisor.@Tooltip[0]": "O divisor usado enquanto aplica a suavização",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.smoothDivisor.@Tooltip[1]": "um número menor dá o zoom mais rápido, um número maior é mais lento.",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.timesToRepeatSmoothing": "Vezes para repetir a suavização",
"text.autoconfig.okzoomer.option.smoothTransitionOptions.timesToRepeatSmoothing.@Tooltip": "O número de vezes que a suavização é aplicada durante a transição.",
"text.autoconfig.okzoomer.option.zoomMultiplier": "Multiplicador do zoom",
"text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[0]": "O mulitplicador aplicado no campo visual enquanto dar zoom.",
"text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[1]": "1.25 é o máximo recomendado,",
"text.autoconfig.okzoomer.option.zoomMultiplier.@Tooltip[2]": "qualquer número maior do que isso vai quebrar o campo visual.",
"text.autoconfig.okzoomer.option.zoomToggle": "Alternar zoom",
"text.autoconfig.okzoomer.option.zoomToggle.@Tooltip": "Ativa a habilidade de alternar o zoom.",
"text.autoconfig.okzoomer.option.smoothTransition": "Transição suave",
"text.autoconfig.okzoomer.option.smoothTransition.@Tooltip[0]": "Ativa transições suaves enquanto entra e sai do zoom.",
"text.autoconfig.okzoomer.option.smoothTransition.@Tooltip[1]": "AVISO: Elas estão propensas a se quebrarem, tome cuidado.",
"text.autoconfig.okzoomer.title": "Configurações do Ok Zoomer"
"text.autoconfig.okzoomer.title": "Configurações do Ok Zoomer"
}
8 changes: 3 additions & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
"schemaVersion": 1,
"id": "okzoomer",
"version": "${version}",

"name": "Ok Zoomer",
"description": "This mod adds a highly configurable zoom button, it works like OptiFine's zoom when not configured.",
"authors": [
"joaoh1"
],
"contact": {
"homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-example-mod"
"homepage": "https://www.curseforge.com/minecraft/mc-mods/ok-zoomer",
"issues": "https://github.com/joaoh1/OkZoomer/issues",
"sources": "https://github.com/joaoh1/OkZoomer"
},

"license": "MIT",
"icon": "assets/okzoomer/icon.png",

"environment": "*",
"entrypoints": {
"client": ["io.github.joaoh1.okzoomer.OkZoomer"],
Expand Down

0 comments on commit b043251

Please sign in to comment.