Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Fast/Fancy for graphics, clouds, weather, leaves #2291

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static OptionPage quality() {
.add(OptionImpl.createBuilder(CloudStatus.class, vanillaOpts)
.setName(Component.translatable("options.renderClouds"))
.setTooltip(Component.translatable("sodium.options.clouds_quality.tooltip"))
.setControl(option -> new CyclingControl<>(option, CloudStatus.class, new Component[] { Component.translatable("options.off"), Component.translatable("options.graphics.fast"), Component.translatable("options.graphics.fancy") }))
.setControl(option -> new CyclingControl<>(option, CloudStatus.class, new Component[] { Component.translatable("options.off"), Component.translatable("options.clouds.fast"), Component.translatable("options.clouds.fancy") }))
.setBinding((opts, value) -> {
opts.cloudStatus().set(value);

Expand All @@ -164,17 +164,17 @@ public static OptionPage quality() {
}, opts -> opts.cloudStatus().get())
.setImpact(OptionImpact.LOW)
.build())
.add(OptionImpl.createBuilder(SodiumGameOptions.GraphicsQuality.class, sodiumOpts)
.add(OptionImpl.createBuilder(SodiumGameOptions.WeatherQuality.class, sodiumOpts)
.setName(Component.translatable("soundCategory.weather"))
.setTooltip(Component.translatable("sodium.options.weather_quality.tooltip"))
.setControl(option -> new CyclingControl<>(option, SodiumGameOptions.GraphicsQuality.class))
.setControl(option -> new CyclingControl<>(option, SodiumGameOptions.WeatherQuality.class))
.setBinding((opts, value) -> opts.quality.weatherQuality = value, opts -> opts.quality.weatherQuality)
.setImpact(OptionImpact.MEDIUM)
.build())
.add(OptionImpl.createBuilder(SodiumGameOptions.GraphicsQuality.class, sodiumOpts)
.add(OptionImpl.createBuilder(SodiumGameOptions.LeavesQuality.class, sodiumOpts)
.setName(Component.translatable("sodium.options.leaves_quality.name"))
.setTooltip(Component.translatable("sodium.options.leaves_quality.tooltip"))
.setControl(option -> new CyclingControl<>(option, SodiumGameOptions.GraphicsQuality.class))
.setControl(option -> new CyclingControl<>(option, SodiumGameOptions.LeavesQuality.class))
.setBinding((opts, value) -> opts.quality.leavesQuality = value, opts -> opts.quality.leavesQuality)
.setImpact(OptionImpact.MEDIUM)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public static class AdvancedSettings {
}

public static class QualitySettings {
public GraphicsQuality weatherQuality = GraphicsQuality.DEFAULT;
public GraphicsQuality leavesQuality = GraphicsQuality.DEFAULT;
public WeatherQuality weatherQuality = WeatherQuality.DEFAULT;
public LeavesQuality leavesQuality = LeavesQuality.DEFAULT;

public boolean enableVignette = true;
}
Expand All @@ -74,8 +74,8 @@ public static class NotificationSettings {

public enum GraphicsQuality implements TextProvider {
DEFAULT("options.gamma.default"),
FANCY("options.clouds.fancy"),
FAST("options.clouds.fast");
FANCY("options.graphics.fancy"),
FAST("options.graphics.fast");

private final Component name;

Expand All @@ -93,6 +93,48 @@ public boolean isFancy(GraphicsStatus graphicsStatus) {
}
}

public enum WeatherQuality implements TextProvider {
DEFAULT("options.gamma.default"),
FANCY("sodium.options.weather_quality.fancy"),
FAST("sodium.options.weather_quality.fast");

private final Component name;

WeatherQuality(String name) {
this.name = Component.translatable(name);
}

@Override
public Component getLocalizedName() {
return this.name;
}

public boolean isFancy(GraphicsStatus graphicsMode) {
return (this == FANCY) || (this == DEFAULT && (graphicsMode == GraphicsStatus.FANCY || graphicsMode == GraphicsStatus.FABULOUS));
}
}

public enum LeavesQuality implements TextProvider {
DEFAULT("options.gamma.default"),
FANCY("sodium.options.leaves_quality.fancy"),
FAST("sodium.options.leaves_quality.fast");

private final Component name;

LeavesQuality(String name) {
this.name = Component.translatable(name);
}

@Override
public Component getLocalizedName() {
return this.name;
}

public boolean isFancy(GraphicsStatus graphicsMode) {
return (this == FANCY) || (this == DEFAULT && (graphicsMode == GraphicsStatus.FANCY || graphicsMode == GraphicsStatus.FABULOUS));
}
}

private static final Gson GSON = new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.setPrettyPrinting()
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/sodium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
"sodium.options.graphics_quality.tooltip": "The default graphics quality controls some legacy options and is necessary for mod compatibility. If the options below are left to \"Default\", they will use this setting.",
"sodium.options.clouds_quality.tooltip": "The quality level used for rendering clouds in the sky. Even though the options are labeled \"Fast\" and \"Fancy\", the effect on performance is negligible.",
"sodium.options.weather_quality.tooltip": "Controls the distance that weather effects, such as rain and snow, will be rendered.",
"sodium.options.weather_quality.fast": "Fast",
"sodium.options.weather_quality.fancy": "Fancy",
"sodium.options.leaves_quality.name": "Leaves",
"sodium.options.leaves_quality.fast": "Fast",
"sodium.options.leaves_quality.fancy": "Fancy",
"sodium.options.leaves_quality.tooltip": "Controls whether leaves will be rendered as transparent (fancy) or opaque (fast).",
"sodium.options.particle_quality.tooltip": "Controls the maximum number of particles which can be present on screen at any one time.",
"sodium.options.smooth_lighting.tooltip": "Enables the smooth lighting and shading of blocks in the world. This can very slightly increase the amount of time it takes to load or update a chunk, but it doesn't affect frame rates.",
Expand Down