aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-03-21 21:15:10 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-03-21 21:15:10 +0800
commit0d7431e4981226aba9d8011d76eabfb03d134499 (patch)
treeb21f733f3c98377907358109c1011193bfd5029a /src/main/java/me/shedaniel/rei/api
parentc2d28cbf7028ffed2f56169adbce3f03cc0c5b49 (diff)
downloadRoughlyEnoughItems-0d7431e4981226aba9d8011d76eabfb03d134499.tar.gz
RoughlyEnoughItems-0d7431e4981226aba9d8011d76eabfb03d134499.tar.bz2
RoughlyEnoughItems-0d7431e4981226aba9d8011d76eabfb03d134499.zip
Large v2.5 Update
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api')
-rw-r--r--src/main/java/me/shedaniel/rei/api/ConfigManager.java3
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplaySettings.java8
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeCategory.java11
3 files changed, 21 insertions, 1 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java
index 2e951f103..781c34143 100644
--- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java
+++ b/src/main/java/me/shedaniel/rei/api/ConfigManager.java
@@ -1,6 +1,7 @@
package me.shedaniel.rei.api;
import me.shedaniel.rei.client.ConfigObject;
+import net.minecraft.client.gui.Screen;
import java.io.IOException;
@@ -16,4 +17,6 @@ public interface ConfigManager {
void toggleCraftableOnly();
+ void openConfigScreen(Screen parent);
+
}
diff --git a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java
index 334d6cc6f..6eb5ef5a6 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java
@@ -12,4 +12,12 @@ public interface DisplaySettings<T extends RecipeDisplay> {
return -1;
}
+ default VisableType canDisplay(T display) {
+ return VisableType.ALWAYS;
+ }
+
+ public static enum VisableType {
+ ALWAYS, PASS, NEVER;
+ }
+
}
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java
index 9fdd35801..a20c505e2 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java
@@ -1,5 +1,6 @@
package me.shedaniel.rei.api;
+import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.gui.RecipeViewingScreen;
import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
import me.shedaniel.rei.gui.widget.Widget;
@@ -26,7 +27,7 @@ public interface RecipeCategory<T extends RecipeDisplay> {
}
default void drawCategoryBackground(Rectangle bounds, int mouseX, int mouseY, float delta) {
- new RecipeBaseWidget(bounds).draw(mouseX, mouseY, delta);
+ new RecipeBaseWidget(bounds).render();
DrawableHelper.drawRect(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, RecipeViewingScreen.SUB_COLOR.getRGB());
DrawableHelper.drawRect(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, RecipeViewingScreen.SUB_COLOR.getRGB());
}
@@ -50,6 +51,14 @@ public interface RecipeCategory<T extends RecipeDisplay> {
};
}
+ default boolean canDisplay(RecipeDisplay display) {
+ if (getDisplaySettings().canDisplay(display) == DisplaySettings.VisableType.ALWAYS)
+ return true;
+ if (getDisplaySettings().canDisplay(display) == DisplaySettings.VisableType.NEVER)
+ return false;
+ return RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes;
+ }
+
default int getDisplayHeight() {
return getDisplaySettings().getDisplayHeight(this);
}