diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-08-08 16:53:46 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-08-08 16:53:46 +0800 |
| commit | 10fa4cea1da644efe5b3045d3159a3eebdb8c0a8 (patch) | |
| tree | 0e8f504b66391d6762d526c0e7cdd94c3cb6022f /src/main/java/me/shedaniel | |
| parent | 6464acb0a7fe98ab30f9419e6aa95bdd1e92bc74 (diff) | |
| download | RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.tar.gz RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.tar.bz2 RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.zip | |
Using fiber as a config lib
Diffstat (limited to 'src/main/java/me/shedaniel')
23 files changed, 524 insertions, 351 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 5a2a170c8..0f882570a 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -210,14 +210,14 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { return; } lastSync.set(System.currentTimeMillis()); - if (RoughlyEnoughItemsCore.getConfigManager().getConfig().registerRecipesInAnotherThread) { + if (RoughlyEnoughItemsCore.getConfigManager().getConfig().doesRegisterRecipesInAnotherThread()) { CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager), SYNC_RECIPES); } else { ((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager); } }); ClothClientHooks.SCREEN_ADD_BUTTON.register((minecraftClient, screen, abstractButtonWidget) -> { - if (RoughlyEnoughItemsCore.getConfigManager().getConfig().disableRecipeBook && screen instanceof AbstractContainerScreen && abstractButtonWidget instanceof TexturedButtonWidget) + if (RoughlyEnoughItemsCore.getConfigManager().getConfig().doesDisableRecipeBook() && screen instanceof AbstractContainerScreen && abstractButtonWidget instanceof TexturedButtonWidget) if (((RecipeBookButtonWidgetHooks) abstractButtonWidget).rei_getTexture().equals(recipeButtonTex)) return ActionResult.FAIL; return ActionResult.PASS; diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java index 5f915dfff..e64d5df55 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigManager.java @@ -5,7 +5,7 @@ package me.shedaniel.rei.api; -import me.shedaniel.rei.client.ConfigObject; +import me.zeroeightsix.fiber.exception.FiberException; import net.minecraft.client.gui.screen.Screen; import java.io.IOException; @@ -17,14 +17,14 @@ public interface ConfigManager { * * @throws IOException when error */ - void saveConfig() throws IOException; + void saveConfig() throws IOException, FiberException; /** * Loads the config from the json file, creates the file if not found. * * @throws IOException when error */ - void loadConfig() throws IOException; + void loadConfig() throws IOException, FiberException; /** * Gets the config instance diff --git a/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/src/main/java/me/shedaniel/rei/api/ConfigObject.java new file mode 100644 index 000000000..de6911c96 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -0,0 +1,89 @@ +package me.shedaniel.rei.api; + +import me.shedaniel.rei.gui.config.ItemCheatingMode; +import me.shedaniel.rei.gui.config.ItemListOrdering; +import me.shedaniel.rei.gui.config.RecipeScreenType; +import me.zeroeightsix.fiber.tree.ConfigNode; + +public interface ConfigObject { + + ConfigNode getConfigNode(); + + void setCheating(boolean cheating); + + boolean isCheating(); + + ItemListOrdering getItemListOrdering(); + + boolean isItemListAscending(); + + boolean isUsingDarkTheme(); + + boolean shouldAppendModNames(); + + RecipeScreenType getRecipeScreenType(); + + void setRecipeScreenType(RecipeScreenType recipeScreenType); + + boolean isLoadingDefaultPlugin(); + + boolean isSideSearchField(); + + boolean isLeftHandSidePanel(); + + boolean isCraftableFilterEnabled(); + + String getGamemodeCommand(); + + String getGiveCommand(); + + String getWeatherCommand(); + + int getMaxRecipePerPage(); + + boolean doesShowUtilsButtons(); + + boolean doesDisableRecipeBook(); + + boolean areClickableRecipeArrowsEnabled(); + + ItemCheatingMode getItemCheatingMode(); + + boolean isUsingLightGrayRecipeBorder(); + + boolean doesVillagerScreenHavePermanentScrollBar(); + + boolean doesRegisterRecipesInAnotherThread(); + + RelativePoint getChoosePageDialogPoint(); + + void setChoosePageDialogPoint(RelativePoint choosePageDialogPoint); + + public static class RelativePoint { + + private double relativeX, relativeY; + + public RelativePoint(double relativeX, double relativeY) { + this.relativeX = relativeX; + this.relativeY = relativeY; + } + + public double getRelativeX() { + return relativeX; + } + + public double getRelativeY() { + return relativeY; + } + + public double getX(double width) { + return width * relativeX; + } + + public double getY(double height) { + return height * relativeY; + } + + } + +} diff --git a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java index 53d35a3dd..8b745f846 100644 --- a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java +++ b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java @@ -112,7 +112,7 @@ public interface DisplayHelper { * @return the item list bounds */ default Rectangle getItemListArea(Rectangle rectangle) { - return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField ? 27 + 22 : 27)); + return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (RoughlyEnoughItemsCore.getConfigManager().getConfig().isSideSearchField() ? 27 + 22 : 27)); } /** diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java index b05f5d15e..700a0ab97 100644 --- a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java @@ -18,6 +18,7 @@ import me.shedaniel.rei.gui.PreRecipeViewingScreen; import me.shedaniel.rei.gui.RecipeViewingScreen; import me.shedaniel.rei.gui.VillagerRecipeViewingScreen; import me.shedaniel.rei.gui.config.RecipeScreenType; +import me.zeroeightsix.fiber.exception.FiberException; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; @@ -124,15 +125,15 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { @Override public boolean isCheating() { - return RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating; + return RoughlyEnoughItemsCore.getConfigManager().getConfig().isCheating(); } @Override public void setCheating(boolean cheating) { - RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating = cheating; + RoughlyEnoughItemsCore.getConfigManager().getConfig().setCheating(cheating); try { RoughlyEnoughItemsCore.getConfigManager().saveConfig(); - } catch (IOException e) { + } catch (IOException | FiberException e) { e.printStackTrace(); } } @@ -158,7 +159,7 @@ public class ClientHelperImpl implements ClientHelper, 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.getCount() == 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand.replaceAll(" \\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand; + String og = cheatedStack.getCount() == 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().getGiveCommand().replaceAll(" \\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().getGiveCommand(); String madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_name}", identifier.getPath()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", tagMessage).replaceAll("\\{count}", String.valueOf(cheatedStack.getCount())); if (madeUpCommand.length() > 256) { madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_name}", identifier.getPath()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", "").replaceAll("\\{count}", String.valueOf(cheatedStack.getCount())); @@ -234,9 +235,9 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { @Override public void openRecipeViewingScreen(Map<RecipeCategory<?>, List<RecipeDisplay>> map) { - if (RoughlyEnoughItemsCore.getConfigManager().getConfig().screenType == RecipeScreenType.VILLAGER) + if (RoughlyEnoughItemsCore.getConfigManager().getConfig().getRecipeScreenType() == RecipeScreenType.VILLAGER) MinecraftClient.getInstance().openScreen(new VillagerRecipeViewingScreen(map)); - else if (RoughlyEnoughItemsCore.getConfigManager().getConfig().screenType == RecipeScreenType.UNSET) + else if (RoughlyEnoughItemsCore.getConfigManager().getConfig().getRecipeScreenType() == RecipeScreenType.UNSET) MinecraftClient.getInstance().openScreen(new PreRecipeViewingScreen(map)); else MinecraftClient.getInstance().openScreen(new RecipeViewingScreen(map)); diff --git a/src/main/java/me/shedaniel/rei/client/ConfigManagerImpl.java b/src/main/java/me/shedaniel/rei/client/ConfigManagerImpl.java index 587eae8ce..fe0a23101 100644 --- a/src/main/java/me/shedaniel/rei/client/ConfigManagerImpl.java +++ b/src/main/java/me/shedaniel/rei/client/ConfigManagerImpl.java @@ -5,12 +5,11 @@ 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 me.shedaniel.rei.api.ConfigManager; +import me.shedaniel.rei.api.ConfigObject; +import me.zeroeightsix.fiber.JanksonSettings; +import me.zeroeightsix.fiber.exception.FiberException; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; @@ -18,98 +17,65 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.text.LiteralText; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; -import java.nio.file.StandardCopyOption; import java.util.List; public class ConfigManagerImpl implements ConfigManager { - private static final Gson GSON = new GsonBuilder().create(); - private static final Jankson JANKSON = Jankson.builder().build(); - private final File configFile, veryOldConfigFile, oldConfigFile; + private final File configFile; private ConfigObject config; private boolean craftableOnly; public ConfigManagerImpl() { - this.veryOldConfigFile = new File(FabricLoader.getInstance().getConfigDirectory(), "rei.json"); - this.oldConfigFile = new File(FabricLoader.getInstance().getConfigDirectory(), "roughlyenoughitems/config.json"); this.configFile = new File(FabricLoader.getInstance().getConfigDirectory(), "roughlyenoughitems/config.json5"); this.craftableOnly = false; try { loadConfig(); RoughlyEnoughItemsCore.LOGGER.info("[REI] Config is loaded."); - } catch (IOException e) { + } catch (IOException | FiberException e) { e.printStackTrace(); } } @Override - public void saveConfig() throws IOException { + public void saveConfig() throws IOException, FiberException { configFile.getParentFile().mkdirs(); if (!configFile.exists() && !configFile.createNewFile()) { RoughlyEnoughItemsCore.LOGGER.error("[REI] Failed to save config! Overwriting with default config."); - config = new ConfigObject(); + config = new ConfigObjectImpl(); 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(); + new JanksonSettings().serialize(config.getConfigNode(), Files.newOutputStream(configFile.toPath()), false); } catch (Exception e) { e.printStackTrace(); RoughlyEnoughItemsCore.LOGGER.error("[REI] Failed to save config! Overwriting with default config."); - config = new ConfigObject(); + config = new ConfigObjectImpl(); return; } } @Override - public void loadConfig() throws IOException { + public void loadConfig() throws IOException, FiberException { configFile.getParentFile().mkdirs(); - if (!configFile.exists() && veryOldConfigFile.exists()) { - RoughlyEnoughItemsCore.LOGGER.info("[REI] Detected old config file, trying to move it."); - try { - Files.move(veryOldConfigFile.toPath(), configFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - } catch (Exception e) { - e.printStackTrace(); - RoughlyEnoughItemsCore.LOGGER.error("[REI] Failed to move config file."); - } - } - 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(); + config = new ConfigObjectImpl(); saveConfig(); return; } boolean failed = false; try { - JsonObject configJson = JANKSON.load(configFile); - String regularized = configJson.toJson(false, false, 0); - - config = GSON.fromJson(regularized, ConfigObject.class); + config = new ConfigObjectImpl(); + new JanksonSettings().deserialize(config.getConfigNode(), Files.newInputStream(configFile.toPath())); } 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(); + config = new ConfigObjectImpl(); } saveConfig(); } diff --git a/src/main/java/me/shedaniel/rei/client/ConfigObject.java b/src/main/java/me/shedaniel/rei/client/ConfigObject.java deleted file mode 100644 index 5363e672c..000000000 --- a/src/main/java/me/shedaniel/rei/client/ConfigObject.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Roughly Enough Items by Danielshe. - * Licensed under the MIT License. - */ - -package me.shedaniel.rei.client; - -import blue.endless.jankson.Comment; -import me.shedaniel.rei.gui.config.ItemCheatingMode; -import me.shedaniel.rei.gui.config.ItemListOrdering; -import me.shedaniel.rei.gui.config.RecipeScreenType; - -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 = false; - - @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 = "/minecraft: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 default plugin, don't change this unless you understand what you are doing") - public boolean loadDefaultPlugin = true; - - @Comment("Maximum recipes viewed at one time.") - public int maxRecipePerPage = 3; - - @Comment("Toggle utils buttons") - public boolean showUtilsButtons = false; - - @Comment("Disable Recipe Book") - public boolean disableRecipeBook = false; - - public boolean clickableRecipeArrows = true; - - public ItemCheatingMode itemCheatingMode = ItemCheatingMode.REI_LIKE; - - public boolean lightGrayRecipeBorder = false; - - public boolean villagerScreenPermanentScrollBar = false; - - public boolean darkTheme = false; - - public boolean registerRecipesInAnotherThread = true; - - public RecipeScreenType screenType = RecipeScreenType.UNSET; - - @Comment( - "The location of choose page dialog, will automatically be set to your last location so there is no need to change this.") - public RelativePoint choosePageDialogPoint = new RelativePoint(.5, .5); - - public static class RelativePoint { - - private double relativeX, relativeY; - - public RelativePoint(double relativeX, double relativeY) { - this.relativeX = relativeX; - this.relativeY = relativeY; - } - - public double getRelativeX() { - return relativeX; - } - - public double getRelativeY() { - return relativeY; - } - - public double getX(double width) { - return width * relativeX; - } - - public double getY(double height) { - return height * relativeY; - } - - } - -} diff --git a/src/main/java/me/shedaniel/rei/client/ConfigObjectImpl.java b/src/main/java/me/shedaniel/rei/client/ConfigObjectImpl.java new file mode 100644 index 000000000..8fac22090 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/client/ConfigObjectImpl.java @@ -0,0 +1,307 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.client; + +import me.shedaniel.rei.api.ConfigObject; +import me.shedaniel.rei.gui.config.ItemCheatingMode; +import me.shedaniel.rei.gui.config.ItemListOrdering; +import me.shedaniel.rei.gui.config.ItemListOrderingConfig; +import me.shedaniel.rei.gui.config.RecipeScreenType; +import me.zeroeightsix.fiber.exception.FiberException; +import me.zeroeightsix.fiber.tree.ConfigNode; +import me.zeroeightsix.fiber.tree.ConfigValue; +import me.zeroeightsix.fiber.tree.Node; + +public class ConfigObjectImpl implements ConfigObject { + + public ConfigNode configNode = new ConfigNode(); + + private Node general = configNode.fork("!general"); + private Node appearance = configNode.fork("appearance"); + private Node modules = configNode.fork("modules"); + private Node technical = configNode.fork("technical"); + + private ConfigValue<Boolean> cheating = ConfigValue.builder(Boolean.class) + .withParent(general) + .withDefaultValue(false) + .withComment("Declares whether cheating mode is on.") + .withName("cheating") + .build(); + + private ConfigValue<ItemListOrderingConfig> itemListOrdering = ConfigValue.builder(ItemListOrderingConfig.class) + .withParent(appearance) + .withDefaultValue(ItemListOrderingConfig.REGISTRY_ASCENDING) + .withComment("The ordering of the items on the item panel.") + .withName("itemListOrdering") + .build(); + + private ConfigValue<Boolean> darkTheme = ConfigValue.builder(Boolean.class) + .withParent(appearance) + .withDefaultValue(false) + .withComment("Declares the appearance of REI windows.") + .withName("darkTheme") + .build(); + + private ConfigValue<RecipeScreenType> recipeScreenType = ConfigValue.builder(RecipeScreenType.class) + .withParent(appearance) + .withDefaultValue(RecipeScreenType.UNSET) + .withComment("The ordering of the items on the item panel.") + .withName("recipeScreenType") + .build(); + + private ConfigValue<Boolean> loadDefaultPlugin = ConfigValue.builder(Boolean.class) + .withParent(technical) + .withDefaultValue(true) + .withComment("To disable REI's default plugin.\nDon't change this unless you understand what you are doing") + .withName("loadDefaultPlugin") + .build(); + + private ConfigValue<Boolean> sideSearchField = ConfigValue.builder(Boolean.class) + .withParent(appearance) + .withDefaultValue(false) + .withComment("Declares the position of the search field.") + .withName("sideSearchField") + .build(); + + private ConfigValue<Boolean> mirrorItemPanel = ConfigValue.builder(Boolean.class) + .withParent(appearance) + .withDefaultValue(false) + .withComment("Declares the position of the item list panel.") + .withName("mirrorItemPanel") + .build(); + + private ConfigValue<Boolean> enableCraftableOnlyButton = ConfigValue.builder(Boolean.class) + .withParent(modules) + .withDefaultValue(true) + .withComment("Declares whether the craftable filter button is enabled.") + .withName("enableCraftableOnlyButton") + .build(); + + private ConfigValue<String> gamemodeCommand = ConfigValue.builder(String.class) + .withParent(technical) + .withDefaultValue("/gamemode {gamemode}") + .withComment("Declares the command used to change gamemode.") + .withName("gamemodeCommand") + .build(); + + private ConfigValue<String> giveCommand = ConfigValue.builder(String.class) + .withParent(technical) + .withDefaultValue("/give {player_name} {item_identifier}{nbt} {count}") + .withComment("Declares the command used in servers to cheat items.") + .withName("giveCommand") + .build(); + + private ConfigValue<String> weatherCommand = ConfigValue.builder(String.class) + .withParent(technical) + .withDefaultValue("/weather {weather}") + .withComment("Declares the command used to change weather.") + .withName("weatherCommand") + .build(); + + private ConfigValue<Integer> maxRecipePerPage = ConfigValue.builder(Integer.class) + .withParent(appearance) + .withDefaultValue(3) + .withComment("Declares the maximum amount of recipes displayed in a page if possible.") + .withName("maxRecipePerPage") + .constraints() + .minNumerical(2) + .maxNumerical(99) + .finish() + .build(); + + private ConfigValue<Boolean> showUtilsButtons = ConfigValue.builder(Boolean.class) + .withParent(modules) + .withDefaultValue(false) + .withComment("Declares whether the utils buttons are shown.") + .withName("showUtilsButtons") + .build(); + + private ConfigValue<Boolean> disableRecipeBook = ConfigValue.builder(Boolean.class) + .withParent(modules) + .withDefaultValue(false) + .withComment("Declares whether REI should remove the recipe book.") + .withName("disableRecipeBook") + .build(); + + private ConfigValue<Boolean> clickableRecipeArrows = ConfigValue.builder(Boolean.class) + .withParent(appearance) + .withDefaultValue(true) + .withName("clickableRecipeArrows") + .build(); + + private ConfigValue<ItemCheatingMode> itemCheatingMode = ConfigValue.builder(ItemCheatingMode.class) + .withParent(appearance) + .withDefaultValue(ItemCheatingMode.REI_LIKE) + .withName("itemCheatingMode") + .build(); + + private ConfigValue<Boolean> lightGrayRecipeBorder = ConfigValue.builder(Boolean.class) + .withParent(appearance) + .withDefaultValue(false) + .withComment("Declares the appearance of recipe's border.") + .withName("lightGrayRecipeBorder") + .build(); + + private ConfigValue<Boolean> appendModNames = ConfigValue.builder(Boolean.class) + .withParent(appearance) + .withDefaultValue(false) + .withComment("Declares whether REI should append mod names to item stacks.") + .withName("appendModNames") + .build(); + + private ConfigValue<Boolean> villagerScreenPermanentScrollBar = ConfigValue.builder(Boolean.class) + .withParent(appearance) + .withDefaultValue(false) + .withComment("Declares how the scrollbar in villager screen act.") + .withName("villagerScreenPermanentScrollBar") + .build(); + + private ConfigValue<Boolean> registerRecipesInAnotherThread = ConfigValue.builder(Boolean.class) + .withParent(technical) + .withDefaultValue(true) + .withName("registerRecipesInAnotherThread") + .build(); + + private ConfigValue<RelativePoint> choosePageDialogPoint = ConfigValue.builder(RelativePoint.class) + .withParent(technical) + .withDefaultValue(new RelativePoint(.5, .5)) + .withName("choosePageDialogPoint") + .build(); + + public ConfigObjectImpl() throws FiberException { + + } + + @Override + public ConfigNode getConfigNode() { + return configNode; + } + + @Override + public boolean isCheating() { + return cheating.getValue(); + } + + @Override + public void setCheating(boolean cheating) { + this.cheating.setValue(cheating); + } + + @Override + public ItemListOrdering getItemListOrdering() { + return itemListOrdering.getValue().getOrdering(); + } + + @Override + public boolean isItemListAscending() { + return itemListOrdering.getValue().isAscending(); + } + + @Override + public boolean isUsingDarkTheme() { + return darkTheme.getValue().booleanValue(); + } + + @Override + public boolean shouldAppendModNames() { + return appendModNames.getValue().booleanValue(); + } + + @Override + public RecipeScreenType getRecipeScreenType() { + return recipeScreenType.getValue(); + } + + @Override + public void setRecipeScreenType(Re |
