Jelajahi Sumber

Config with comments

Unknown 6 tahun lalu
induk
melakukan
85c0aab0b1

+ 32 - 16
build.gradle

@@ -1,22 +1,26 @@
+import net.fabricmc.loom.task.RemapJar
+
 plugins {
     id 'fabric-loom' version '0.2.0-SNAPSHOT'
+    id "com.github.johnrengelman.shadow" version "4.0.3"
 }
 
 sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
+group = "me.shedaniel"
 archivesBaseName = "RoughlyEnoughItems"
-version = "2.3.3.57"
-
-def minecraftVersion = "19w09a"
-def yarnVersion = "19w09a.4"
-def fabricVersion = "0.2.3.108"
-def fabricLoaderVersion = "0.3.7.109"
-def pluginLoaderVersion = "1.14-1.0.6-8"
+version = project.modVersion
 
 minecraft {
 }
 
+repositories {
+    maven { url "https://tehnut.info/maven/" }
+    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
+    maven { url "https://maven.jamieswhiteshirt.com/libs-release/" }
+}
+
 processResources {
     filesMatching('fabric.mod.json') {
         expand 'version': project.version
@@ -24,17 +28,29 @@ processResources {
     inputs.property "version", project.version
 }
 
-repositories {
-    maven { url "https://tehnut.info/maven/" }
+configurations {
+    contained {
+        transitive = false
+    }
 }
 
-dependencies {
-    minecraft "com.mojang:minecraft:${minecraftVersion}"
-    mappings "net.fabricmc:yarn:${yarnVersion}"
-    modCompile "net.fabricmc:fabric-loader:${fabricLoaderVersion}"
+shadowJar {
+    configurations = [project.configurations.contained]
+}
 
-    // Fabric API. This is technically optional, but you probably want it anyway.
-    modCompile "net.fabricmc:fabric:${fabricVersion}"
+task remapShadowJar(type: RemapJar) {
+    jar = shadowJar.archivePath
+}
+tasks.remapShadowJar.dependsOn tasks.shadowJar
 
-    modCompile "info.tehnut.pluginloader:plugin-loader:${pluginLoaderVersion}"
+dependencies {
+    minecraft "com.mojang:minecraft:${project.minecraftVersion}"
+    mappings "net.fabricmc:yarn:${project.yarnVersion}"
+    modCompile "net.fabricmc:fabric-loader:${project.fabricLoaderVersion}"
+    modCompile "com.jamieswhiteshirt:developer-mode:${project.developerModeVersion}"
+    modCompile "info.tehnut.pluginloader:plugin-loader:${project.pluginLoaderVersion}"
+    modCompile "net.fabricmc:fabric:${project.fabricVersion}"
+
+    compile "blue.endless:jankson:${project.janksonVersion}"
+    contained "blue.endless:jankson:${project.janksonVersion}"
 }

+ 8 - 0
gradle.properties

@@ -0,0 +1,8 @@
+modVersion=2.4.0.58
+minecraftVersion=19w09a
+yarnVersion=19w09a.4
+fabricVersion=0.2.3.108
+fabricLoaderVersion=0.3.7.109
+pluginLoaderVersion=1.14-1.0.6-8
+developerModeVersion=1.0.3
+janksonVersion=1.1.0

+ 4 - 4
src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java

@@ -35,14 +35,14 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer, ModInitiali
     private static final PluginDisabler PLUGIN_DISABLER = new PluginDisablerImpl();
     private static final ItemRegistry ITEM_REGISTRY = new ItemRegistryImpl();
     private static final Map<Identifier, REIPlugin> plugins = Maps.newHashMap();
-    private static ConfigHelper configHelper;
+    private static ConfigManager configManager;
     
     public static RecipeHelper getRecipeHelper() {
         return RECIPE_HELPER;
     }
     
-    public static ConfigHelper getConfigHelper() {
-        return configHelper;
+    public static me.shedaniel.rei.api.ConfigManager getConfigManager() {
+        return configManager;
     }
     
     public static ItemRegistry getItemRegisterer() {
@@ -74,7 +74,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer, ModInitiali
     @SuppressWarnings("deprecation")
     @Override
     public void onInitializeClient() {
-        configHelper = new ConfigHelper();
+        configManager = new ConfigManager();
         
         // If pluginloader is not installed, base functionality should still remain
         if (!FabricLoader.getInstance().isModLoaded("pluginloader")) {

+ 19 - 0
src/main/java/me/shedaniel/rei/api/ConfigManager.java

@@ -0,0 +1,19 @@
+package me.shedaniel.rei.api;
+
+import me.shedaniel.rei.client.ConfigObject;
+
+import java.io.IOException;
+
+public interface ConfigManager {
+    
+    void saveConfig() throws IOException;
+    
+    void loadConfig() throws IOException;
+    
+    ConfigObject getConfig();
+    
+    boolean isCraftableOnlyEnabled();
+    
+    void toggleCraftableOnly();
+    
+}

+ 4 - 4
src/main/java/me/shedaniel/rei/client/ClientHelper.java

@@ -64,13 +64,13 @@ public class ClientHelper implements ClientModInitializer {
     }
     
     public static boolean isCheating() {
-        return RoughlyEnoughItemsCore.getConfigHelper().getConfig().cheating;
+        return RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating;
     }
     
     public static void setCheating(boolean cheating) {
-        RoughlyEnoughItemsCore.getConfigHelper().getConfig().cheating = cheating;
+        RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating = cheating;
         try {
-            RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+            RoughlyEnoughItemsCore.getConfigManager().saveConfig();
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -95,7 +95,7 @@ public class ClientHelper implements ClientModInitializer {
         } else {
             Identifier identifier = Registry.ITEM.getId(cheatedStack.getItem());
             String tagMessage = cheatedStack.copy().getTag() != null && !cheatedStack.copy().getTag().isEmpty() ? cheatedStack.copy().getTag().asString() : "";
-            String og = cheatedStack.getAmount() != 1 ? RoughlyEnoughItemsCore.getConfigHelper().getConfig().giveCommand.replaceAll(" \\{count}", "").replaceAll("\\{count}", "") : RoughlyEnoughItemsCore.getConfigHelper().getConfig().giveCommand;
+            String og = cheatedStack.getAmount() != 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand.replaceAll(" \\{count}", "").replaceAll("\\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand;
             String madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", tagMessage).replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));
             if (madeUpCommand.length() > 256) {
                 madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", "").replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));

+ 0 - 75
src/main/java/me/shedaniel/rei/client/ConfigHelper.java

@@ -1,75 +0,0 @@
-package me.shedaniel.rei.client;
-
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import net.fabricmc.loader.api.FabricLoader;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-
-public class ConfigHelper {
-    
-    private final File configFile;
-    private REIConfig config;
-    private boolean craftableOnly;
-    
-    public ConfigHelper() {
-        this.configFile = new File(FabricLoader.getInstance().getConfigDirectory(), "rei.json");
-        this.craftableOnly = false;
-        try {
-            loadConfig();
-            RoughlyEnoughItemsCore.LOGGER.info("REI: Config is loaded.");
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-    
-    public void saveConfig() throws IOException {
-        configFile.getParentFile().mkdirs();
-        if (!configFile.exists() && !configFile.createNewFile()) {
-            RoughlyEnoughItemsCore.LOGGER.error("REI: Failed to save config! Overwriting with default config.");
-            config = new REIConfig();
-            return;
-        }
-        FileWriter writer = new FileWriter(configFile, false);
-        try {
-            REIConfig.GSON.toJson(config, writer);
-        } finally {
-            writer.close();
-        }
-    }
-    
-    public void loadConfig() throws IOException {
-        if (!configFile.exists() || !configFile.canRead()) {
-            config = new REIConfig();
-            saveConfig();
-            return;
-        }
-        boolean failed = false;
-        try {
-            config = REIConfig.GSON.fromJson(new InputStreamReader(Files.newInputStream(configFile.toPath())), REIConfig.class);
-        } catch (Exception e) {
-            failed = true;
-        }
-        if (failed || config == null) {
-            RoughlyEnoughItemsCore.LOGGER.error("REI: Failed to load config! Overwriting with default config.");
-            config = new REIConfig();
-        }
-        saveConfig();
-    }
-    
-    public REIConfig getConfig() {
-        return config;
-    }
-    
-    public boolean craftableOnly() {
-        return craftableOnly;
-    }
-    
-    public void toggleCraftableOnly() {
-        craftableOnly = !craftableOnly;
-    }
-    
-}

+ 111 - 0
src/main/java/me/shedaniel/rei/client/ConfigManager.java

@@ -0,0 +1,111 @@
+package me.shedaniel.rei.client;
+
+import blue.endless.jankson.Jankson;
+import blue.endless.jankson.JsonObject;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import net.fabricmc.loader.api.FabricLoader;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+
+public class ConfigManager implements me.shedaniel.rei.api.ConfigManager {
+    
+    private static final Gson GSON = new GsonBuilder().create();
+    private static final Jankson JANKSON = Jankson.builder().build();
+    private final File configFile, oldConfigFile;
+    private ConfigObject config;
+    private boolean craftableOnly;
+    
+    public ConfigManager() {
+        this.oldConfigFile = new File(FabricLoader.getInstance().getConfigDirectory(), "rei.json");
+        this.configFile = new File(FabricLoader.getInstance().getConfigDirectory(), "roughlyenoughitems/config.json");
+        this.craftableOnly = false;
+        try {
+            loadConfig();
+            RoughlyEnoughItemsCore.LOGGER.info("REI: Config is loaded.");
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+    
+    @Override
+    public void saveConfig() throws IOException {
+        configFile.getParentFile().mkdirs();
+        if (!configFile.exists() && !configFile.createNewFile()) {
+            RoughlyEnoughItemsCore.LOGGER.error("REI: Failed to save config! Overwriting with default config.");
+            config = new ConfigObject();
+            return;
+        }
+        try {
+            String result = JANKSON.toJson(config).toJson(true, true, 0);
+            if (!configFile.exists())
+                configFile.createNewFile();
+            FileOutputStream out = new FileOutputStream(configFile, false);
+            
+            out.write(result.getBytes());
+            out.flush();
+            out.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            RoughlyEnoughItemsCore.LOGGER.error("REI: Failed to save config! Overwriting with default config.");
+            config = new ConfigObject();
+            return;
+        }
+    }
+    
+    @Override
+    public void loadConfig() throws IOException {
+        configFile.getParentFile().mkdirs();
+        if (!configFile.exists() && oldConfigFile.exists()) {
+            RoughlyEnoughItemsCore.LOGGER.info("REI: Detected old config file, trying to move it.");
+            try {
+                Files.move(oldConfigFile.toPath(), configFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
+            } catch (Exception e) {
+                e.printStackTrace();
+                RoughlyEnoughItemsCore.LOGGER.error("REI: Failed to move config file.");
+            }
+        }
+        if (!configFile.exists() || !configFile.canRead()) {
+            RoughlyEnoughItemsCore.LOGGER.warn("REI: Config not found! Creating one.");
+            config = new ConfigObject();
+            saveConfig();
+            return;
+        }
+        boolean failed = false;
+        try {
+            JsonObject configJson = JANKSON.load(configFile);
+            String regularized = configJson.toJson(false, false, 0);
+    
+            config = GSON.fromJson(regularized, ConfigObject.class);
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed = true;
+        }
+        if (failed || config == null) {
+            RoughlyEnoughItemsCore.LOGGER.error("REI: Failed to load config! Overwriting with default config.");
+            config = new ConfigObject();
+        }
+        saveConfig();
+    }
+    
+    @Override
+    public ConfigObject getConfig() {
+        return config;
+    }
+    
+    @Override
+    public boolean isCraftableOnlyEnabled() {
+        return craftableOnly;
+    }
+    
+    @Override
+    public void toggleCraftableOnly() {
+        craftableOnly = !craftableOnly;
+    }
+    
+}

+ 49 - 0
src/main/java/me/shedaniel/rei/client/ConfigObject.java

@@ -0,0 +1,49 @@
+package me.shedaniel.rei.client;
+
+import blue.endless.jankson.Comment;
+import me.shedaniel.rei.api.RelativePoint;
+
+public class ConfigObject {
+    
+    public boolean cheating = false;
+    
+    @Comment("The ordering of the items on the item panel.")
+    public ItemListOrdering itemListOrdering = ItemListOrdering.registry;
+    
+    @Comment("The ordering of the items on the item panel.")
+    public boolean isAscending = true;
+    
+    @Comment("To toggle the craftable button next to the search field.")
+    public boolean enableCraftableOnlyButton = true;
+    
+    @Comment("True: search field will be on the side (left / right), false: in the middle")
+    public boolean sideSearchField = false;
+    
+    @Comment("The command used in servers to cheat items")
+    public String giveCommand = "/give {player_name} {item_identifier}{nbt} {count}";
+    
+    @Comment("The command used to change gamemode")
+    public String gamemodeCommand = "/gamemode {gamemode}";
+    
+    @Comment("The command used to change weather")
+    public String weatherCommand = "/weather {weather}";
+    
+    @Comment("True: item panel on the left, false: on the right")
+    public boolean mirrorItemPanel = false;
+    
+    @Comment("To disable REI's defualt plugin, don't change this unless you understand what you are doing")
+    public boolean loadDefaultPlugin = true;
+    
+    @Comment("Toggle the credits button")
+    public boolean disableCreditsButton = false;
+    
+    @Comment("Maximum recipes viewed at one time.")
+    public int maxRecipePerPage = 3;
+    
+    @Comment("Toggle utils buttons")
+    public boolean showUtilsButtons = false;
+    
+    @Comment("The location of choose page dialog")
+    public RelativePoint choosePageDialogPoint = new RelativePoint(.5, .5);
+    
+}

+ 17 - 0
src/main/java/me/shedaniel/rei/client/ItemListOrdering.java

@@ -0,0 +1,17 @@
+package me.shedaniel.rei.client;
+
+public enum ItemListOrdering {
+    
+    registry("ordering.rei.registry"), name("ordering.rei.name"), item_groups("ordering.rei.item_groups");
+    
+    private String nameTranslationKey;
+    
+    ItemListOrdering(String nameTranslationKey) {
+        this.nameTranslationKey = nameTranslationKey;
+    }
+    
+    public String getNameTranslationKey() {
+        return nameTranslationKey;
+    }
+    
+}

+ 0 - 26
src/main/java/me/shedaniel/rei/client/REIConfig.java

@@ -1,26 +0,0 @@
-package me.shedaniel.rei.client;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import me.shedaniel.rei.api.RelativePoint;
-
-public class REIConfig {
-    
-    public static Gson GSON = new GsonBuilder().setPrettyPrinting().create();
-    
-    public boolean cheating = false;
-    public REIItemListOrdering itemListOrdering = REIItemListOrdering.REGISTRY;
-    public boolean isAscending = true;
-    public boolean enableCraftableOnlyButton = true;
-    public boolean sideSearchField = false;
-    public String giveCommand = "/give {player_name} {item_identifier}{nbt} {count}";
-    public String gamemodeCommand = "/gamemode {gamemode}";
-    public String weatherCommand = "/weather {weather}";
-    public boolean mirrorItemPanel = false;
-    public boolean loadDefaultPlugin = true;
-    public boolean disableCreditsButton = false;
-    public int maxRecipePerPage = 3;
-    public boolean showUtilsButtons = false;
-    public RelativePoint choosePageDialogPoint = new RelativePoint(.5, .5);
-    
-}

+ 0 - 19
src/main/java/me/shedaniel/rei/client/REIItemListOrdering.java

@@ -1,19 +0,0 @@
-package me.shedaniel.rei.client;
-
-import com.google.gson.annotations.SerializedName;
-
-public enum REIItemListOrdering {
-    
-    @SerializedName("registry") REGISTRY("ordering.rei.registry"), @SerializedName("name") NAME("ordering.rei.name"), @SerializedName("item_groups") ITEM_GROUPS("ordering.rei.item_groups");
-    
-    private String nameTranslationKey;
-    
-    REIItemListOrdering(String nameTranslationKey) {
-        this.nameTranslationKey = nameTranslationKey;
-    }
-    
-    public String getNameTranslationKey() {
-        return nameTranslationKey;
-    }
-    
-}

+ 15 - 15
src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java

@@ -73,7 +73,7 @@ public class ContainerScreenOverlay extends ScreenComponent {
             }
         });
         page = MathHelper.clamp(page, 0, getTotalPage());
-        widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel ? window.getScaledWidth() - 30 : 10, 10, 20, 20, "") {
+        widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel ? window.getScaledWidth() - 30 : 10, 10, 20, 20, "") {
             @Override
             public void onPressed(int button, double mouseX, double mouseY) {
                 if (Screen.isShiftPressed()) {
@@ -103,18 +103,18 @@ public class ContainerScreenOverlay extends ScreenComponent {
                 }
             }
         });
-        if (!RoughlyEnoughItemsCore.getConfigHelper().getConfig().disableCreditsButton)
-            widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel ? window.getScaledWidth() - 50 : 10, window.getScaledHeight() - 30, 40, 20, I18n.translate("text.rei.credits")) {
+        if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().disableCreditsButton)
+            widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel ? window.getScaledWidth() - 50 : 10, window.getScaledHeight() - 30, 40, 20, I18n.translate("text.rei.credits")) {
                 @Override
                 public void onPressed(int button, double mouseX, double mouseY) {
                     MinecraftClient.getInstance().openScreen(new CreditsScreen(GuiHelper.getLastContainerScreen()));
                 }
             });
-        if (RoughlyEnoughItemsCore.getConfigHelper().getConfig().showUtilsButtons) {
-            widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel ? window.getScaledWidth() - 55 : 35, 10, 20, 20, "") {
+        if (RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons) {
+            widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel ? window.getScaledWidth() - 55 : 35, 10, 20, 20, "") {
                 @Override
                 public void onPressed(int button, double mouseX, double mouseY) {
-                    MinecraftClient.getInstance().player.sendChatMessage(RoughlyEnoughItemsCore.getConfigHelper().getConfig().gamemodeCommand.replaceAll("\\{gamemode}", getNextGameMode().getName()));
+                    MinecraftClient.getInstance().player.sendChatMessage(RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand.replaceAll("\\{gamemode}", getNextGameMode().getName()));
                 }
                 
                 @Override
@@ -125,10 +125,10 @@ public class ContainerScreenOverlay extends ScreenComponent {
                         addTooltip(QueuedTooltip.create(I18n.translate("text.rei.gamemode_button.tooltip", getGameModeText(getNextGameMode())).split("\n")));
                 }
             });
-            widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel ? window.getScaledWidth() - 80 : 60, 10, 20, 20, "") {
+            widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel ? window.getScaledWidth() - 80 : 60, 10, 20, 20, "") {
                 @Override
                 public void onPressed(int button, double mouseX, double mouseY) {
-                    MinecraftClient.getInstance().player.sendChatMessage(RoughlyEnoughItemsCore.getConfigHelper().getConfig().weatherCommand.replaceAll("\\{weather}", getNextWeather().getName().toLowerCase()));
+                    MinecraftClient.getInstance().player.sendChatMessage(RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand.replaceAll("\\{weather}", getNextWeather().getName().toLowerCase()));
                 }
                 
                 @Override
@@ -178,11 +178,11 @@ public class ContainerScreenOverlay extends ScreenComponent {
         GuiHelper.searchField.getBounds().setBounds(getTextFieldArea());
         this.widgets.add(GuiHelper.searchField);
         GuiHelper.searchField.setText(searchTerm);
-        if (RoughlyEnoughItemsCore.getConfigHelper().getConfig().enableCraftableOnlyButton)
+        if (RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton)
             this.widgets.add(new CraftableToggleButtonWidget(getCraftableToggleArea()) {
                 @Override
                 public void onPressed(int button, double mouseX, double mouseY) {
-                    RoughlyEnoughItemsCore.getConfigHelper().toggleCraftableOnly();
+                    RoughlyEnoughItemsCore.getConfigManager().toggleCraftableOnly();
                     itemListOverlay.updateList(getItemListArea(), page, searchTerm);
                 }
             });
@@ -256,8 +256,8 @@ public class ContainerScreenOverlay extends ScreenComponent {
     }
     
     private Rectangle getTextFieldArea() {
-        int widthRemoved = RoughlyEnoughItemsCore.getConfigHelper().getConfig().enableCraftableOnlyButton ? 22 : 2;
-        if (RoughlyEnoughItemsCore.getConfigHelper().getConfig().sideSearchField)
+        int widthRemoved = RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton ? 22 : 2;
+        if (RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField)
             return new Rectangle(rectangle.x + 2, window.getScaledHeight() - 22, rectangle.width - 6 - widthRemoved, 18);
         if (MinecraftClient.getInstance().currentScreen instanceof RecipeViewingScreen) {
             RecipeViewingScreen widget = (RecipeViewingScreen) MinecraftClient.getInstance().currentScreen;
@@ -278,7 +278,7 @@ public class ContainerScreenOverlay extends ScreenComponent {
     }
     
     private Rectangle getItemListArea() {
-        return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (RoughlyEnoughItemsCore.getConfigHelper().getConfig().sideSearchField ? 27 + 22 : 27));
+        return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField ? 27 + 22 : 27));
     }
     
     public Rectangle getRectangle() {
@@ -289,7 +289,7 @@ public class ContainerScreenOverlay extends ScreenComponent {
         List<ItemStack> currentStacks = ClientHelper.getInventoryItemsTypes();
         if (getLeft() != lastLeft)
             onInitialized();
-        else if (RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() && (!hasSameListContent(new LinkedList<>(GuiHelper.inventoryStacks), currentStacks) || (currentStacks.size() != GuiHelper.inventoryStacks.size()))) {
+        else if (RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled() && (!hasSameListContent(new LinkedList<>(GuiHelper.inventoryStacks), currentStacks) || (currentStacks.size() != GuiHelper.inventoryStacks.size()))) {
             GuiHelper.inventoryStacks = ClientHelper.getInventoryItemsTypes();
             itemListOverlay.updateList(getItemListArea(), page, searchTerm);
         }
@@ -336,7 +336,7 @@ public class ContainerScreenOverlay extends ScreenComponent {
     }
     
     private Rectangle calculateBoundary() {
-        if (!RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel) {
+        if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel) {
             int startX = GuiHelper.getLastContainerScreenHooks().rei_getContainerLeft() + GuiHelper.getLastContainerScreenHooks().rei_getContainerWidth() + 10;
             int width = window.getScaledWidth() - startX;
             if (MinecraftClient.getInstance().currentScreen instanceof RecipeViewingScreen) {

+ 2 - 2
src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java

@@ -263,12 +263,12 @@ public class RecipeViewingScreen extends Screen {
         if (selectedCategory.getDisplaySettings().getFixedRecipesPerPage() > 0)
             return selectedCategory.getDisplaySettings().getFixedRecipesPerPage() - 1;
         int height = selectedCategory.getDisplayHeight();
-        return MathHelper.clamp(MathHelper.floor(((double) largestHeight - 40d) / ((double) height + 7d)) - 1, 0, Math.min(RoughlyEnoughItemsCore.getConfigHelper().getConfig().maxRecipePerPage - 1, selectedCategory.getMaximumRecipePerPage() - 1));
+        return MathHelper.clamp(MathHelper.floor(((double) largestHeight - 40d) / ((double) height + 7d)) - 1, 0, Math.min(RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage - 1, selectedCategory.getMaximumRecipePerPage() - 1));
     }
     
     private int getRecipesPerPageByHeight() {
         int height = selectedCategory.getDisplayHeight();
-        return MathHelper.clamp(MathHelper.floor(((double) guiHeight - 40d) / ((double) height + 7d)) - 1, 0, Math.min(RoughlyEnoughItemsCore.getConfigHelper().getConfig().maxRecipePerPage - 1, selectedCategory.getMaximumRecipePerPage() - 1));
+        return MathHelper.clamp(MathHelper.floor(((double) guiHeight - 40d) / ((double) height + 7d)) - 1, 0, Math.min(RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage - 1, selectedCategory.getMaximumRecipePerPage() - 1));
     }
     
     @Override

+ 53 - 49
src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java

@@ -1,9 +1,11 @@
 package me.shedaniel.rei.gui.config;
 
+import com.google.common.collect.Lists;
 import me.shedaniel.rei.RoughlyEnoughItemsCore;
 import me.shedaniel.rei.client.ClientHelper;
 import me.shedaniel.rei.client.GuiHelper;
-import me.shedaniel.rei.client.REIItemListOrdering;
+import me.shedaniel.rei.client.ItemListOrdering;
+import me.shedaniel.rei.gui.widget.QueuedTooltip;
 import me.shedaniel.rei.gui.widget.TextFieldWidget;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.InputListener;
@@ -16,14 +18,17 @@ import net.minecraft.text.TranslatableTextComponent;
 import java.awt.*;
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.List;
 
 public class ConfigScreen extends Screen {
     
+    private final List<QueuedTooltip> tooltipList;
     private Screen parent;
     private ConfigEntryListWidget entryListWidget;
     
     public ConfigScreen(Screen parent) {
         this.parent = parent;
+        this.tooltipList = Lists.newArrayList();
     }
     
     @Override
@@ -60,9 +65,9 @@ public class ConfigScreen extends Screen {
             @Override
             public boolean onPressed(int button, double mouseX, double mouseY) {
                 if (button == 0)
-                    RoughlyEnoughItemsCore.getConfigHelper().getConfig().sideSearchField = !RoughlyEnoughItemsCore.getConfigHelper().getConfig().sideSearchField;
+                    RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField = !RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                     return false;
@@ -72,20 +77,20 @@ public class ConfigScreen extends Screen {
             
             @Override
             public String getText() {
-                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().sideSearchField);
+                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField);
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.ButtonConfigEntry(new TranslatableTextComponent("text.rei.config.list_ordering"), new ConfigEntry.ButtonConfigEntry.ConfigEntryButtonProvider() {
             @Override
             public boolean onPressed(int button, double mouseX, double mouseY) {
-                int index = Arrays.asList(REIItemListOrdering.values()).indexOf(RoughlyEnoughItemsCore.getConfigHelper().getConfig().itemListOrdering) + 1;
-                if (index >= REIItemListOrdering.values().length) {
+                int index = Arrays.asList(ItemListOrdering.values()).indexOf(RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering) + 1;
+                if (index >= ItemListOrdering.values().length) {
                     index = 0;
-                    RoughlyEnoughItemsCore.getConfigHelper().getConfig().isAscending = !RoughlyEnoughItemsCore.getConfigHelper().getConfig().isAscending;
+                    RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending = !RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending;
                 }
-                RoughlyEnoughItemsCore.getConfigHelper().getConfig().itemListOrdering = REIItemListOrdering.values()[index];
+                RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering = ItemListOrdering.values()[index];
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                     return false;
@@ -95,16 +100,16 @@ public class ConfigScreen extends Screen {
             
             @Override
             public String getText() {
-                return I18n.translate("text.rei.config.list_ordering_button", I18n.translate(RoughlyEnoughItemsCore.getConfigHelper().getConfig().itemListOrdering.getNameTranslationKey()), I18n.translate(RoughlyEnoughItemsCore.getConfigHelper().getConfig().isAscending ? "ordering.rei.ascending" : "ordering.rei.descending"));
+                return I18n.translate("text.rei.config.list_ordering_button", I18n.translate(RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering.getNameTranslationKey()), I18n.translate(RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending ? "ordering.rei.ascending" : "ordering.rei.descending"));
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.ButtonConfigEntry(new TranslatableTextComponent("text.rei.config.mirror_rei"), new ConfigEntry.ButtonConfigEntry.ConfigEntryButtonProvider() {
             @Override
             public boolean onPressed(int button, double mouseX, double mouseY) {
                 if (button == 0)
-                    RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel = !RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel;
+                    RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel = !RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                     return false;
@@ -114,7 +119,7 @@ public class ConfigScreen extends Screen {
             
             @Override
             public String getText() {
-                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().mirrorItemPanel);
+                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel);
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.CategoryTitleConfigEntry(new TranslatableTextComponent("text.rei.config.modules")));
@@ -122,9 +127,9 @@ public class ConfigScreen extends Screen {
             @Override
             public boolean onPressed(int button, double mouseX, double mouseY) {
                 if (button == 0)
-                    RoughlyEnoughItemsCore.getConfigHelper().getConfig().enableCraftableOnlyButton = !RoughlyEnoughItemsCore.getConfigHelper().getConfig().enableCraftableOnlyButton;
+                    RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton = !RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                     return false;
@@ -134,16 +139,16 @@ public class ConfigScreen extends Screen {
             
             @Override
             public String getText() {
-                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().enableCraftableOnlyButton);
+                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton);
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.ButtonConfigEntry(new TranslatableTextComponent("text.rei.config.load_default_plugin"), new ConfigEntry.ButtonConfigEntry.ConfigEntryButtonProvider() {
             @Override
             public boolean onPressed(int button, double mouseX, double mouseY) {
                 if (button == 0)
-                    RoughlyEnoughItemsCore.getConfigHelper().getConfig().loadDefaultPlugin = !RoughlyEnoughItemsCore.getConfigHelper().getConfig().loadDefaultPlugin;
+                    RoughlyEnoughItemsCore.getConfigManager().getConfig().loadDefaultPlugin = !RoughlyEnoughItemsCore.getConfigManager().getConfig().loadDefaultPlugin;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                     return false;
@@ -153,26 +158,24 @@ public class ConfigScreen extends Screen {
             
             @Override
             public String getText() {
-                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().loadDefaultPlugin);
+                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigManager().getConfig().loadDefaultPlugin);
             }
             
             @Override
             public void draw(me.shedaniel.rei.gui.widget.ButtonWidget button, Point mouse, float delta) {
                 button.draw(mouse.x, mouse.y, delta);
-                if (button.isHighlighted(mouse)) {
-                    GuiLighting.disable();
-                    drawTooltip(Arrays.asList(I18n.translate("text.rei.config.load_default_plugin.restart_tooltip").split("\n")), mouse.x, mouse.y);
-                    GuiLighting.disable();
-                }
+                if (button.isHighlighted(mouse))
+                    tooltipList.add(QueuedTooltip.create(I18n.translate("text.rei.config.load_default_plugin.restart_tooltip").split("\n")));
+                
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.ButtonConfigEntry(new TranslatableTextComponent("text.rei.config.disable_credits_button"), new ConfigEntry.ButtonConfigEntry.ConfigEntryButtonProvider() {
             @Override
             public boolean onPressed(int button, double mouseX, double mouseY) {
                 if (button == 0)
-                    RoughlyEnoughItemsCore.getConfigHelper().getConfig().disableCreditsButton = !RoughlyEnoughItemsCore.getConfigHelper().getConfig().disableCreditsButton;
+                    RoughlyEnoughItemsCore.getConfigManager().getConfig().disableCreditsButton = !RoughlyEnoughItemsCore.getConfigManager().getConfig().disableCreditsButton;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                     return false;
@@ -182,16 +185,16 @@ public class ConfigScreen extends Screen {
             
             @Override
             public String getText() {
-                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().disableCreditsButton);
+                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigManager().getConfig().disableCreditsButton);
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.ButtonConfigEntry(new TranslatableTextComponent("text.rei.config.enable_util_buttons"), new ConfigEntry.ButtonConfigEntry.ConfigEntryButtonProvider() {
             @Override
             public boolean onPressed(int button, double mouseX, double mouseY) {
                 if (button == 0)
-                    RoughlyEnoughItemsCore.getConfigHelper().getConfig().showUtilsButtons = !RoughlyEnoughItemsCore.getConfigHelper().getConfig().showUtilsButtons;
+                    RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons = !RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                     return false;
@@ -201,7 +204,7 @@ public class ConfigScreen extends Screen {
             
             @Override
             public String getText() {
-                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().showUtilsButtons);
+                return getTrueFalseText(RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons);
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.CategoryTitleConfigEntry(new TranslatableTextComponent("text.rei.config.advanced")));
@@ -209,15 +212,15 @@ public class ConfigScreen extends Screen {
             @Override
             public void onInitWidget(TextFieldWidget widget) {
                 widget.setMaxLength(99999);
-                widget.setText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().giveCommand);
+                widget.setText(RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand);
                 widget.setSuggestion(I18n.translate("text.rei.give_command.suggestion"));
             }
             
             @Override
             public void onUpdateText(TextFieldWidget button, String text) {
-                RoughlyEnoughItemsCore.getConfigHelper().getConfig().giveCommand = text;
+                RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand = text;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
@@ -226,25 +229,22 @@ public class ConfigScreen extends Screen {
             @Override
             public void draw(TextFieldWidget widget, Point mouse, float delta) {
                 widget.draw(mouse.x, mouse.y, delta);
-                if (widget.isHighlighted(mouse)) {
-                    GuiLighting.disable();
-                    drawTooltip(Arrays.asList(I18n.translate("text.rei.give_command.tooltip").split("\n")), mouse.x, mouse.y);
-                    GuiLighting.disable();
-                }
+                if (widget.isHighlighted(mouse))
+                    tooltipList.add(QueuedTooltip.create(I18n.translate("text.rei.give_command.tooltip").split("\n")));
             }
         }));
         entryListWidget.configAddEntry(new ConfigEntry.TextFieldConfigEntry(new TranslatableTextComponent("text.rei.gamemode_command"), new ConfigEntry.TextFieldConfigEntry.ConfigEntryTextFieldProvider() {
             @Override
             public void onInitWidget(TextFieldWidget widget) {
                 widget.setMaxLength(99999);
-                widget.setText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().gamemodeCommand);
+                widget.setText(RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand);
             }
             
             @Override
             public void onUpdateText(TextFieldWidget button, String text) {
-                RoughlyEnoughItemsCore.getConfigHelper().getConfig().gamemodeCommand = text;
+                RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand = text;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
@@ -254,14 +254,14 @@ public class ConfigScreen extends Screen {
             @Override
             public void onInitWidget(TextFieldWidget widget) {
                 widget.setMaxLength(99999);
-                widget.setText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().weatherCommand);
+                widget.setText(RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand);
             }
-        
+            
             @Override
             public void onUpdateText(TextFieldWidget button, String text) {
-                RoughlyEnoughItemsCore.getConfigHelper().getConfig().weatherCommand = text;
+                RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand = text;
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
@@ -271,7 +271,7 @@ public class ConfigScreen extends Screen {
             @Override
             public void onInitWidget(TextFieldWidget widget) {
                 widget.setMaxLength(2);
-                widget.setText(RoughlyEnoughItemsCore.getConfigHelper().getConfig().maxRecipePerPage + "");
+                widget.setText(RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage + "");
                 widget.stripInvaild = s -> {
                     StringBuilder stringBuilder_1 = new StringBuilder();
                     char[] var2 = s.toCharArray();
@@ -291,8 +291,8 @@ public class ConfigScreen extends Screen {
             public void onUpdateText(TextFieldWidget button, String text) {
                 if (isInvaildNumber(text))
                     try {
-                        RoughlyEnoughItemsCore.getConfigHelper().getConfig().maxRecipePerPage = Integer.valueOf(text);
-                        RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                        RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage = Integer.valueOf(text);
+                        RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                     } catch (Exception e) {
                     }
             }
@@ -316,7 +316,7 @@ public class ConfigScreen extends Screen {
             @Override
             public void onPressed(double double_1, double double_2) {
                 try {
-                    RoughlyEnoughItemsCore.getConfigHelper().saveConfig();
+                    RoughlyEnoughItemsCore.getConfigManager().saveConfig();
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
@@ -337,6 +337,10 @@ public class ConfigScreen extends Screen {
         this.entryListWidget.draw(int_1, int_2, float_1);
         this.drawStringCentered(this.fontRenderer, I18n.translate("text.rei.config"), this.screenWidth / 2, 16, 16777215);
         super.draw(int_1, int_2, float_1);
+        GuiLighting.disable();
+        tooltipList.forEach(queuedTooltip -> drawTooltip(queuedTooltip.getText(), queuedTooltip.getLocation().x, queuedTooltip.getLocation().y));
+        tooltipList.clear();
+        GuiLighting.disable();
     }
     
     @Override

+ 2 - 2
src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java

@@ -41,14 +41,14 @@ public abstract class CraftableToggleButtonWidget extends ButtonWidget {
         MinecraftClient.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
         GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
         this.zOffset = 100f;
-        this.drawTexturedRect(getBounds().x, getBounds().y, (56 + (RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() ? 0 : 20)), 202, 20, 20);
+        this.drawTexturedRect(getBounds().x, getBounds().y, (56 + (RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled() ? 0 : 20)), 202, 20, 20);
         this.zOffset = 0f;
         if (getBounds().contains(mouseX, mouseY))
             drawTooltip();
     }
     
     private void drawTooltip() {
-        GuiHelper.getLastOverlay().addTooltip(new QueuedTooltip(ClientHelper.getMouseLocation(), Arrays.asList(I18n.translate(RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() ? "text.rei.showing_craftable" : "text.rei.showing_all"))));
+        GuiHelper.getLastOverlay().addTooltip(new QueuedTooltip(ClientHelper.getMouseLocation(), Arrays.asList(I18n.translate(RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled() ? "text.rei.showing_craftable" : "text.rei.showing_all"))));
     }
     
 }

+ 9 - 9
src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java

@@ -5,7 +5,7 @@ import me.shedaniel.rei.RoughlyEnoughItemsCore;
 import me.shedaniel.rei.api.RecipeHelper;
 import me.shedaniel.rei.client.ClientHelper;
 import me.shedaniel.rei.client.GuiHelper;
-import me.shedaniel.rei.client.REIItemListOrdering;
+import me.shedaniel.rei.client.ItemListOrdering;
 import me.shedaniel.rei.client.SearchArgument;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.DrawableHelper;
@@ -103,16 +103,16 @@ public class ItemListOverlay extends DrawableHelper implements IWidget {
         List<ItemStack> os = new LinkedList<>(ol), stacks = Lists.newArrayList(), finalStacks = Lists.newArrayList();
         List<ItemGroup> itemGroups = new LinkedList<>(Arrays.asList(ItemGroup.GROUPS));
         itemGroups.add(null);
-        REIItemListOrdering ordering = RoughlyEnoughItemsCore.getConfigHelper().getConfig().itemListOrdering;
-        if (ordering != REIItemListOrdering.REGISTRY)
+        ItemListOrdering ordering = RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering;
+        if (ordering != ItemListOrdering.registry)
             Collections.sort(os, (itemStack, t1) -> {
-                if (ordering.equals(REIItemListOrdering.NAME))
+                if (ordering.equals(ItemListOrdering.name))
                     return itemStack.getDisplayName().getFormattedText().compareToIgnoreCase(t1.getDisplayName().getFormattedText());
-                if (ordering.equals(REIItemListOrdering.ITEM_GROUPS))
+                if (ordering.equals(ItemListOrdering.item_groups))
                     return itemGroups.indexOf(itemStack.getItem().getItemGroup()) - itemGroups.indexOf(t1.getItem().getItemGroup());
                 return 0;
             });
-        if (!RoughlyEnoughItemsCore.getConfigHelper().getConfig().isAscending)
+        if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending)
             Collections.reverse(os);
         String[] splitSearchTerm = StringUtils.splitByWholeSeparatorPreserveAllTokens(searchTerm, "|");
         Arrays.stream(splitSearchTerm).forEachOrdered(s -> {
@@ -135,14 +135,14 @@ public class ItemListOverlay extends DrawableHelper implements IWidget {
         });
         if (splitSearchTerm.length == 0)
             stacks.addAll(os);
-        List<ItemStack> workingItems = RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() && inventoryItems.size() > 0 ? new ArrayList<>() : new LinkedList<>(ol);
-        if (RoughlyEnoughItemsCore.getConfigHelper().craftableOnly()) {
+        List<ItemStack> workingItems = RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled() && inventoryItems.size() > 0 ? new ArrayList<>() : new LinkedList<>(ol);
+        if (RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled()) {
             RecipeHelper.getInstance().findCraftableByItems(inventoryItems).forEach(workingItems::add);
             workingItems.addAll(inventoryItems);
         }
         final List<ItemStack> finalWorkingItems = workingItems;
         finalStacks.addAll(stacks.stream().filter(itemStack -> {
-            if (!RoughlyEnoughItemsCore.getConfigHelper().craftableOnly())
+            if (!RoughlyEnoughItemsCore.getConfigManager().isCraftableOnlyEnabled())
                 return true;
             for(ItemStack workingItem : finalWorkingItems)
                 if (itemStack.isEqualIgnoreTags(workingItem))

+ 5 - 5
src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java

@@ -3,8 +3,8 @@ package me.shedaniel.rei.gui.widget;
 import com.google.common.collect.Lists;
 import com.mojang.blaze3d.platform.GlStateManager;
 import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import me.shedaniel.rei.api.ConfigManager;
 import me.shedaniel.rei.api.RelativePoint;
-import me.shedaniel.rei.client.ConfigHelper;
 import me.shedaniel.rei.gui.RecipeViewingScreen;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.render.GuiLighting;
@@ -38,7 +38,7 @@ public class RecipeChoosePageWidget extends DraggableWidget {
     
     private static Point getPointFromConfig() {
         Window window = MinecraftClient.getInstance().window;
-        RelativePoint point = RoughlyEnoughItemsCore.getConfigHelper().getConfig().choosePageDialogPoint;
+        RelativePoint point = RoughlyEnoughItemsCore.getConfigManager().getConfig().choosePageDialogPoint;
         return new Point((int) point.getX(window.getScaledWidth()), (int) point.getY(window.getScaledHeight()));
     }
     
@@ -175,11 +175,11 @@ public class RecipeChoosePageWidget extends DraggableWidget {
     
     @Override
     public void onMouseReleaseMidPoint(Point midPoint) {
-        ConfigHelper configHelper = RoughlyEnoughItemsCore.getConfigHelper();
+        ConfigManager configManager = RoughlyEnoughItemsCore.getConfigManager();
         Window window = MinecraftClient.getInstance().window;
-        configHelper.getConfig().choosePageDialogPoint = new RelativePoint(midPoint.getX() / window.getScaledWidth(), midPoint.getY() / window.getScaledHeight());
+        configManager.getConfig().choosePageDialogPoint = new RelativePoint(midPoint.getX() / window.getScaledWidth(), midPoint.getY() / window.getScaledHeight());
         try {
-            configHelper.saveConfig();
+            configManager.saveConfig();
         } catch (IOException e) {
             e.printStackTrace();
         }

+ 1 - 1
src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java

@@ -48,7 +48,7 @@ public class DefaultPlugin implements REIPlugin {
     
     @Override
     public void onFirstLoad(PluginDisabler pluginDisabler) {
-        if (!RoughlyEnoughItemsCore.getConfigHelper().getConfig().loadDefaultPlugin) {
+        if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().loadDefaultPlugin) {
             pluginDisabler.disablePluginFunction(PLUGIN, PluginFunction.REGISTER_ITEMS);
             pluginDisabler.disablePluginFunction(PLUGIN, PluginFunction.REGISTER_CATEGORIES);
             pluginDisabler.disablePluginFunction(PLUGIN, PluginFunction.REGISTER_RECIPE_DISPLAYS);

+ 1 - 1
src/main/resources/fabric.mod.json

@@ -2,7 +2,7 @@
   "id": "roughlyenoughitems",
   "name": "RoughlyEnoughItems",
   "description": "To allow players to view items and recipes. Version: ${version}",
-  "version": "2.3.3",
+  "version": "2.4",
   "side": "client",
   "authors": [
     "Danielshe"