Skip to content

Commit

Permalink
Prepare for the fourth alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Past Ennui committed Jul 3, 2020
1 parent 1227a58 commit c9d5c16
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 24 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ maven_group = io.github.joaoh1
archives_base_name = okzoomer

# Dependencies
fabric_version = 0.14.0+build.371-1.16
fabric_version = 0.14.1+build.372-1.16
mod_menu_version = 1.12.2+build.16
cloth_config_version = 4.5.6
fiber_version = 0.23.0-1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class OkZoomerClientMod implements ClientModInitializer {
public static final KeyBinding zoomKeyBinding = KeyBindingHelper.registerKeyBinding(
new KeyBinding("key.okzoomer.zoom", InputUtil.Type.KEYSYM, ZoomUtils.getDefaultZoomKey(), "key.okzoomer.category"));

//TODO - Allow for the zoom manipulation keybinds to be disabled by the user.
//The "Decrease Zoom" keybinding.
public static final KeyBinding decreaseZoomKeyBinding = KeyBindingHelper.registerKeyBinding(
new KeyBinding("key.okzoomer.decrease_zoom", InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), "key.okzoomer.category"));
Expand Down Expand Up @@ -143,12 +144,14 @@ public void onInitializeClient() {
}
});

/*
ClientSidePacketRegistry.INSTANCE.register(OkZoomerMod.FORCE_OPTIFINE_MODE_PACKET_ID,
(packetContext, attachedData) -> packetContext.getTaskQueue().execute(() -> {
packetContext.getPlayer().sendMessage(new LiteralText("[Ok Zoomer] The zoom has been forced to behave like OptiFine's zoom by this server."), false);
ZoomUtils.optifineMode = true;
})
);
*/

ClientSidePacketRegistry.INSTANCE.register(OkZoomerMod.DISABLE_ZOOM_PACKET_ID,
(packetContext, attachedData) -> packetContext.getTaskQueue().execute(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.fabricmc.loader.api.FabricLoader;

public class OkZoomerConfig {
public static final Path configPath = FabricLoader.getInstance().getConfigDirectory().toPath().resolve("ok-zoomer-next.json5");
public static final Path configPath = FabricLoader.getInstance().getConfigDirectory().toPath().resolve("okzoomer-next.json5");

private static final AnnotatedSettings annotatedSettings = AnnotatedSettings.builder()
.useNamingConvention(SettingNamingConvention.SNAKE_CASE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class OkZoomerConfigPojo {
public static FeaturesGroup features = new FeaturesGroup();

public static class FeaturesGroup {
@Setting(comment = "Enables the cinematic camera while zooming.\n\"OFF\" disables it.\n\"VANILLA\" mimics Vanilla's Cinematic Camera.\n\"MULTIPLIED\" is a multiplied variant of \"VANILLA\".")
@Setting(comment = "Defines the cinematic camera while zooming.\n\"OFF\" disables the cinematic camera.\n\"VANILLA\" uses Vanilla's cinematic camera.\n\"MULTIPLIED\" is a multiplied variant of \"VANILLA\".")
public CinematicCameraOptions cinematicCamera = CinematicCameraOptions.OFF;

public enum CinematicCameraOptions {
Expand All @@ -20,7 +20,7 @@ public enum CinematicCameraOptions {
@Setting(comment = "Reduces the mouse sensitivity when zooming.")
public boolean reduceSensitivity = true;

@Setting(comment = "Adds transitions between zooms.\n\"OFF\" disables it.\n\"SMOOTH\" replicates Vanilla's dynamic FOV.\n\"SINE\" applies the zoom through a sine function.")
@Setting(comment = "Adds transitions between zooms.\n\"OFF\" disables transitions.\n\"SMOOTH\" replicates Vanilla's dynamic FOV.\n\"SINE\" applies the transition with a sine function.")
public ZoomTransitionOptions zoomTransition = ZoomTransitionOptions.SMOOTH;

public enum ZoomTransitionOptions {
Expand All @@ -29,7 +29,7 @@ public enum ZoomTransitionOptions {
SINE
}

@Setting(comment = "The behavior of the zoom key.\n\"HOLD\" needs the zoom key to be hold.\n\"TOGGLE\" has the zoom key toggle the zoom.\n\"PERSISTENT\" always zooms, with the zoom key only being used for zoom scrolling.")
@Setting(comment = "The behavior of the zoom key.\n\"HOLD\" needs the zoom key to be hold.\n\"TOGGLE\" has the zoom key toggle the zoom.\n\"PERSISTENT\" makes the zoom permanent.")
public ZoomModes zoomMode = ZoomModes.HOLD;

public enum ZoomModes {
Expand All @@ -38,7 +38,7 @@ public enum ZoomModes {
PERSISTENT
}

@Setting(comment = "Allows to increase or decrease zoom by scrolling.")
@Setting(comment = "Allows to increase or decrease zoom by scrolling.\nThe functionality might not be final.")
public boolean zoomScrolling = true;
}

Expand All @@ -59,7 +59,11 @@ public static class ValuesGroup {
public double maximumZoomDivisor = 50.0;

@Setting.Constrain.Range(min = Double.MIN_NORMAL)
@Setting(comment = "The multiplier used on the multiplied cinematic camera.")
@Setting(comment = "The multiplier used for the multiplied cinematic camera.")
public double cinematicMultiplier = 4.0;

@Setting.Constrain.Range(min = Double.MIN_NORMAL, max = 1.0)
@Setting(comment = "The multiplier used for smooth transitions.")
public double smoothMultiplier = 0.75;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public static Screen getConfigScreen(Screen parentScreen) {
.setSaveConsumer(value -> {
OkZoomerConfigPojo.features.cinematicCamera = (CinematicCameraOptions) value;
})
.setTooltip(new TranslatableText("config.okzoomer.cinematic_camera.tooltip"))
.setTooltip(new TranslatableText[] {
new TranslatableText("config.okzoomer.cinematic_camera.tooltip"),
new TranslatableText("config.okzoomer.cinematic_camera.tooltip.off"),
new TranslatableText("config.okzoomer.cinematic_camera.tooltip.vanilla"),
new TranslatableText("config.okzoomer.cinematic_camera.tooltip.multiplied")
})
.build());

features.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.okzoomer.reduce_sensitivity"), OkZoomerConfigPojo.features.reduceSensitivity)
Expand All @@ -63,7 +68,12 @@ public static Screen getConfigScreen(Screen parentScreen) {
.setSaveConsumer(value -> {
OkZoomerConfigPojo.features.zoomTransition = (ZoomTransitionOptions) value;
})
.setTooltip(new TranslatableText("config.okzoomer.zoom_transition.tooltip"))
.setTooltip(new TranslatableText[] {
new TranslatableText("config.okzoomer.zoom_transition.tooltip"),
new TranslatableText("config.okzoomer.zoom_transition.tooltip.off"),
new TranslatableText("config.okzoomer.zoom_transition.tooltip.smooth"),
new TranslatableText("config.okzoomer.zoom_transition.tooltip.sine")
})
.build());

features.addEntry(entryBuilder.startSelector(new TranslatableText("config.okzoomer.zoom_mode"), ZoomModes.values(), OkZoomerConfigPojo.features.zoomMode)
Expand All @@ -82,21 +92,31 @@ public static Screen getConfigScreen(Screen parentScreen) {
OkZoomerConfigPojo.features.zoomMode = (ZoomModes) value;
})
.setTooltip(new TranslatableText("config.okzoomer.zoom_mode.tooltip"))
.setTooltip(new TranslatableText[] {
new TranslatableText("config.okzoomer.zoom_mode.tooltip"),
new TranslatableText("config.okzoomer.zoom_mode.tooltip.hold"),
new TranslatableText("config.okzoomer.zoom_mode.tooltip.toggle"),
new TranslatableText("config.okzoomer.zoom_mode.tooltip.persistent")
})
.build());

features.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.okzoomer.zoom_scrolling"), OkZoomerConfigPojo.features.zoomScrolling)
.setDefaultValue(true)
.setSaveConsumer(value -> {
OkZoomerConfigPojo.features.zoomScrolling = value;
})
.setTooltip(new TranslatableText("config.okzoomer.zoom_scrolling.tooltip"))
.setTooltip(new TranslatableText[] {
new TranslatableText("config.okzoomer.zoom_scrolling.tooltip"),
new TranslatableText("config.okzoomer.zoom_scrolling.tooltip.warning")
})
.build());

ConfigCategory values = builder.getOrCreateCategory(new TranslatableText("config.okzoomer.category.values"))
.setCategoryBackground(new Identifier("minecraft:textures/block/yellow_concrete_powder.png"));

values.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.okzoomer.zoom_divisor"), OkZoomerConfigPojo.values.zoomDivisor)
.setDefaultValue(4.0)
.setMin(Double.MIN_VALUE)
.setSaveConsumer(value -> {
OkZoomerConfigPojo.values.zoomDivisor = value;
})
Expand All @@ -105,6 +125,7 @@ public static Screen getConfigScreen(Screen parentScreen) {

values.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.okzoomer.minimum_zoom_divisor"), OkZoomerConfigPojo.values.minimumZoomDivisor)
.setDefaultValue(1.0)
.setMin(Double.MIN_VALUE)
.setSaveConsumer(value -> {
OkZoomerConfigPojo.values.minimumZoomDivisor = value;
})
Expand All @@ -113,6 +134,7 @@ public static Screen getConfigScreen(Screen parentScreen) {

values.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.okzoomer.maximum_zoom_divisor"), OkZoomerConfigPojo.values.maximumZoomDivisor)
.setDefaultValue(50.0)
.setMin(Double.MIN_VALUE)
.setSaveConsumer(value -> {
OkZoomerConfigPojo.values.maximumZoomDivisor = value;
})
Expand All @@ -121,20 +143,30 @@ public static Screen getConfigScreen(Screen parentScreen) {

values.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.okzoomer.cinematic_multiplier"), OkZoomerConfigPojo.values.cinematicMultiplier)
.setDefaultValue(4.0)
.setMin(Double.MIN_VALUE)
.setSaveConsumer(value -> {
OkZoomerConfigPojo.values.cinematicMultiplier = value;
})
.setTooltip(new TranslatableText("config.okzoomer.cinematic_multiplier.tooltip"))
.build());

values.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.okzoomer.smooth_multiplier"), OkZoomerConfigPojo.values.smoothMultiplier)
.setDefaultValue(0.75)
.setMin(Double.MIN_VALUE)
.setMax(1.0)
.setSaveConsumer(value -> {
OkZoomerConfigPojo.values.smoothMultiplier = value;
})
.setTooltip(new TranslatableText("config.okzoomer.smooth_multiplier.tooltip"))
.build());

ConfigCategory presets = builder.getOrCreateCategory(new TranslatableText("config.okzoomer.category.presets"))
.setCategoryBackground(new Identifier("minecraft:textures/block/yellow_wool.png"));

String[] presetArray = new String[]{"None", "Default", "Classic"};
String[] presetArray = new String[]{"None", "Default", "Classic", "Persistent"};
presets.addEntry(entryBuilder.startSelector(new TranslatableText("config.okzoomer.reset_to_preset"), presetArray, presetArray[0])
.setSaveConsumer(value -> {
if (value.equals("Default")) {
value = presetArray[0];
OkZoomerConfigPojo.features.cinematicCamera = CinematicCameraOptions.OFF;
OkZoomerConfigPojo.features.reduceSensitivity = true;
OkZoomerConfigPojo.features.zoomTransition = ZoomTransitionOptions.SMOOTH;
Expand All @@ -144,8 +176,8 @@ public static Screen getConfigScreen(Screen parentScreen) {
OkZoomerConfigPojo.values.minimumZoomDivisor = 1.0;
OkZoomerConfigPojo.values.maximumZoomDivisor = 50.0;
OkZoomerConfigPojo.values.cinematicMultiplier = 4.0;
OkZoomerConfigPojo.values.smoothMultiplier = 0.75;
} else if (value.equals("Classic")) {
value = presetArray[0];
OkZoomerConfigPojo.features.cinematicCamera = CinematicCameraOptions.VANILLA;
OkZoomerConfigPojo.features.reduceSensitivity = false;
OkZoomerConfigPojo.features.zoomTransition = ZoomTransitionOptions.OFF;
Expand All @@ -155,7 +187,20 @@ public static Screen getConfigScreen(Screen parentScreen) {
OkZoomerConfigPojo.values.minimumZoomDivisor = 1.0;
OkZoomerConfigPojo.values.maximumZoomDivisor = 50.0;
OkZoomerConfigPojo.values.cinematicMultiplier = 4.0;
OkZoomerConfigPojo.values.smoothMultiplier = 0.75;
} else if (value.equals("Persistent")) {
OkZoomerConfigPojo.features.cinematicCamera = CinematicCameraOptions.OFF;
OkZoomerConfigPojo.features.reduceSensitivity = true;
OkZoomerConfigPojo.features.zoomTransition = ZoomTransitionOptions.SMOOTH;
OkZoomerConfigPojo.features.zoomMode = ZoomModes.PERSISTENT;
OkZoomerConfigPojo.features.zoomScrolling = true;
OkZoomerConfigPojo.values.zoomDivisor = 1.0;
OkZoomerConfigPojo.values.minimumZoomDivisor = 1.0;
OkZoomerConfigPojo.values.maximumZoomDivisor = 50.0;
OkZoomerConfigPojo.values.cinematicMultiplier = 4.0;
OkZoomerConfigPojo.values.smoothMultiplier = 0.75;
}
value = presetArray[0];
})
.setNameProvider(value -> {
if (value.equals("None")) {
Expand All @@ -164,9 +209,18 @@ public static Screen getConfigScreen(Screen parentScreen) {
return new TranslatableText("config.okzoomer.reset_to_preset.default");
} else if (value.equals("Classic")) {
return new TranslatableText("config.okzoomer.reset_to_preset.classic");
} else if (value.equals("Persistent")) {
return new TranslatableText("config.okzoomer.reset_to_preset.persistent");
}
return new LiteralText("Error");
})
.setTooltip(new TranslatableText[] {
new TranslatableText("config.okzoomer.reset_to_preset.tooltip"),
new TranslatableText("config.okzoomer.reset_to_preset.tooltip.none"),
new TranslatableText("config.okzoomer.reset_to_preset.tooltip.default"),
new TranslatableText("config.okzoomer.reset_to_preset.tooltip.classic"),
new TranslatableText("config.okzoomer.reset_to_preset.tooltip.persistent")
})
.build());

builder.setSavingRunnable(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void changeZoomDivisor(boolean increase) {
}
}

//The equivalent of GameRenderer's updateFovMultiplier but for zooming. Used by smooth transitions.
//The equivalent of GameRenderer's updateFovMultiplier but for zooming. Used by zoom transitions.
public static void updateZoomFovMultiplier() {
float zoomMultiplier = 1.0F;

Expand All @@ -78,7 +78,7 @@ public static void updateZoomFovMultiplier() {
lastZoomFovMultiplier = zoomFovMultiplier;

if (OkZoomerConfigPojo.features.zoomTransition.equals(ZoomTransitionOptions.SMOOTH)) {
zoomFovMultiplier += (zoomMultiplier - zoomFovMultiplier) * 0.75F;
zoomFovMultiplier += (zoomMultiplier - zoomFovMultiplier) * OkZoomerConfigPojo.values.smoothMultiplier;
} else if (OkZoomerConfigPojo.features.zoomTransition.equals(ZoomTransitionOptions.SINE)) {
zoomFovMultiplier += Math.sin(zoomMultiplier - zoomFovMultiplier);
}
Expand Down
28 changes: 23 additions & 5 deletions src/main/resources/assets/okzoomer/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,34 @@
"config.okzoomer.title": "Ok Zoomer Config",
"config.okzoomer.category.features": "Features",
"config.okzoomer.cinematic_camera": "Cinematic Camera",
"config.okzoomer.cinematic_camera.tooltip": "Enables the cinematic camera while zooming.",
"config.okzoomer.cinematic_camera.off": "Off",
"config.okzoomer.cinematic_camera.vanilla": "Vanilla",
"config.okzoomer.cinematic_camera.multiplied": "Multiplied",
"config.okzoomer.cinematic_camera.tooltip": "Defines the cinematic camera while zooming.",
"config.okzoomer.cinematic_camera.tooltip.off": "\"Off\" disables the cinematic camera.",
"config.okzoomer.cinematic_camera.tooltip.vanilla": "\"Smooth\" uses Vanilla's cinematic camera.",
"config.okzoomer.cinematic_camera.tooltip.multiplied": "\"Multiplied\" is a multiplied variant of \"Vanilla\".",
"config.okzoomer.reduce_sensitivity": "Reduce Sensitivity",
"config.okzoomer.reduce_sensitivity.tooltip": "Reduces the mouse sensitivity when zooming.",
"config.okzoomer.zoom_transition": "Zoom Transition",
"config.okzoomer.zoom_transition.tooltip": "Adds transitions between zooms.",
"config.okzoomer.zoom_transition.off": "Off",
"config.okzoomer.zoom_transition.smooth": "Smooth",
"config.okzoomer.zoom_transition.sine": "Sine",
"config.okzoomer.zoom_transition.tooltip": "Adds transitions between zooms.",
"config.okzoomer.zoom_transition.tooltip.off": "\"Off\" disables transitions.",
"config.okzoomer.zoom_transition.tooltip.smooth": "\"Smooth\" replicates Vanilla's dynamic FOV.",
"config.okzoomer.zoom_transition.tooltip.sine": "\"Sine\" applies the transition with a sine function.",
"config.okzoomer.zoom_mode": "Zoom Mode",
"config.okzoomer.zoom_mode.tooltip": "The behavior of the zoom key.",
"config.okzoomer.zoom_mode.hold": "Hold",
"config.okzoomer.zoom_mode.toggle": "Toggle",
"config.okzoomer.zoom_mode.persistent": "Persistent",
"config.okzoomer.zoom_mode.tooltip": "The behavior of the zoom key.",
"config.okzoomer.zoom_mode.tooltip.hold": "\"Hold\" needs the zoom key to be hold.",
"config.okzoomer.zoom_mode.tooltip.toggle": "\"Toggle\" has the zoom key toggle the zoom.",
"config.okzoomer.zoom_mode.tooltip.persistent": "\"Persistent\" makes the zoom permanent.",
"config.okzoomer.zoom_scrolling": "Zoom Scrolling",
"config.okzoomer.zoom_scrolling.tooltip": "Allows to increase or decrease zoom by scrolling. Not polished yet.",
"config.okzoomer.zoom_scrolling.tooltip": "Allows to increase or decrease zoom by scrolling.",
"config.okzoomer.zoom_scrolling.tooltip.warning": "The functionality might not be final.",
"config.okzoomer.category.values": "Values",
"config.okzoomer.zoom_divisor": "Zoom Divisor",
"config.okzoomer.zoom_divisor.tooltip": "The divisor applied to the FOV's zoom multiplier.",
Expand All @@ -28,12 +38,20 @@
"config.okzoomer.maximum_zoom_divisor": "Maximum Zoom Divisor",
"config.okzoomer.maximum_zoom_divisor.tooltip": "The maximum value that you can scroll up.",
"config.okzoomer.cinematic_multiplier": "Cinematic Multiplier",
"config.okzoomer.cinematic_multiplier.tooltip": "The multiplier used on the multiplied cinematic camera.",
"config.okzoomer.cinematic_multiplier.tooltip": "The multiplier used for the multiplied cinematic camera.",
"config.okzoomer.smooth_multiplier": "Smooth Multiplier",
"config.okzoomer.smooth_multiplier.tooltip": "The multiplier used for smooth transitions.",
"config.okzoomer.category.presets": "Presets",
"config.okzoomer.reset_to_preset": "Reset to Preset",
"config.okzoomer.reset_to_preset.none": "None",
"config.okzoomer.reset_to_preset.default": "Default",
"config.okzoomer.reset_to_preset.classic": "Classic",
"config.okzoomer.reset_to_preset.persistent": "Persistent",
"config.okzoomer.reset_to_preset.tooltip": "Resets the config in a specific way once saved.",
"config.okzoomer.reset_to_preset.tooltip.none": "\"None\" keeps the config intact.",
"config.okzoomer.reset_to_preset.tooltip.default": "\"Default\" resets to the default.",
"config.okzoomer.reset_to_preset.tooltip.classic": "\"Classic\" makes the mod imitate OptiFine's zoom.",
"config.okzoomer.reset_to_preset.tooltip.persistent": "\"Persistent\" is based on the \"Persistent\" zoom mode.",
"key.okzoomer.category": "Zoom",
"key.okzoomer.decrease_zoom": "Decrease Zoom",
"key.okzoomer.increase_zoom": "Increase Zoom",
Expand Down
7 changes: 3 additions & 4 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "okzoomer",
"version": "${version}",
"name": "Ok Zoomer",
"description": "The next generation of Ok Zoomer, currently semi-unstable! This mod adds a highly configurable zoom button. By default, it provides its own take on zooming, however, with the mod's config, you can drastically change the zoom with something more familiar or useful.",
"description": "The next generation of Ok Zoomer, currently in alpha stages! This mod adds a highly configurable zoom button. By default, it provides its own take on zooming, however, with the mod's config, you can drastically change the zoom with something more familiar or useful.",
"authors": ["joaoh1"],
"contact": {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/ok-zoomer",
Expand All @@ -18,11 +18,10 @@
"modmenu": ["io.github.joaoh1.okzoomer.client.config.modmenu.OkZoomerModMenuEntry"]
},
"mixins": [
"okzoomerclient.mixins.json",
"okzoomerserver.mixins.json"
"okzoomerclient.mixins.json"
],
"depends": {
"fabricloader": ">=0.8.0",
"fabricloader": ">=0.8.8",
"fabric": ">=0.14.0",
"fiber": ">=0.23.0-"
},
Expand Down

0 comments on commit c9d5c16

Please sign in to comment.