aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-08-08 16:53:46 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-08-08 16:53:46 +0800
commit10fa4cea1da644efe5b3045d3159a3eebdb8c0a8 (patch)
tree0e8f504b66391d6762d526c0e7cdd94c3cb6022f /src/main/java/me/shedaniel/rei/api
parent6464acb0a7fe98ab30f9419e6aa95bdd1e92bc74 (diff)
downloadRoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.tar.gz
RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.tar.bz2
RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.zip
Using fiber as a config lib
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api')
-rw-r--r--src/main/java/me/shedaniel/rei/api/ConfigManager.java6
-rw-r--r--src/main/java/me/shedaniel/rei/api/ConfigObject.java89
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayHelper.java2
3 files changed, 93 insertions, 4 deletions
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));
}
/**