mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-17 09:45:10 +01:00
clean: improve entry access further
This commit is contained in:
@@ -174,7 +174,6 @@ public abstract class MidnightConfig {
|
|||||||
};
|
};
|
||||||
info.function = new AbstractMap.SimpleEntry<ButtonWidget.PressAction, Function<Object, Text>>(button -> {
|
info.function = new AbstractMap.SimpleEntry<ButtonWidget.PressAction, Function<Object, Text>>(button -> {
|
||||||
int index = values.indexOf(info.value) + 1;
|
int index = values.indexOf(info.value) + 1;
|
||||||
//info.value = values.get(index >= values.size() ? 0 : index); button.setMessage(func.apply(info.value));
|
|
||||||
info.setValue(values.get(index >= values.size() ? 0 : index));
|
info.setValue(values.get(index >= values.size() ? 0 : index));
|
||||||
button.setMessage(func.apply(info.value));
|
button.setMessage(func.apply(info.value));
|
||||||
}, func);
|
}, func);
|
||||||
@@ -250,7 +249,7 @@ public abstract class MidnightConfig {
|
|||||||
this.parent = parent; this.modid = modid;
|
this.parent = parent; this.modid = modid;
|
||||||
this.translationPrefix = modid + ".midnightconfig.";
|
this.translationPrefix = modid + ".midnightconfig.";
|
||||||
loadValuesFromJson(modid);
|
loadValuesFromJson(modid);
|
||||||
entries.forEach((id, info) -> {
|
entries.values().forEach(info -> {
|
||||||
if (info.modid.equals(modid)) {
|
if (info.modid.equals(modid)) {
|
||||||
String tabId = info.entry != null ? info.entry.category() : info.comment.category();
|
String tabId = info.entry != null ? info.entry.category() : info.comment.category();
|
||||||
String name = translationPrefix + "category." + tabId;
|
String name = translationPrefix + "category." + tabId;
|
||||||
@@ -335,7 +334,7 @@ public abstract class MidnightConfig {
|
|||||||
this.list.clear(); fillList();
|
this.list.clear(); fillList();
|
||||||
}
|
}
|
||||||
public void fillList() {
|
public void fillList() {
|
||||||
for (EntryInfo info : entries.sequencedValues()) {
|
for (EntryInfo info : entries.values()) {
|
||||||
if (!info.conditionsMet) {
|
if (!info.conditionsMet) {
|
||||||
boolean visibleButLocked = false;
|
boolean visibleButLocked = false;
|
||||||
for (Condition condition : info.conditions) {
|
for (Condition condition : info.conditions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user