fix bug: the @Condition does not trigger in real-time to update the menu UI

This commit is contained in:
Jaffe2718
2025-04-02 22:00:54 +08:00
parent ebcafa6b09
commit faf8c199b4

View File

@@ -163,7 +163,9 @@ public abstract class MidnightConfig {
};
info.function = new AbstractMap.SimpleEntry<ButtonWidget.PressAction, Function<Object, Text>>(button -> {
int index = values.indexOf(info.value) + 1;
info.value = values.get(index >= values.size() ? 0 : index); button.setMessage(func.apply(info.value));
//info.value = values.get(index >= values.size() ? 0 : index); button.setMessage(func.apply(info.value));
info.setValue(values.get(index >= values.size() ? 0 : index));
button.setMessage(func.apply(info.value));
}, func);
}
}