Skip to content

Commit

Permalink
Use exclusively a valueformatter to present the XxZ blending area.
Browse files Browse the repository at this point in the history
Value of 0 can be set by vanilla, and work as intended, simply using
only smooth biome transitions without blending.

Signed-off-by: MeeniMc <[email protected]>
  • Loading branch information
MeeniMc committed Feb 26, 2024
1 parent 1ef7444 commit 65bbde3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ public static OptionPage quality() {
.add(OptionImpl.createBuilder(int.class, vanillaOpts)
.setName(Component.translatable("options.biomeBlendRadius"))
.setTooltip(Component.translatable("sodium.options.biome_blend.tooltip"))
.setControl(option -> new SliderControl(option, 1, 15, 2, ControlValueFormatter.biomeBlend()))
.setBinding((opts, value) -> opts.biomeBlendRadius().set((value-1)/2), opts -> opts.biomeBlendRadius().get()*2+1)
.setControl(option -> new SliderControl(option, 0, 7, 1, ControlValueFormatter.biomeBlend()))
.setBinding((opts, value) -> opts.biomeBlendRadius().set(value), opts -> opts.biomeBlendRadius().get())
.setImpact(OptionImpact.LOW)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ static ControlValueFormatter brightness() {
}

static ControlValueFormatter biomeBlend() {
return (v) -> Component.translatable("sodium.options.biome_blend.value", v, v);
return (v) -> {
if (v < 0 || v > 7) return Component.translatable("parsing.int.invalid", v);
int sv = 2 * v + 1;
return Component.literal(v + ": " + sv + "x" + sv);
};
}

Component format(int value);
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/assets/sodium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"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.",
"sodium.options.biome_blend.value": "%sx%s block(s)",
"sodium.options.biome_blend.tooltip": "The distance (in blocks) which biome colors are smoothly blended across. Default is 5x5. Using higher values will greatly increase the amount of time it takes to load or update chunks, for diminishing improvements in quality.",
"sodium.options.biome_blend.tooltip": "The distance (in blocks) at which biome colors are smoothly blended across. 0 is smooth only (no blend). Default is 2 (equivalent to 5x5 blend). Higher values will greatly increase the amount of time it takes to load or update chunks, for diminishing improvements in quality.",
"sodium.options.entity_distance.tooltip": "The render distance multiplier used by entity rendering. Smaller values decrease, and larger values increase, the maximum distance at which entities will be rendered.",
"sodium.options.entity_shadows.tooltip": "If enabled, basic shadows will be rendered beneath mobs and other entities.",
"sodium.options.vignette.name": "Vignette",
Expand Down

0 comments on commit 65bbde3

Please sign in to comment.