|
@@ -3,6 +3,7 @@ package me.lortseam.completeconfig.gui.cloth;
|
|
|
import lombok.Getter;
|
|
|
import me.lortseam.completeconfig.Config;
|
|
|
import me.lortseam.completeconfig.data.Collection;
|
|
|
+import me.lortseam.completeconfig.data.Entry;
|
|
|
import me.lortseam.completeconfig.gui.GuiBuilder;
|
|
|
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
|
|
import me.shedaniel.clothconfig2.api.ConfigBuilder;
|
|
@@ -40,25 +41,27 @@ public class ClothGuiBuilder implements GuiBuilder {
|
|
|
builder.setParentScreen(parentScreen)
|
|
|
.setTitle(new TranslatableText(config.getModTranslationKey() + ".title"))
|
|
|
.setSavingRunnable(savingRunnable);
|
|
|
- config.values().forEach(collection -> {
|
|
|
+ for(Collection collection : config.values()) {
|
|
|
ConfigCategory configCategory = builder.getOrCreateCategory(collection.getText());
|
|
|
for (AbstractConfigListEntry<?> entry : buildCollection(collection)) {
|
|
|
configCategory.addEntry(entry);
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
return builder.build();
|
|
|
}
|
|
|
|
|
|
private List<AbstractConfigListEntry> buildCollection(Collection collection) {
|
|
|
List<AbstractConfigListEntry> collectionGui = new ArrayList<>();
|
|
|
- collection.getEntries().values().forEach(entry -> collectionGui.add(((Optional<GuiProvider>) registry.getProvider(entry)).orElseGet(() -> {
|
|
|
- throw new UnsupportedOperationException("Could not find gui provider for field " + entry.getField());
|
|
|
- }).build(entry.getText(), entry.getField(), entry.getValue(), entry.getDefaultValue(), entry.getTooltip(), entry.getExtras(), entry::setValue, entry.requiresRestart())));
|
|
|
- collection.getCollections().values().forEach(c -> {
|
|
|
+ for (Entry entry : collection.getEntries().values()) {
|
|
|
+ collectionGui.add(((Optional<GuiProvider>) registry.getProvider(entry)).orElseGet(() -> {
|
|
|
+ throw new UnsupportedOperationException("Could not find gui provider for field " + entry.getField());
|
|
|
+ }).build(entry.getText(), entry.getField(), entry.getValue(), entry.getDefaultValue(), entry.getTooltip(), entry.getExtras(), entry::setValue, entry.requiresRestart()));
|
|
|
+ }
|
|
|
+ for (Collection c : collection.getCollections().values()) {
|
|
|
SubCategoryBuilder subBuilder = ConfigEntryBuilder.create().startSubCategory(c.getText());
|
|
|
subBuilder.addAll(buildCollection(c));
|
|
|
collectionGui.add(subBuilder.build());
|
|
|
- });
|
|
|
+ }
|
|
|
return collectionGui;
|
|
|
}
|
|
|
|