fix(config-ui-tiny): use correct Text for default preset
This commit is contained in:
parent
8cfa3c2a93
commit
64f0f38668
|
@ -26,7 +26,7 @@ public class TinyConfigScreenFactory implements ConfigScreenFactory<Screen, Tiny
|
||||||
&& config.getPresets().keySet().stream().allMatch(s -> s.equals(CategoryBuilder.CONFIG_PRESET_DEFAULT))
|
&& config.getPresets().keySet().stream().allMatch(s -> s.equals(CategoryBuilder.CONFIG_PRESET_DEFAULT))
|
||||||
&& config.getReferencedConfigs().isEmpty()
|
&& config.getReferencedConfigs().isEmpty()
|
||||||
&& config.getCategories().isEmpty()) {
|
&& config.getCategories().isEmpty()) {
|
||||||
EntryInfo entry = config.getEntries().get(0);
|
EntryInfo entry = config.getEntries().getFirst();
|
||||||
Type type = entry.supportsRepresentation() ? entry.getValueType() : null;
|
Type type = entry.supportsRepresentation() ? entry.getValueType() : null;
|
||||||
if (type != null && !type.isInt() && !type.isLong() && !type.isFloat() && !type.isDouble() && !type.isString() && !type.isBool() && !type.isEnum()) {
|
if (type != null && !type.isInt() && !type.isLong() && !type.isFloat() && !type.isDouble() && !type.isString() && !type.isBool() && !type.isEnum()) {
|
||||||
final String jsonified;
|
final String jsonified;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package io.gitlab.jfronny.libjf.config.impl.ui.tiny.presets;
|
||||||
|
|
||||||
import io.gitlab.jfronny.libjf.LibJf;
|
import io.gitlab.jfronny.libjf.LibJf;
|
||||||
import io.gitlab.jfronny.libjf.config.api.v2.ConfigCategory;
|
import io.gitlab.jfronny.libjf.config.api.v2.ConfigCategory;
|
||||||
|
import io.gitlab.jfronny.libjf.config.api.v2.dsl.CategoryBuilder;
|
||||||
import io.gitlab.jfronny.libjf.config.impl.ConfigCore;
|
import io.gitlab.jfronny.libjf.config.impl.ConfigCore;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -31,7 +32,7 @@ public class PresetsScreen extends Screen {
|
||||||
super.init();
|
super.init();
|
||||||
PresetListWidget list = new PresetListWidget(this.client, this.width, this.height, 32, 25);
|
PresetListWidget list = new PresetListWidget(this.client, this.width, this.height, 32, 25);
|
||||||
for (Map.Entry<String, Runnable> entry : config.getPresets().entrySet()) {
|
for (Map.Entry<String, Runnable> entry : config.getPresets().entrySet()) {
|
||||||
list.addButton(ButtonWidget.builder(Text.translatable(config.getTranslationPrefix() + entry.getKey()),
|
list.addButton(ButtonWidget.builder(CategoryBuilder.CONFIG_PRESET_DEFAULT.equals(entry.getKey()) ? Text.translatable(entry.getKey()) : Text.translatable(config.getTranslationPrefix() + entry.getKey()),
|
||||||
button -> {
|
button -> {
|
||||||
LibJf.LOGGER.info("Preset selected: " + entry.getKey());
|
LibJf.LOGGER.info("Preset selected: " + entry.getKey());
|
||||||
entry.getValue().run();
|
entry.getValue().run();
|
||||||
|
|
Loading…
Reference in New Issue