mojira.dev
MC-303872

The "options.chunkFade" string is not used by the chunk fade option slider

The string options.chunkFade is not being used correctly. The slider button will only display the strings options.chunkFade.none and options.chunkFade.seconds.

By decompiling, we can see the source code as follows:

private final OptionInstance<Double> chunkSectionFadeInTime = new OptionInstance<Double>("options.chunkFade", OptionInstance.cachedConstantTooltip(GRAPHICS_TOOLTIP_CHUNK_FADE), (component, d) -> {
        if (d <= 0.0) {
            return Component.translatable("options.chunkFade.none");
        }
        return Component.translatable("options.chunkFade.seconds", String.format(Locale.ROOT, "%.2f", d));
    }, new OptionInstance.IntRange(0, 40).xmap(n -> (double)n / 20.0, d -> (int)(d * 20.0), true), Codec.doubleRange((double)0.0, (double)2.0), 0.75, d -> {});

Actually, you should use Options.genericValueLabel(caption, valueLabel) in the callback to combine caption: value, instead of changing these two strings to Chunk Fade: value.

The code above should be changed like this:

private final OptionInstance<Double> chunkSectionFadeInTime = new OptionInstance<Double>(
    "options.chunkFade",
    OptionInstance.cachedConstantTooltip(GRAPHICS_TOOLTIP_CHUNK_FADE),
    (component, d) -> {
        if (d <= 0.0) {
            return Options.genericValueLabel(component, Component.translatable("options.chunkFade.none"));
        }
        return Options.genericValueLabel(
            component,
            Component.translatable("options.chunkFade.seconds", String.format(Locale.ROOT, "%.2f", d))
        );
    },
    new OptionInstance.IntRange(0, 40).xmap(n -> (double) n / 20.0, d -> (int) (d * 20.0), true),
    Codec.doubleRange(0.0, 2.0),
    0.75,
    d -> {}
);

Another piece of code also has the same problem:

private final OptionInstance<Double> chatDelay = new OptionInstance<Double>("options.chat.delay_instant", OptionInstance.noTooltip(), (component, d) -> {
    if (d <= 0.0) {
        return Component.translatable("options.chat.delay_none");
    }
    return Component.translatable("options.chat.delay", String.format(Locale.ROOT, "%.1f", d));
}, new OptionInstance.IntRange(0, 60).xmap(n -> (double)n / 10.0, d -> (int)(d * 10.0), true), Codec.doubleRange((double)0.0, (double)6.0), 0.0, d -> Minecraft.getInstance().getChatListener().setMessageDelay((double)d));

The problem here is more serious, and even the language file doesn't have the key options.chat.delay_instant at all.

Similarly, the code above should be changed like this:

private final OptionInstance<Double> chatDelay = new OptionInstance<Double>(
    "options.chat.delay_instant",
    OptionInstance.noTooltip(),
    (component, d) -> {
        if (d <= 0.0) {
            return Options.genericValueLabel(component, Component.translatable("options.chat.delay_none"));
        }
        return Options.genericValueLabel(
            component,
            Component.translatable("options.chat.delay", String.format(Locale.ROOT, "%.1f", d))
        );
    },
    new OptionInstance.IntRange(0, 60).xmap(n -> (double) n / 10.0, d -> (int) (d * 10.0), true),
    Codec.doubleRange(0.0, 6.0),
    0.0,
    d -> Minecraft.getInstance().getChatListener().setMessageDelay(d)
);

It should be noted that CycleButton will automatically concatenate and display using the passed caption, but AbstractOptionSliderButton needs to manually concatenate the caption into the final Component in the callback.

Attachments

Comments 2

Does this issue have any actual impact on the text displayed on these sliders in the game? Or would your fix not change the text shown but would make the code more “correct”?

This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

In snapshot 25w44a, the string options.chunkFade was added with the value Chunk Fade Time, but this string does not appear in the game, so we may not be able to translate it appropriately—because there is no context at all. If you consider it, like options.chat.delay_instant, to be an unused string, please remove options.chunkFade from the language file.

SkyEye_FAST

(Unassigned)

Confirmed

Platform

Low

Text

25w44a, 25w45a, 25w46a, 1.21.11 Pre-Release 2

Retrieved