aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2023-11-03 20:44:55 +0800
committershedaniel <daniel@shedaniel.me>2024-04-16 00:38:18 +0900
commit526fef4ef6573f3ee978f6f6ab4c5a0cbb104462 (patch)
tree329c075f57006a8d1f03d89868e80ab4dde4dfd7
parent7c65a6720851c93dd170d857c637d752a1c02574 (diff)
downloadRoughlyEnoughItems-526fef4ef6573f3ee978f6f6ab4c5a0cbb104462.tar.gz
RoughlyEnoughItems-526fef4ef6573f3ee978f6f6ab4c5a0cbb104462.tar.bz2
RoughlyEnoughItems-526fef4ef6573f3ee978f6f6ab4c5a0cbb104462.zip
Remove old config logic, replace with new Config GUI completely
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java223
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java165
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ButtonsConfigEntry.java114
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringAddRuleScreen.java13
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringEntry.java92
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java30
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java17
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/NoFilteringEntry.java95
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/RecipeScreenTypeEntry.java113
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/SearchFilterSyntaxHighlightingEntry.java115
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java86
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java1
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java17
-rwxr-xr-xruntime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json32
14 files changed, 159 insertions, 954 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
index e961abaff..7f3b34f78 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
@@ -23,32 +23,20 @@
package me.shedaniel.rei.impl.client.config;
-import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.blaze3d.platform.InputConstants;
-import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import dev.architectury.hooks.client.screen.ScreenHooks;
import me.shedaniel.autoconfig.AutoConfig;
-import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.autoconfig.gui.ConfigScreenProvider;
-import me.shedaniel.autoconfig.gui.registry.GuiRegistry;
import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer;
-import me.shedaniel.autoconfig.util.Utils;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Jankson;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonNull;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonObject;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonPrimitive;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.api.DeserializationException;
-import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
-import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import me.shedaniel.clothconfig2.api.Modifier;
import me.shedaniel.clothconfig2.api.ModifierKeyCode;
-import me.shedaniel.clothconfig2.gui.entries.KeyCodeEntry;
-import me.shedaniel.clothconfig2.gui.entries.TextListEntry;
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.RoughlyEnoughItemsCoreClient;
import me.shedaniel.rei.api.client.REIRuntime;
import me.shedaniel.rei.api.client.config.ConfigManager;
import me.shedaniel.rei.api.client.config.addon.ConfigAddonRegistry;
@@ -58,55 +46,30 @@ import me.shedaniel.rei.api.client.entry.filtering.FilteringRuleType;
import me.shedaniel.rei.api.client.entry.filtering.FilteringRuleTypeRegistry;
import me.shedaniel.rei.api.client.favorites.FavoriteEntry;
import me.shedaniel.rei.api.client.gui.config.CheatingMode;
-import me.shedaniel.rei.api.client.gui.config.DisplayScreenType;
-import me.shedaniel.rei.api.client.gui.config.SyntaxHighlightingMode;
import me.shedaniel.rei.api.client.overlay.ScreenOverlay;
-import me.shedaniel.rei.api.client.registry.entry.CollapsibleEntryRegistry;
import me.shedaniel.rei.api.client.registry.entry.EntryRegistry;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryStack;
-import me.shedaniel.rei.api.common.plugins.PluginManager;
-import me.shedaniel.rei.api.common.util.CollectionUtils;
import me.shedaniel.rei.impl.client.REIRuntimeImpl;
import me.shedaniel.rei.impl.client.config.addon.ConfigAddonRegistryImpl;
import me.shedaniel.rei.impl.client.config.collapsible.CollapsibleConfigManager;
-import me.shedaniel.rei.impl.client.config.entries.*;
+import me.shedaniel.rei.impl.client.config.entries.ConfigAddonsEntry;
import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl;
import me.shedaniel.rei.impl.client.gui.config.REIConfigScreen;
-import me.shedaniel.rei.impl.client.gui.credits.CreditsScreen;
-import me.shedaniel.rei.impl.client.gui.performance.PerformanceScreen;
-import me.shedaniel.rei.impl.client.gui.screen.ConfigReloadingScreen;
-import me.shedaniel.rei.impl.client.gui.screen.collapsible.CollapsibleEntriesScreen;
-import me.shedaniel.rei.impl.client.search.argument.Argument;
import me.shedaniel.rei.impl.common.InternalLogger;
-import me.shedaniel.rei.impl.common.entry.type.collapsed.CollapsibleEntryRegistryImpl;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.ChatFormatting;
import net.minecraft.ResourceLocationException;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.components.Button;
-import net.minecraft.client.gui.components.events.GuiEventListener;
-import net.minecraft.client.gui.narration.NarratableEntry;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.nbt.TagParser;
-import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.HoverEvent;
-import net.minecraft.network.chat.TextColor;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.Mth;
import net.minecraft.world.InteractionResult;
-import org.apache.commons.lang3.tuple.Triple;
import org.jetbrains.annotations.ApiStatus;
-import java.util.*;
-import java.util.function.Consumer;
-
-import static me.shedaniel.autoconfig.util.Utils.getUnsafely;
-import static me.shedaniel.autoconfig.util.Utils.setUnsafely;
+import java.util.Locale;
@ApiStatus.Internal
@Environment(EnvType.CLIENT)
@@ -117,38 +80,6 @@ public class ConfigManagerImpl implements ConfigManager {
public ConfigManagerImpl() {
AutoConfig.register(ConfigObjectImpl.class, (definition, configClass) -> new JanksonConfigSerializer<>(definition, configClass, buildJankson(Jankson.builder())));
- GuiRegistry guiRegistry = AutoConfig.getGuiRegistry(ConfigObjectImpl.class);
- guiRegistry.registerPredicateProvider((i13n, field, config, defaults, guiProvider) -> {
- if (field.isAnnotationPresent(ConfigEntry.Gui.Excluded.class))
- return Collections.emptyList();
- KeyCodeEntry entry = ConfigEntryBuilder.create().startModifierKeyCodeField(Component.translatable(i13n), getUnsafely(field, config, ModifierKeyCode.unknown())).setModifierDefaultValue(() -> getUnsafely(field, defaults)).setModifierSaveConsumer(newValue -> setUnsafely(field, config, newValue)).build();
- return Collections.singletonList(entry);
- }, field -> field.getType() == ModifierKeyCode.class);
- guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) -> {
- ConfigObjectImpl.UsePercentage bounds = field.getAnnotation(ConfigObjectImpl.UsePercentage.class);
- return Collections.singletonList(ConfigEntryBuilder.create().startIntSlider(Component.translatable(i13n), Mth.ceil(Utils.getUnsafely(field, config, 0.0) * 100), Mth.ceil(bounds.min() * 100), Mth.ceil(bounds.max() * 100)).setDefaultValue(() -> Mth.ceil((double) Utils.getUnsafely(field, defaults) * 100)).setSaveConsumer((newValue) -> {
- setUnsafely(field, config, newValue / 100d);
- }).setTextGetter(integer -> Component.literal(bounds.prefix() + String.format("%d%%", integer))).build());
- }, (field) -> field.getType() == Double.TYPE || field.getType() == Double.class, ConfigObjectImpl.UsePercentage.class);
-
- guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) ->
- Collections.singletonList(new RecipeScreenTypeEntry(220, Component.translatable(i13n), getUnsafely(field, config, DisplayScreenType.UNSET), getUnsafely(field, defaults), type -> setUnsafely(field, config, type)))
- , (field) -> field.getType() == DisplayScreenType.class, ConfigObjectImpl.UseSpecialRecipeTypeScreen.class);
- guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) ->
- Collections.singletonList(new SearchFilterSyntaxHighlightingEntry(Component.translatable(i13n), getUnsafely(field, config, SyntaxHighlightingMode.COLORFUL), getUnsafely(field, defaults), type -> setUnsafely(field, config, type)))
- , (field) -> field.getType() == SyntaxHighlightingMode.class, ConfigObjectImpl.UseSpecialSearchFilterSyntaxHighlightingScreen.class);
- guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) -> {
- List<EntryStack<?>> value = CollectionUtils.map(Utils.<List<EntryStackProvider<?>>>getUnsafely(field, config, new ArrayList<>()), EntryStackProvider::provide);
- List<EntryStack<?>> defaultValue = CollectionUtils.map(Utils.<List<EntryStackProvider<?>>>getUnsafely(field, defaults), EntryStackProvider::provide);
- Consumer<List<EntryStack<?>>> saveConsumer = (newValue) -> {
- setUnsafely(field, config, CollectionUtils.map(newValue, EntryStackProvider::ofStack));
- };
- return REIRuntime.getInstance().getPreviousContainerScreen() == null || Minecraft.getInstance().getConnection() == null || Minecraft.getInstance().getConnection().getRecipeManager() == null ?
- Collections.singletonList(new NoFilteringEntry(220, value, defaultValue, saveConsumer))
- :
- Collections.singletonList(new FilteringEntry(220, value, ((ConfigObjectImpl.Advanced.Filtering) config).filteringRules, defaultValue, saveConsumer, list -> ((ConfigObjectImpl.Advanced.Filtering) config).filteringRules = Lists.newArrayList(list)));
- }
- , (field) -> field.getType() == List.class, ConfigObjectImpl.UseFilteringScreen.class);
InternalLogger.getInstance().info("Config loaded");
saveConfig();
FavoritesConfigManager.getInstance().syncFrom(this);
@@ -358,162 +289,16 @@ public class ConfigManagerImpl implements ConfigManager {
@SuppressWarnings("deprecation")
@Override
public Screen getConfigScreen(Screen parent) {
- if (Screen.hasShiftDown()) return new REIConfigScreen(parent);
- class EmptyEntry extends AbstractConfigListEntry<Object> {
- private final int height;
-
- public EmptyEntry(int height) {
- super(Component.literal(UUID.randomUUID().toString()), false);
- this.height = height;
- }
-
- public int getItemHeight() {
- return this.height;
- }
-
- public Object getValue() {
- return null;
- }
-
- public Optional<Object> getDefaultValue() {
- return Optional.empty();
- }
-
- public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int entryWidth, int entryHeight) {
- return false;
- }
-
- public void save() {
- }
-
- public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isHovered, float delta) {
- }
-
- public List<? extends GuiEventListener> children() {
- return Collections.emptyList();
- }
-
- public List<? extends NarratableEntry> narratables() {
- return Collections.emptyList();
- }
- }
+ if (true) return new REIConfigScreen(parent);
try {
ConfigScreenProvider<ConfigObjectImpl> provider = (ConfigScreenProvider<ConfigObjectImpl>) AutoConfig.getConfigScreen(ConfigObjectImpl.class, parent);
- provider.setI13nFunction(manager -> "config.roughlyenoughitems");
- provider.setOptionFunction((baseI13n, field) -> field.isAnnotationPresent(ConfigObjectImpl.DontApplyFieldName.class) ? baseI13n : String.format("%s.%s", baseI13n, field.getName()));
- provider.setCategoryFunction((baseI13n, categoryName) -> String.format("%s.%s", baseI13n, categoryName));
provider.setBuildFunction(builder -> {
- if (Minecraft.getInstance().getConnection() != null && Minecraft.getInstance().getConnection().getRecipeManager() != null) {
- TextListEntry feedbackEntry = ConfigEntryBuilder.create().startTextDescription(
- Component.translatable("text.rei.feedback", Component.translatable("text.rei.feedback.link")
- .withStyle(style -> style
- .withColor(TextColor.fromRgb(0xff1fc3ff))
- .withUnderlined(true)
- .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://forms.gle/5tdnK5WN1wng78pV8"))
- .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://forms.gle/5tdnK5WN1wng78pV8")))
- ))
- .withStyle(ChatFormatting.GRAY)
- ).build();
- CollapsibleConfigManager.CollapsibleConfigObject collapsibleConfigObject = new CollapsibleConfigManager.CollapsibleConfigObject();
- collapsibleConfigObject.disabledGroups.addAll(CollapsibleConfigManager.getInstance().getConfig().disabledGroups);
- collapsibleConfigObject.customGroups.addAll(CollectionUtils.map(CollapsibleConfigManager.getInstance().getConfig().customGroups, CollapsibleConfigManager.CustomGroup::copy));
- builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.functionality")).getEntries().add(0, new ButtonsConfigEntry(220,
- Triple.of(new TranslatableComponent("text.rei.collapsible.entries"), $ -> {}, editedSink -> {
- // Minecraft.getInstance().setScreen(new CollapsibleEntriesScreen(Minecraft.getInstance().screen, collapsibleConfigObject, editedSink));
- })) {
- @Override
- public boolean isEditable() {
- return !(REIRuntime.getInstance().getPreviousContainerScreen() == null || Minecraft.getInstance().getConnection() == null || Minecraft.getInstance().getConnection().getRecipeManager() == null);
- }
- }.withSaveRunnable(() -> {
- CollapsibleConfigManager.CollapsibleConfigObject actualConfig = CollapsibleConfigManager.getInstance().getConfig();
- actualConfig.disabledGroups.clear();
- actualConfig.disabledGroups.addAll(collapsibleConfigObject.disabledGroups);
- actualConfig.customGroups.clear();
- actualConfig.customGroups.addAll(collapsibleConfigObject.customGroups);
- CollapsibleConfigManager.getInstance().saveConfig();
- ((CollapsibleEntryRegistryImpl) CollapsibleEntryRegistry.getInstance()).recollectCustomEntries();
- }));
- ConfigureCategoriesScreen filteringScreen = new ConfigureCategoriesScreen(
- new HashMap<>(getConfig().getFilteringQuickCraftCategories()),
- new HashSet<>(getConfig().getHiddenCategories()),
- new ArrayList<>(getConfig().getCategoryOrdering())
- );
- builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.functionality")).getEntries().add(0, new ButtonsConfigEntry(220,
- Triple.of(new TranslatableComponent("config.roughlyenoughitems.configureCategories"), $ -> {}, editedSink -> {
- filteringScreen.parent = Minecraft.getInstance().screen;
- filteringScreen.editedSink = editedSink;
- Minecraft.getInstance().setScreen(filteringScreen);
- })) {
- @Override
- public boolean isEditable() {
- return !(REIRuntime.getInstance().getPreviousContainerScreen() == null || Minecraft.getInstance().getConnection() == null || Minecraft.getInstance().getConnection().getRecipeManager() == null);
- }
- }.withSaveRunnable(() -> {
- getConfig().setFilteringQuickCraftCategories(filteringScreen.getFilteringQuickCraftCategories());
- getConfig().setHiddenCategories(filteringScreen.getHiddenCategories());
- getConfig().setCategoryOrdering(filteringScreen.getCategoryOrdering());
- }));
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.advanced")).getEntries().add(0, feedbackEntry);
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.advanced")).getEntries().add(0, new ButtonsConfigEntry(220,
- Triple.of(new TranslatableComponent("text.rei.reload_config"), $ -> {}, $ -> {
- RoughlyEnoughItemsCore.PERFORMANCE_LOGGER.clear();
- RoughlyEnoughItemsCoreClient.reloadPlugins(null, null);
- }),
- Triple.of(new TranslatableComponent("text.rei.reload_search"), button -> {
- button.active = button.active && Argument.hasCache();
- }, $ -> {
- Argument.resetCache(true);
- })) {
- @Override
- public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) {
- if (PluginManager.areAnyReloading()) {
- Screen screen = Minecraft.getInstance().screen;
- Minecraft.getInstance().setScreen(new ConfigReloadingScreen(new TranslatableComponent("text.rei.config.is.reloading"), PluginManager::areAnyReloading, () -> Minecraft.getInstance().setScreen(screen), null));
- } else {
- super.render(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, isSelected, delta);
- }
- }
- });
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.advanced")).getEntries().add(0, new ButtonsConfigEntry(220,
- Triple.of(new TranslatableComponent("text.rei.performance"), $ -> {}, $ -> {
- Screen s = Minecraft.getInstance().screen;
- Minecraft.getInstance().setScreen(new PerformanceScreen(() -> Minecraft.getInstance().setScreen(s)));
- })));
- }
ConfigAddonRegistryImpl addonRegistry = (ConfigAddonRegistryImpl) ConfigAddonRegistry.getInstance();
if (!addonRegistry.getAddons().isEmpty()) {
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new EmptyEntry(4));
builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new ConfigAddonsEntry(220));
}
- TextListEntry supportText = ConfigEntryBuilder.create().startTextDescription(
- Component.translatable("text.rei.support.me.desc",
- Component.translatable("text.rei.support.me.patreon")
- .withStyle(style -> style
- .withColor(TextColor.fromRgb(0xff1fc3ff))
- .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://patreon.com/shedaniel"))
- .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://patreon.com/shedaniel")))
- ),
- Component.translatable("text.rei.support.me.bisect")
- .withStyle(style -> style
- .withColor(TextColor.fromRgb(0xff1fc3ff))
- .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.bisecthosting.com/shedaniel"))
- .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://www.bisecthosting.com/shedaniel")))
- )
- )
- .withStyle(ChatFormatting.GRAY)
- ).build();
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new EmptyEntry(4));
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, supportText);
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new TitleTextEntry(Component.translatable("text.rei.support.me")));
- builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new EmptyEntry(4));
- return builder.setAfterInitConsumer(screen -> {
- ScreenHooks.addRenderableWidget(screen, new Button(screen.width - 104, 4, 100, 20, Component.translatable("text.rei.credits"), button -> {
- CreditsScreen creditsScreen = new CreditsScreen(screen);
- Minecraft.getInstance().setScreen(creditsScreen);
- }));
- }).setSavingRunnable(() -> {
+ return builder.setSavingRunnable(() -> {
saveConfig();
EntryRegistry.getInstance().refilter();
REIRuntime.getInstance().getOverlay().ifPresent(ScreenOverlay::queueReloadOverlay);
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
index a1a94e88c..b08ad02ef 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
@@ -26,7 +26,6 @@ package me.shedaniel.rei.impl.client.config;
import com.mojang.blaze3d.platform.InputConstants;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
-import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment;
import me.shedaniel.clothconfig2.api.Modifier;
import me.shedaniel.clothconfig2.api.ModifierKeyCode;
@@ -47,10 +46,6 @@ import net.minecraft.world.level.GameType;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
import java.util.*;
@ApiStatus.Internal
@@ -58,13 +53,9 @@ import java.util.*;
@Environment(EnvType.CLIENT)
@SuppressWarnings("FieldMayBeFinal")
public class ConfigObjectImpl implements ConfigObject, ConfigData {
- @ConfigEntry.Category("basics") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName
public Basics basics = new Basics();
- @ConfigEntry.Category("appearance") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName
public Appearance appearance = new Appearance();
- @ConfigEntry.Category("functionality") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName
public Functionality functionality = new Functionality();
- @ConfigEntry.Category("advanced") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName
public Advanced advanced = new Advanced();
@Override
@@ -80,7 +71,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
@Override
public boolean isCheating() {
return basics.cheating == CheatingMode.ON || (basics.cheating == CheatingMode.WHEN_CREATIVE && Minecraft.getInstance().gameMode != null
- && Minecraft.getInstance().gameMode.getPlayerMode() == GameType.CREATIVE);
+ && Minecraft.getInstance().gameMode.getPlayerMode() == GameType.CREATIVE);
}
@Override
@@ -596,49 +587,20 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
return advanced.search.modSearch;
}
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.FIELD})
- @interface DontApplyFieldName {}
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.FIELD})
- @interface UseSpecialRecipeTypeScreen {}
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.FIELD})
- @interface UseSpecialSearchFilterSyntaxHighlightingScreen {}
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.FIELD})
- @interface UseFilteringScreen {}
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.FIELD})
- @interface UsePercentage {
- double min();
-
- double max();
-
- String prefix() default "Size: ";
- }
-
public static class Basics {
- @ConfigEntry.Gui.Excluded public List<FavoriteEntry> favorites = new ArrayList<>();
- @ConfigEntry.Gui.Excluded public List<FavoriteEntry> hiddenFavorites = new ArrayList<>();
- @ConfigEntry.Gui.Excluded public List<CompoundTag> displayHistory = new ArrayList<>();
- @Comment("Declares whether cheating mode is on.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ public List<FavoriteEntry> favorites = new ArrayList<>();
+ public List<FavoriteEntry> hiddenFavorites = new ArrayList<>();
+ public List<CompoundTag> displayHistory = new ArrayList<>();
public CheatingMode cheating = CheatingMode.OFF;
public boolean favoritesEnabled = true;
public boolean reduceMotion = false;
- @ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
public KeyBindings keyBindings = new KeyBindings();
- @Comment("Declares whether REI is visible.") @ConfigEntry.Gui.Excluded public boolean overlayVisible = true;
- @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ @Comment("Declares whether REI is visible.")
+ public boolean overlayVisible = true;
public ItemCheatingStyle cheatingStyle = ItemCheatingStyle.GRAB;
}
public static class KeyBindings {
- @ConfigEntry.Gui.Excluded
public boolean useNativeKeybinds;
public ModifierKeyCode recipeKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_R), Modifier.none());
public ModifierKeyCode usageKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_U), Modifier.none());
@@ -653,123 +615,128 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
}
public static class Appearance {
- @UseSpecialRecipeTypeScreen public DisplayScreenType recipeScreenType = DisplayScreenType.UNSET;
- @Comment("Declares the appearance of REI windows.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ public DisplayScreenType recipeScreenType = DisplayScreenType.UNSET;
+ @Comment("Declares the appearance of REI windows.")
public AppearanceTheme theme = AppearanceTheme.LIGHT;
- @ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
public Layout layout = new Layout();
- @Comment("Declares the appearance of recipe's border.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ @Comment("Declares the appearance of recipe's border.")
public RecipeBorderType recipeBorder = RecipeBorderType.DEFAULT;
- @Comment("Declares whether entry panel is scrolled.") public boolean scrollingEntryListWidget = false;
- @Comment("Declares whether entry panel should be invisible when not searching") public boolean hideEntryPanelIfIdle = false;
+ @Comment("Declares whether entry panel is scrolled.")
+ public boolean scrollingEntryListWidget = false;
+ @Comment("Declares whether entry panel should be invisible when not searching")
+ public boolean hideEntryPanelIfIdle = false;
public static class Layout {
- @Comment("Declares the position of the search field.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ @Comment("Declares the position of the search field.")
public SearchFieldLocation searchFieldLocation = SearchFieldLocation.CENTER;
- @Comment("Declares the position of the config button.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ @Comment("Declares the position of the config button.")
public ConfigButtonPosition configButtonLocation = ConfigButtonPosition.LOWER;
- @Comment("Declares whether the craftable filter button is enabled.") public boolean showCraftableOnlyButton = true;
+ @Comment("Declares whether the craftable filter button is enabled.")
+ public boolean showCraftableOnlyButton = true;
}
- @UsePercentage(min = 0.1, max = 1.0, prefix = "Limit: ") public double horizontalEntriesBoundaries = 1.0;
- @UsePercentage(min = 0.1, max = 1.0, prefix = "Limit: ") public double verticalEntriesBoundaries = 1.0;
+ public double horizontalEntriesBoundaries = 1.0;
+ public double verticalEntriesBoundaries = 1.0;
public int horizontalEntriesBoundariesColumns = 50;
public int verticalEntriesBoundariesRows = 1000;
public double horizontalEntriesBoundariesAlignment = 1.0;
public double verticalEntriesBoundariesAlignment = 0.5;
- @UsePercentage(min = 0.1, max = 1.0, prefix = "Limit: ") public double favoritesHorizontalEntriesBoundaries = 1.0;
+ public double favoritesHorizontalEntriesBoundaries = 1.0;
public int favoritesHorizontalEntriesBoundariesColumns = 50;
- @UseSpecialSearchFilterSyntaxHighlightingScreen public SyntaxHighlightingMode syntaxHighlightingMode = SyntaxHighlightingMode.COLORFUL;
+ public SyntaxHighlightingMode syntaxHighlightingMode = SyntaxHighlightingMode.COLORFUL;
public boolean isFocusModeZoomed = false;
}
public static class Functionality {
- @ConfigEntry.Gui.Excluded @Nullable public ResourceLocation inputMethod = null;
- @Comment("Declares whether REI should remove the recipe book.") public boolean disableRecipeBook = false;
- @Comment("Declares whether mob effects should be on the left side instead of the right side.") public boolean leftSideMobEffects = false;
- @Comment("Declares whether subsets is enabled.") public boolean isSubsetsEnabled = false;
+ @Nullable
+ public ResourceLocation inputMethod = null;
+ @Comment("Declares whether REI should remove the recipe book.")
+ public boolean disableRecipeBook = false;
+ @Comment("Declares whether mob effects should be on the left side instead of the right side.")
+ public boolean leftSideMobEffects = false;
+ @Comment("Declares whether subsets is enabled.")
+ public boolean isSubsetsEnabled = false;
public boolean allowInventoryHighlighting = true;
- @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
public ItemCheatingMode itemCheatingMode = ItemCheatingMode.REI_LIKE;
}
public static class Advanced {
- @ConfigEntry.Gui.CollapsibleObject
public Tooltips tooltips = new Tooltips();
- @ConfigEntry.Gui.CollapsibleObject
public Layout layout = new Layout();
- @ConfigEntry.Gui.CollapsibleObject
public Accessibility accessibility = new Accessibility();
- @ConfigEntry.Gui.CollapsibleObject
public Search search = new Search();
- @ConfigEntry.Gui.CollapsibleObject
public Commands commands = new Commands();
- @ConfigEntry.Gui.CollapsibleObject
public Miscellaneous miscellaneous = new Miscellaneous();
- @ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
public Filtering filtering = new Filtering();
public static class Tooltips {
- @Comment("Declares whether REI should append mod names to entries.") public boolean appendModNames = true;
- @Comment("Declares whether favorites tooltip should be displayed.") public boolean displayFavoritesTooltip = false;
- @ConfigEntry.Gui.Excluded public boolean displayIMEHints = true;
+ @Comment("Declares whether REI should append mod names to entries.")
+ public boolean appendModNames = true;
+ @Comment("Declares whether favorites tooltip should be displayed.")
+ public boolean displayFavoritesTooltip = false;
+ public boolean displayIMEHints = true;
}
public static class Layout {
@Comment("The ordering of the items on the entry panel.")
- @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
public EntryPanelOrderingConfig entryPanelOrdering = EntryPanelOrderingConfig.REGISTRY_ASCENDING;
- @Comment("Declares the maximum amount of recipes displayed in a page if possible.") @ConfigEntry.BoundedDiscrete(min = 2, max = 99)
+ @Comment("Declares the maximum amount of recipes displayed in a page if possible.")
public int maxRecipesPerPage = 8;
- @Comment("Declares the maximum amount of recipes displayed in a page if possible.") @ConfigEntry.BoundedDiscrete(min = 100, max = 1000)
+ @Comment("Declares the maximum amount of recipes displayed in a page if possible.")
public int maxRecipesPageHeight = 300;
- @Comment("Declares whether entry rendering time should be debugged.") public boolean debugRenderTimeRequired = false;
- @Comment("Merges displays with equal contents under 1 display.") public boolean mergeDisplayUnderOne = true;
- @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ @Comment("Declares whether entry rendering time should be debugged.")
+ public boolean debugRenderTimeRequired = false;
+ @Comment("Merges displays with equal contents under 1 display.")
+ public boolean mergeDisplayUnderOne = true;
public FavoriteAddWidgetMode favoriteAddWidgetMode = FavoriteAddWidgetMode.ALWAYS_VISIBLE;
}
public static class Accessibility {
- @UsePercentage(min = 0.25, max = 4.0) public double entrySize = 1.0;
- @Comment("Declares the position of the entry panel.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
+ public double entrySize = 1.0;
+ @Comment("Declares the position of the entry panel.")
public DisplayPanelLocation displayPanelLocation = DisplayPanelLocation.RIGHT;
- @Comment("Declares how the scrollbar in composite screen should act.") public boolean compositeScrollBarPermanent = false;
+ @Comment("Declares how the scrollbar in composite screen should act.")
+ public boolean compositeScrollBarPermanent = false;
public boolean toastDisplayedOnCopyIdentifier = true;
- @Comment("Declares whether REI should use compact tabs for categories.") public boolean useCompactTabs = true;
- @Comment("Declares whether REI should use compact tab buttons for categories.") public boolean useCompactTabButtons = false;
+ @Comment("Declares whether REI should use compact tabs for categories.")
+ public boolean useCompactTabs = true;
+ @Comment("Declares whether REI should use compact tab buttons for categories.")
+ public boolean useCompactTabButtons = false;
}
public static class Search {