Skip to content

Commit

Permalink
Prepare for 10.0.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
EnnuiL committed Oct 15, 2024
1 parent d32ec32 commit 6311679
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public static class FeaturesConfig extends Section {
""")
public final TrackedValue<ZoomTransitionOptions> zoomTransition = this.value(ZoomTransitionOptions.SMOOTH);

@WidgetSize(Size.HALF)
@Comment("Divides the amount of view bobbing with the zoom divisor while zooming.")
public final TrackedValue<Boolean> reduceViewBobbing = this.value(true);

@WidgetSize(Size.HALF)
@Comment("""
"HOLD": The zoom will require the zoom key to be held.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ protected void init() {
var config = Configs.getConfig(this.configId.getNamespace(), this.configId.getPath());
this.configTextUtils = new ConfigTextUtils(config);
this.entryListWidget = new OkZoomerAbstractSelectionList(this.minecraft, this.width, this.height - 64, 32);

this.entryListWidget.addCategory(Component.translatable("config.ok_zoomer.presets"));
var presetButton = CycleButton.<ConfigEnums.ZoomPresets>builder(value -> Component.translatable(String.format("config.ok_zoomer.presets.preset.%s", value.toString().toLowerCase(Locale.ROOT))))
.withValues(ConfigEnums.ZoomPresets.values())
.withTooltip(value -> Tooltip.create(Component.translatable(String.format("config.ok_zoomer.presets.preset.%s.tooltip", value.toString().toLowerCase(Locale.ROOT)))))
.withInitialValue(ConfigEnums.ZoomPresets.DEFAULT)
.create(0, 0, 150, 20,
Component.translatable("config.ok_zoomer.presets.preset"));
var resetButton = Button.builder(
Component.translatable("config.ok_zoomer.presets.apply_preset"),
button -> this.resetToPreset(presetButton.getValue()))
.tooltip(Tooltip.create(Component.translatable("config.ok_zoomer.presets.apply_preset.tooltip")))
.build();
this.entryListWidget.addButton(presetButton, resetButton);

for (var node : config.nodes()) {
if (node instanceof ValueTreeNode.Section section) {
this.entryListWidget.addCategory(this.configTextUtils.getCategoryText(section.key().toString()));
Expand Down Expand Up @@ -176,20 +191,6 @@ protected void init() {
}
}

this.entryListWidget.addCategory(Component.translatable("config.ok_zoomer.presets"));
var presetButton = CycleButton.<ConfigEnums.ZoomPresets>builder(value -> Component.translatable(String.format("config.ok_zoomer.presets.preset.%s", value.toString().toLowerCase(Locale.ROOT))))
.withValues(ConfigEnums.ZoomPresets.values())
.withTooltip(value -> Tooltip.create(Component.translatable(String.format("config.ok_zoomer.presets.preset.%s.tooltip", value.toString().toLowerCase(Locale.ROOT)))))
.withInitialValue(ConfigEnums.ZoomPresets.DEFAULT)
.create(0, 0, 150, 20,
Component.translatable("config.ok_zoomer.presets.preset"));
var resetButton = Button.builder(
Component.translatable("config.ok_zoomer.presets.apply_preset"),
button -> this.resetToPreset(presetButton.getValue()))
.tooltip(Tooltip.create(Component.translatable("config.ok_zoomer.presets.apply_preset.tooltip")))
.build();
this.entryListWidget.addButton(presetButton, resetButton);

this.entryListWidget.finish();
this.addRenderableWidget(this.entryListWidget);

Expand Down Expand Up @@ -264,6 +265,10 @@ public void resetToPreset(ConfigEnums.ZoomPresets preset) {
Map.entry(OkZoomerConfigManager.CONFIG.features.cinematicCamera, preset == ConfigEnums.ZoomPresets.CLASSIC ? ConfigEnums.CinematicCameraOptions.VANILLA : ConfigEnums.CinematicCameraOptions.OFF),
Map.entry(OkZoomerConfigManager.CONFIG.features.reduceSensitivity, preset != ConfigEnums.ZoomPresets.CLASSIC),
Map.entry(OkZoomerConfigManager.CONFIG.features.zoomTransition, preset == ConfigEnums.ZoomPresets.CLASSIC ? ConfigEnums.ZoomTransitionOptions.OFF : ConfigEnums.ZoomTransitionOptions.SMOOTH),
Map.entry(OkZoomerConfigManager.CONFIG.features.reduceViewBobbing, switch (preset) {
case CLASSIC, CLASSIC_ZOOMER -> false;
default -> true;
}),
Map.entry(OkZoomerConfigManager.CONFIG.features.zoomMode, preset == ConfigEnums.ZoomPresets.PERSISTENT ? ConfigEnums.ZoomModes.PERSISTENT : ConfigEnums.ZoomModes.HOLD),
Map.entry(OkZoomerConfigManager.CONFIG.features.zoomScrolling, switch (preset) {
case CLASSIC, SPYGLASS -> false;
Expand All @@ -274,12 +279,12 @@ public void resetToPreset(ConfigEnums.ZoomPresets preset) {
Map.entry(OkZoomerConfigManager.CONFIG.features.zoomOverlay, preset == ConfigEnums.ZoomPresets.SPYGLASS ? ConfigEnums.ZoomOverlays.SPYGLASS : ConfigEnums.ZoomOverlays.OFF),
Map.entry(OkZoomerConfigManager.CONFIG.features.spyglassMode, preset == ConfigEnums.ZoomPresets.SPYGLASS ? ConfigEnums.SpyglassMode.BOTH : ConfigEnums.SpyglassMode.OFF),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.zoomDivisor, switch (preset) {
case PERSISTENT -> 1.0D;
case SPYGLASS -> 10.0D;
default -> 4.0D;
case PERSISTENT -> 1.0;
case SPYGLASS -> 10.0;
default -> 4.0;
}),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.minimumZoomDivisor, 1.0D),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.maximumZoomDivisor, 50.0D),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.minimumZoomDivisor, 1.0),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.maximumZoomDivisor, 50.0),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.upperScrollSteps, switch (preset) {
case PERSISTENT -> 38;
case SPYGLASS -> 16;
Expand All @@ -290,14 +295,10 @@ public void resetToPreset(ConfigEnums.ZoomPresets preset) {
case SPYGLASS -> 8;
default -> 4;
}),
Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.smoothTransitionFactor, switch (preset) {
case CLASSIC_ZOOMER -> 0.75;
case SPYGLASS -> 0.5;
default -> 0.6;
}),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.cinematicMultiplier, 4.0D),
Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.minimumLinearStep, 0.16D),
Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.maximumLinearStep, 0.22D),
Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.smoothTransitionFactor, preset == ConfigEnums.ZoomPresets.SPYGLASS ? 0.5 : 0.6),
Map.entry(OkZoomerConfigManager.CONFIG.zoomValues.cinematicMultiplier, 4.0),
Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.minimumLinearStep, 0.16),
Map.entry(OkZoomerConfigManager.CONFIG.transitionValues.maximumLinearStep, 0.22),
Map.entry(OkZoomerConfigManager.CONFIG.tweaks.resetZoomWithMouse, preset != ConfigEnums.ZoomPresets.CLASSIC),
Map.entry(OkZoomerConfigManager.CONFIG.tweaks.hideCrosshair, preset == ConfigEnums.ZoomPresets.DEFAULT),
Map.entry(OkZoomerConfigManager.CONFIG.tweaks.forgetZoomDivisor, true),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.github.ennuil.ok_zoomer.mixin.common;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef;
import io.github.ennuil.ok_zoomer.config.OkZoomerConfigManager;
import io.github.ennuil.ok_zoomer.zoom.Zoom;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.GameRenderer;
Expand Down Expand Up @@ -47,4 +49,13 @@ private void getZoomedFov(Camera activeRenderInfo, float partialTicks, boolean u

internalFov.set(zoomedFov);
}

@ModifyExpressionValue(method = "bobView", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;lerp(FFF)F"))
private float modifyBob(float bob, @Local(argsOnly = true) float delta) {
if (!Zoom.isZooming() || !OkZoomerConfigManager.CONFIG.features.reduceViewBobbing.value()) {
return bob;
} else {
return (float) Zoom.getTransitionMode().applyZoom(bob, delta);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void hideCrosshair(GuiGraphics graphics, DeltaTracker deltaTracker, Oper
original.call(graphics, deltaTracker);
} else {
float fade = 1.0F - (float) Zoom.getTransitionMode().getFade(deltaTracker.getGameTimeDeltaPartialTick(true));
RenderSystem.setShaderColor(fade, fade, fade, 1.0F);
RenderSystem.setShaderColor(fade, fade, fade, fade);
original.call(graphics, deltaTracker);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/ok_zoomer/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"config.ok_zoomer.features.zoom_transition.smooth.tooltip": "The zoom will smoothly transition between its on and off states in a manner resembling the game's FOV transitions.",
"config.ok_zoomer.features.zoom_transition.linear": "Linear",
"config.ok_zoomer.features.zoom_transition.linear.tooltip": "The zoom will linearly transition between its on and off states.",
"config.ok_zoomer.features.reduce_view_bobbing": "Reduce View Bobbing",
"config.ok_zoomer.features.reduce_view_bobbing.tooltip": "Divides the amount of view bobbing with the zoom divisor while zooming.",
"config.ok_zoomer.features.zoom_mode": "Zoom Mode",
"config.ok_zoomer.features.zoom_mode.hold": "Hold",
"config.ok_zoomer.features.zoom_mode.hold.tooltip": "The zoom will require the zoom key to be held.",
Expand Down Expand Up @@ -86,7 +88,7 @@
"config.ok_zoomer.presets.preset.default": "Default",
"config.ok_zoomer.presets.preset.default.tooltip": "Reset to the default settings.",
"config.ok_zoomer.presets.preset.classic_zoomer": "Classic Zoomer",
"config.ok_zoomer.presets.preset.classic_zoomer.tooltip": "Reset to the old default settings, featuring a faster smooth transition factor.",
"config.ok_zoomer.presets.preset.classic_zoomer.tooltip": "Reset to this mod's old default settings.",
"config.ok_zoomer.presets.preset.classic": "Classic",
"config.ok_zoomer.presets.preset.classic.tooltip": "Reset to a preset that emulates the OptiFine zoom.",
"config.ok_zoomer.presets.preset.persistent": "Persistent",
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/ok_zoomer/lang/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"config.ok_zoomer.features.zoom_transition.smooth.tooltip": "O zoom transitará entre os estados ativo e desativo de forma suave, semelhante às transições do campo de visão do jogo.",
"config.ok_zoomer.features.zoom_transition.linear": "Linear",
"config.ok_zoomer.features.zoom_transition.linear.tooltip": "O zoom transitará entre os estados ativo e desativo de forma linear.",
"config.ok_zoomer.features.reduce_view_bobbing": "Reduzir balanço",
"config.ok_zoomer.features.reduce_view_bobbing.tooltip": "Divide a intensidade do balanço de visão com o divisor de zoom durante o zoom.",
"config.ok_zoomer.features.zoom_mode": "Modo do zoom",
"config.ok_zoomer.features.zoom_mode.hold": "Segurar",
"config.ok_zoomer.features.zoom_mode.hold.tooltip": "O zoom irá depender da tecla do zoom ser segurado.",
Expand Down Expand Up @@ -87,7 +89,7 @@
"config.ok_zoomer.presets.preset.default": "Padrão",
"config.ok_zoomer.presets.preset.default.tooltip": "Redefine para as definições padrões.",
"config.ok_zoomer.presets.preset.classic_zoomer": "Zoomer clássico",
"config.ok_zoomer.presets.preset.classic_zoomer.tooltip": "Redefine para as definições padrões antigos, apresentando um fator de transição suave rápido.",
"config.ok_zoomer.presets.preset.classic_zoomer.tooltip": "Redefine para as definições padrões antigas desse mod.",
"config.ok_zoomer.presets.preset.classic": "Clássica",
"config.ok_zoomer.presets.preset.classic.tooltip": "Redefine para uma predefinição que emula o zoom do OptiFine.",
"config.ok_zoomer.presets.preset.persistent": "Persistente",
Expand Down

0 comments on commit 6311679

Please sign in to comment.