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 1 commit
Commits
File filter

Filter by extension

Filter by extension

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

Expand All @@ -161,17 +161,17 @@ public static OptionPage quality() {
}, opts -> opts.getCloudRenderMode().getValue())
.setImpact(OptionImpact.LOW)
.build())
.add(OptionImpl.createBuilder(SodiumGameOptions.GraphicsQuality.class, sodiumOpts)
.add(OptionImpl.createBuilder(SodiumGameOptions.WeatherQuality.class, sodiumOpts)
.setName(Text.translatable("soundCategory.weather"))
.setTooltip(Text.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(Text.translatable("sodium.options.leaves_quality.name"))
.setTooltip(Text.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 @@ -55,8 +55,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 @@ -70,8 +70,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 Text name;

Expand All @@ -89,6 +89,48 @@ public boolean isFancy(GraphicsMode graphicsMode) {
}
}

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

private final Text name;

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

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

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

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

private final Text name;

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

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fully sure if these enums are still wanted or if I should just do a Text[] like it is in clouds.

private static final Gson GSON = new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.setPrettyPrinting()
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/assets/sodium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@
"sodium.options.autosave_indicator.tooltip": "If enabled, an indicator will be shown when the game is saving the world to disk.",
"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.clouds_quality.fast": "Fast",
"sodium.options.clouds_quality.fancy": "Fancy",
"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
Loading