Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
update to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Feb 2, 2024
1 parent 5dc5536 commit 910185b
Show file tree
Hide file tree
Showing 20 changed files with 186 additions and 230 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
import net.minecraft.text.Text;

public class MioZoomerCommandScreen extends SpruceScreen {
private SpruceOptionListWidget list;
private final SimpleColorBackground darkenedBackground = new SimpleColorBackground(0, 0, 0, 128);
private static final SimpleColorBackground DARKENED_BACKGROUND = new SimpleColorBackground(0, 0, 0, 128);

public MioZoomerCommandScreen() {
super(Text.translatable("command.mio_zoomer.title"));
Expand All @@ -27,7 +26,8 @@ public MioZoomerCommandScreen() {
@Override
protected void init() {
super.init();
this.list = new SpruceOptionListWidget(Position.of(0, 22), this.width, this.height - 36 - 22);
var list = new SpruceOptionListWidget(Position.of(0, 22), this.width, this.height - 36 - 22);
list.setBackground(DARKENED_BACKGROUND);

var configButton = SpruceSimpleActionOption.of(
"command.mio_zoomer.config",
Expand All @@ -39,72 +39,62 @@ protected void init() {
true,
Text.translatable("command.mio_zoomer.restrictions.tooltip"));

this.list.addSingleOptionEntry(configButton);
this.list.addSingleOptionEntry(restrictionsSeparator);
list.addSingleOptionEntry(configButton);
list.addSingleOptionEntry(restrictionsSeparator);


if (ZoomPackets.getHasRestrictions()) {
var textLabel = new SpruceLabelOption("command.mio_zoomer.restrictions.acknowledgement", true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption("command.mio_zoomer.restrictions.acknowledgement", true));
}

if (ZoomPackets.getDisableZoom()) {
var textLabel = new SpruceLabelOption("command.mio_zoomer.restrictions.disable_zoom", true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption("command.mio_zoomer.restrictions.disable_zoom", true));
}

if (ZoomPackets.getDisableZoomScrolling()) {
var textLabel = new SpruceLabelOption("command.mio_zoomer.restrictions.disable_zoom_scrolling", true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption("command.mio_zoomer.restrictions.disable_zoom_scrolling", true));
}

if (ZoomPackets.getForceClassicMode()) {
var textLabel = new SpruceLabelOption("command.mio_zoomer.restrictions.force_classic_mode", true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption("command.mio_zoomer.restrictions.force_classic_mode", true));
}

if (ZoomPackets.getForceZoomDivisors()) {
double minimumZoomDivisor = ZoomPackets.getMinimumZoomDivisor();
double maximumZoomDivisor = ZoomPackets.getMaximumZoomDivisor();
var textLabel = new SpruceLabelOption(
list.addSingleOptionEntry(new SpruceLabelOption(
"command.mio_zoomer.restrictions.force_zoom_divisors",
minimumZoomDivisor != maximumZoomDivisor
? Text.translatable("command.mio_zoomer.restrictions.force_zoom_divisors", minimumZoomDivisor, maximumZoomDivisor)
: Text.translatable("command.mio_zoomer.restrictions.force_zoom_divisor", minimumZoomDivisor),
true);
this.list.addSingleOptionEntry(textLabel);
true)
);
}

if (ZoomPackets.getSpyglassDependency()) {
String key = switch (MioZoomerConfigManager.SPYGLASS_DEPENDENCY.value()) {
var key = switch (MioZoomerConfigManager.CONFIG.features.spyglass_dependency.value()) {
case REQUIRE_ITEM -> "command.mio_zoomer.restrictions.force_spyglass.require_item";
case REPLACE_ZOOM -> "command.mio_zoomer.restrictions.force_spyglass.replace_zoom";
case BOTH -> "command.mio_zoomer.restrictions.force_spyglass.both";
default -> "";
};
var textLabel = new SpruceLabelOption(key, true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption(key, true));
}

if (ZoomPackets.getSpyglassOverlay()) {
var textLabel = new SpruceLabelOption("command.mio_zoomer.restrictions.force_spyglass_overlay", true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption("command.mio_zoomer.restrictions.force_spyglass_overlay", true));
}

if (!ZoomPackets.getHasRestrictions()) {
boolean acknowledged = ZoomPackets.getAcknowledgement().equals(ZoomPackets.Acknowledgement.HAS_NO_RESTRICTIONS);
if (acknowledged) {
var textLabel = new SpruceLabelOption("command.mio_zoomer.restrictions.no_restrictions.acknowledged", true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption("command.mio_zoomer.restrictions.no_restrictions.acknowledged", true));
} else {
var textLabel = new SpruceLabelOption("command.mio_zoomer.restrictions.no_restrictions", true);
this.list.addSingleOptionEntry(textLabel);
list.addSingleOptionEntry(new SpruceLabelOption("command.mio_zoomer.restrictions.no_restrictions", true));
}
}

this.list.setBackground(darkenedBackground);

this.addDrawableChild(this.list);
this.addDrawableChild(list);
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, this.height - 28), 200, 20, SpruceTexts.GUI_DONE,
btn -> this.client.setScreen(null)).asVanilla());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.thinkingstudio.mio_zoomer.config;

import ho.artisan.azusa_config.shadow.quiltconfig.api.WrappedConfig;
import ho.artisan.azusa_config.shadow.quiltconfig.api.ReflectiveConfig;
import ho.artisan.azusa_config.shadow.quiltconfig.api.annotations.Comment;
import ho.artisan.azusa_config.shadow.quiltconfig.api.annotations.FloatRange;
import ho.artisan.azusa_config.shadow.quiltconfig.api.annotations.IntegerRange;

import ho.artisan.azusa_config.shadow.quiltconfig.api.values.TrackedValue;
import org.thinkingstudio.mio_zoomer.config.metadata.WidgetSize;

public class MioZoomerConfig extends WrappedConfig {
public class MioZoomerConfig extends ReflectiveConfig {
@Comment("Contains the main zoom features.")
public final FeaturesConfig features = new FeaturesConfig();

Expand All @@ -17,19 +18,19 @@ public class MioZoomerConfig extends WrappedConfig {
@Comment("Contains options that are unlikely to be changed from the defaults.")
public final TweaksConfig tweaks = new TweaksConfig();

public class FeaturesConfig implements Section {
public static class FeaturesConfig extends Section {
@WidgetSize(WidgetSize.Size.HALF)
@Comment("""
Defines the cinematic camera while zooming.
"OFF" disables the cinematic camera.
"VANILLA" uses Vanilla's cinematic camera.
"MULTIPLIED" is a multiplied variant of "VANILLA".
""")
public final ConfigEnums.CinematicCameraOptions cinematic_camera = ConfigEnums.CinematicCameraOptions.OFF;
public final TrackedValue<ConfigEnums.CinematicCameraOptions> cinematic_camera = this.value(ConfigEnums.CinematicCameraOptions.OFF);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("Reduces the mouse sensitivity when zooming.")
public final boolean reduce_sensitivity = true;
public final TrackedValue<Boolean> reduce_sensitivity = this.value(true);

@WidgetSize(WidgetSize.Size.FULL)
@Comment("""
Expand All @@ -38,7 +39,7 @@ public class FeaturesConfig implements Section {
"SMOOTH" replicates Vanilla's dynamic FOV.
"LINEAR" removes the smoothiness.
""")
public final ConfigEnums.ZoomTransitionOptions zoom_transition = ConfigEnums.ZoomTransitionOptions.SMOOTH;
public final TrackedValue<ConfigEnums.ZoomTransitionOptions> zoom_transition = this.value(ConfigEnums.ZoomTransitionOptions.SMOOTH);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("""
Expand All @@ -47,15 +48,15 @@ public class FeaturesConfig implements Section {
"TOGGLE" has the zoom key toggle the zoom.
"PERSISTENT" makes the zoom permanent.
""")
public final ConfigEnums.ZoomModes zoom_mode = ConfigEnums.ZoomModes.HOLD;
public final TrackedValue<ConfigEnums.ZoomModes> zoom_mode = this.value(ConfigEnums.ZoomModes.HOLD);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("Allows to increase or decrease zoom by scrolling.")
public final boolean zoom_scrolling = true;
public final TrackedValue<Boolean> zoom_scrolling = this.value(true);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("Adds zoom manipulation keys along with the zoom key.")
public final boolean extra_key_binds = true;
public final TrackedValue<Boolean> extra_key_binds = this.value(true);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("""
Expand All @@ -64,7 +65,7 @@ public class FeaturesConfig implements Section {
"SPYGLASS" uses the spyglass overlay with the vignette texture.
The vignette texture can be found at: assets/mio_zoomer/textures/misc/zoom_overlay.png
""")
public final ConfigEnums.ZoomOverlays zoom_overlay = ConfigEnums.ZoomOverlays.OFF;
public final TrackedValue<ConfigEnums.ZoomOverlays> zoom_overlay = this.value(ConfigEnums.ZoomOverlays.OFF);

@WidgetSize(WidgetSize.Size.FULL)
@Comment("""
Expand All @@ -74,91 +75,91 @@ public class FeaturesConfig implements Section {
"BOTH" will apply both options at the same time.
The "REQUIRE_ITEM" option is configurable through the mio_zoomer:zoom_dependencies item tag.
""")
public final ConfigEnums.SpyglassDependency spyglass_dependency = ConfigEnums.SpyglassDependency.OFF;
public final TrackedValue<ConfigEnums.SpyglassDependency> spyglass_dependency = this.value(ConfigEnums.SpyglassDependency.OFF);
}

public class ValuesConfig implements Section {
public static class ValuesConfig extends Section {
@WidgetSize(WidgetSize.Size.FULL)
@Comment("The divisor applied to the FOV when zooming.")
@FloatRange(min = Double.MIN_NORMAL, max = Double.MAX_VALUE)
public final double zoom_divisor = 4.0;
public final TrackedValue<Double> zoom_divisor = this.value(4.0);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("The minimum value that you can scroll down.")
@FloatRange(min = Double.MIN_NORMAL, max = Double.MAX_VALUE)
public final double minimum_zoom_divisor = 1.0;
public final TrackedValue<Double> minimum_zoom_divisor = this.value(1.0);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("The maximum value that you can scroll down.")
@FloatRange(min = Double.MIN_NORMAL, max = Double.MAX_VALUE)
public final double maximum_zoom_divisor = 50.0;
public final TrackedValue<Double> maximum_zoom_divisor = this.value(50.0);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("""
The number of steps between the zoom divisor and the maximum zoom divisor.
Used by zoom scrolling.
""")
@IntegerRange(min = 0, max = Integer.MAX_VALUE)
public final int upper_scroll_steps = 10;
public final TrackedValue<Integer> upper_scroll_steps = this.value(10);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("""
The number of steps between the zoom divisor and the minimum zoom divisor.
Used by zoom scrolling.
""")
@IntegerRange(min = 0, max = Integer.MAX_VALUE)
public final int lower_scroll_steps = 5;
public final TrackedValue<Integer> lower_scroll_steps = this.value(5);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("The multiplier used for smooth transitions.")
@FloatRange(min = Double.MIN_NORMAL, max = 1.0)
public final double smooth_multiplier = 0.75;
public final TrackedValue<Double> smooth_multiplier = this.value(0.75);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("The multiplier used for the multiplied cinematic camera.")
@FloatRange(min = Double.MIN_NORMAL, max = 32.0)
public final double cinematic_multiplier = 4.0;
public final TrackedValue<Double> cinematic_multiplier = this.value(4.0);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("The minimum value which the linear transition step can reach.")
@FloatRange(min = 0.0, max = Double.MAX_VALUE)
public final double minimum_linear_step = 0.125;
public final TrackedValue<Double> minimum_linear_step = this.value(0.125);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("The maximum value which the linear transition step can reach.")
@FloatRange(min = 0.0, max = Double.MAX_VALUE)
public final double maximum_linear_step = 0.25;
public final TrackedValue<Double> maximum_linear_step = this.value(0.25);
}

public class TweaksConfig implements Section {
public static class TweaksConfig extends Section {
@WidgetSize(WidgetSize.Size.HALF)
@Comment("Allows for resetting the zoom with the middle mouse button.")
public final boolean reset_zoom_with_mouse = true;
public final TrackedValue<Boolean> reset_zoom_with_mouse = this.value(true);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("If enabled, the current zoom divisor is forgotten once zooming is done.")
public final boolean forget_zoom_divisor = true;
public final TrackedValue<Boolean> forget_zoom_divisor = this.value(true);

@WidgetSize(WidgetSize.Size.FULL)
@Comment("If pressed, the \"Save Toolbar Activator\" keybind will be unbound if there's a conflict with the zoom key.")
public final boolean unbind_conflicting_key = true;
public final TrackedValue<Boolean> unbind_conflicting_key = this.value(true);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("If enabled, the spyglass overlay texture is used instead of Mio Zoomer's overlay texture.")
public final boolean use_spyglass_texture = false;
public final TrackedValue<Boolean> use_spyglass_texture = this.value(false);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("If enabled, the zoom will use spyglass sounds on zooming in and out.")
public final boolean use_spyglass_sounds = false;
public final TrackedValue<Boolean> use_spyglass_sounds = this.value(false);

@WidgetSize(WidgetSize.Size.HALF)
@Comment("Shows toasts when the server imposes a restriction.")
public final boolean show_restriction_toasts = true;
public final TrackedValue<Boolean> show_restriction_toasts = this.value(true);

// TODO - Enable it again during eternal betas!
@WidgetSize(WidgetSize.Size.HALF)
@Comment("Prints a random owo in the console when the game starts.")
public final boolean print_owo_on_start = false;
public final TrackedValue<Boolean> print_owo_on_start = this.value(false);
}

// TODO - What if we had a secret Debug section?
Expand Down
Loading

0 comments on commit 910185b

Please sign in to comment.