1.16.5 Part of the text in the option panel are hardcoded
DWaveletT opened this issue ยท 2 comments
I have noticed that some of the text in the option do not have any entries in the languadge file, but they can still be displayed in the game:
After checking the source code, I find those codes below in SodiumGameOptionPages.java:
public static OptionPage advanced() {
List<OptionGroup> groups = new ArrayList<>();
groups.add(OptionGroup.createBuilder()
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName("Use Chunk Multi-Draw")
.setTooltip("Multi-draw allows multiple chunks to be rendered with fewer draw calls, greatly reducing CPU overhead when " +
"rendering the world while also potentially allowing for more efficient GPU utilization. This optimization may cause " +
"issues with some graphics drivers, so you should try disabling it if you are experiencing glitches.")
.setControl(TickBoxControl::new)
.setBinding((opts, value) -> opts.advanced.useChunkMultidraw = value, opts -> opts.advanced.useChunkMultidraw)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.setImpact(OptionImpact.EXTREME)
.setEnabled(MultidrawChunkRenderBackend.isSupported(sodiumOpts.getData().advanced.ignoreDriverBlacklist))
.build())
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName("Use Vertex Array Objects")
.setTooltip("Helps to improve performance by moving information about how vertex data should be rendered into " +
"the driver, allowing it to better optimize for repeated rendering of the same objects. There is generally " +
"no reason to disable this unless you're using incompatible mods.")
.setControl(TickBoxControl::new)
.setBinding((opts, value) -> opts.advanced.useVertexArrayObjects = value, opts -> opts.advanced.useVertexArrayObjects)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.setImpact(OptionImpact.LOW)
.build())
.build());
groups.add(OptionGroup.createBuilder()
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(new TranslatableText("sodium.options.use_block_face_culling.name").getString())
.setTooltip(new TranslatableText("sodium.options.use_block_face_culling.tooltip").getString())
.setControl(TickBoxControl::new)
.setImpact(OptionImpact.MEDIUM)
.setBinding((opts, value) -> opts.advanced.useBlockFaceCulling = value, opts -> opts.advanced.useBlockFaceCulling)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.build()
)
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName("Use Compact Vertex Format")
.setTooltip("If enabled, a more compact vertex format will be used for rendering chunks. This can reduce graphics memory usage and bandwidth " +
"requirements significantly, especially for integrated graphics cards, but can cause z-fighting with some resource packs due " +
"to how it reduces the precision of position and texture coordinate attributes.")
.setControl(TickBoxControl::new)
.setImpact(OptionImpact.MEDIUM)
.setBinding((opts, value) -> opts.advanced.useCompactVertexFormat = value, opts -> opts.advanced.useCompactVertexFormat)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.build()
)
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(new TranslatableText("sodium.options.use_fog_occlusion.name").getString())
.setTooltip(new TranslatableText("sodium.options.use_fog_occlusion.tooltip").getString())
.setControl(TickBoxControl::new)
.setBinding((opts, value) -> opts.advanced.useFogOcclusion = value, opts -> opts.advanced.useFogOcclusion)
.setImpact(OptionImpact.MEDIUM)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.build()
)
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(new TranslatableText("sodium.options.use_entity_culling.name").getString())
.setTooltip(new TranslatableText("sodium.options.use_entity_culling.tooltip").getString())
.setControl(TickBoxControl::new)
.setImpact(OptionImpact.MEDIUM)
.setBinding((opts, value) -> opts.advanced.useEntityCulling = value, opts -> opts.advanced.useEntityCulling)
.build()
)
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(new TranslatableText("sodium.options.use_particle_culling.name").getString())
.setTooltip(new TranslatableText("sodium.options.use_particle_culling.tooltip").getString())
.setControl(TickBoxControl::new)
.setImpact(OptionImpact.MEDIUM)
.setBinding((opts, value) -> opts.advanced.useParticleCulling = value, opts -> opts.advanced.useParticleCulling)
.build()
)
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(new TranslatableText("sodium.options.animate_only_visible_textures.name").getString())
.setTooltip(new TranslatableText("sodium.options.animate_only_visible_textures.tooltip").getString())
.setControl(TickBoxControl::new)
.setImpact(OptionImpact.HIGH)
.setBinding((opts, value) -> opts.advanced.animateOnlyVisibleTextures = value, opts -> opts.advanced.animateOnlyVisibleTextures)
.build()
)
.build());
groups.add(OptionGroup.createBuilder()
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(new TranslatableText("sodium.options.allow_direct_memory_access.name").getString())
.setTooltip(new TranslatableText("sodium.options.allow_direct_memory_access.tooltip").getString())
.setControl(TickBoxControl::new)
.setImpact(OptionImpact.HIGH)
.setBinding((opts, value) -> opts.advanced.allowDirectMemoryAccess = value, opts -> opts.advanced.allowDirectMemoryAccess)
.build()
)
.build());
groups.add(OptionGroup.createBuilder()
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName("Ignore Driver Blacklist")
.setTooltip("If enabled, known incompatibilities with your hardware/driver configuration will be ignored, allowing you to enable options that " +
"may cause issues with your game. You should generally not touch this option unless you know exactly what you are doing. After changing " +
"this option, you must save, close, and then re-open the settings screen.")
.setControl(TickBoxControl::new)
.setBinding((opts, value) -> opts.advanced.ignoreDriverBlacklist = value, opts -> opts.advanced.ignoreDriverBlacklist)
.build()
)
.build());
return new OptionPage(new TranslatableText("sodium.options.pages.advanced").getString(), ImmutableList.copyOf(groups));
}
It's explicit that the four options are hardcoded in the file.
Also, in OptionImpact.java you can find that the words "Low", "Medium" and so on are hardcoded, even if they have entries in the languadge file.Meanwhile, in the file SodiumOptionsGUI.java the sentence Performance Impact:
is hardcoded too.
I hope that you can fix it, since it's strange to find part of the text are translated while the others are not.
Also, in the file ControlValueFormatter.java, the word Auto
, Unlimited
, Moody
and Bright
are hardcoded too. Maybe these tiny problems can be fixed together.
By the way, the same problem occurs in Oculus in IrisSodiumOptions.java in line 19-22 and line 44-46. As the two mods have the same provider and the same problem, I suppose that I can mention it here.