aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api')
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayVisibility.java2
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java1
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeCategory.java10
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeDisplay.java3
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeHelper.java42
5 files changed, 51 insertions, 7 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java
index 8f1149e26..0bfdb024c 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java
@@ -7,7 +7,7 @@ package me.shedaniel.rei.api;
public enum DisplayVisibility {
ALWAYS_VISIBLE,
- CONFIG_OPTIONAL,
+ @Deprecated CONFIG_OPTIONAL,
NEVER_VISIBLE,
PASS
}
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
index 8f6156891..429306ff2 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
@@ -20,7 +20,6 @@ public interface DisplayVisibilityHandler {
* Handles the visibility of the display.
* {@link DisplayVisibility#PASS} to pass the handling to another handler
* {@link DisplayVisibility#ALWAYS_VISIBLE} to always display it
- * {@link DisplayVisibility#CONFIG_OPTIONAL} to allow user to configure the visibility
* {@link DisplayVisibility#NEVER_VISIBLE} to never display it
*
* @param category the category of the display
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java
index 27a68eafd..9db9a349f 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java
@@ -5,6 +5,7 @@
package me.shedaniel.rei.api;
+import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.gui.RecipeViewingScreen;
import me.shedaniel.rei.gui.renderables.RecipeRenderer;
import me.shedaniel.rei.gui.widget.CategoryBaseWidget;
@@ -87,8 +88,13 @@ public interface RecipeCategory<T extends RecipeDisplay> {
*/
default void drawCategoryBackground(Rectangle bounds, int mouseX, int mouseY, float delta) {
new CategoryBaseWidget(bounds).render();
- DrawableHelper.fill(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, RecipeViewingScreen.SUB_COLOR.getRGB());
- DrawableHelper.fill(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, RecipeViewingScreen.SUB_COLOR.getRGB());
+ if (RoughlyEnoughItemsCore.getConfigManager().getConfig().darkTheme) {
+ DrawableHelper.fill(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, 0xFF404040);
+ DrawableHelper.fill(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, 0xFF404040);
+ } else {
+ DrawableHelper.fill(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, 0xFF9E9E9E);
+ DrawableHelper.fill(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, 0xFF9E9E9E);
+ }
}
/**
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
index 9e17159bc..cd8ab6efb 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
@@ -18,7 +18,7 @@ public interface RecipeDisplay<T extends Recipe> {
/**
* @return the optional recipe
*/
- Optional<T> getRecipe();
+ Optional<? extends Recipe> getRecipe();
/**
* @return a list of items
@@ -35,6 +35,7 @@ public interface RecipeDisplay<T extends Recipe> {
*
* @return the list of required items
*/
+ @Deprecated
default List<List<ItemStack>> getRequiredItems() {
return Lists.newArrayList();
}
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
index a57b7146f..cfbda23f0 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
@@ -14,6 +14,7 @@ import net.minecraft.util.Identifier;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.function.Function;
public interface RecipeHelper {
@@ -52,6 +53,24 @@ public interface RecipeHelper {
void registerCategory(RecipeCategory category);
/**
+ * Registers the working stations of a category
+ *
+ * @param category the category
+ * @param workingStations the working stations
+ */
+ void registerWorkingStations(Identifier category, List<ItemStack>... workingStations);
+
+ /**
+ * Registers the working stations of a category
+ *
+ * @param category the category
+ * @param workingStations the working stations
+ */
+ void registerWorkingStations(Identifier category, ItemStack... workingStations);
+
+ List<List<ItemStack>> getWorkingStations(Identifier category);
+
+ /**
* Registers a recipe display
*
* @param categoryIdentifier the category to display in
@@ -106,10 +125,10 @@ public interface RecipeHelper {
void registerSpeedCraftButtonArea(Identifier category, ButtonAreaSupplier rectangle);
/**
- * Registers a default speed crafting button area, which is bottom right
- *
* @param category the category of the button area
+ * @deprecated Not required anymore
*/
+ @Deprecated
void registerDefaultSpeedCraftButtonArea(Identifier category);
/**
@@ -162,10 +181,20 @@ public interface RecipeHelper {
* @param display the display to be checked
* @param respectConfig whether it should respect the user's config
* @return whether the display should be visible
+ * @deprecated {@link RecipeHelper#isDisplayVisible(RecipeDisplay)} )}
*/
+ @Deprecated
boolean isDisplayVisible(RecipeDisplay display, boolean respectConfig);
/**
+ * Checks if the display is visible by asking recipe visibility handlers
+ *
+ * @param display the display to be checked
+ * @return whether the display should be visible
+ */
+ boolean isDisplayVisible(RecipeDisplay display);
+
+ /**
* Gets the cached category setting by the category identifier
*
* @param category the identifier of the category
@@ -173,6 +202,15 @@ public interface RecipeHelper {
*/
Optional<DisplaySettings> getCachedCategorySettings(Identifier category);
+ /**
+ * Registers a live recipe generator.
+ *
+ * @param liveRecipeGenerator the generator to register
+ * @apiNote Still work in progress
+ */
void registerLiveRecipeGenerator(LiveRecipeGenerator liveRecipeGenerator);
+ <T extends Recipe<?>> void registerRecipes(Identifier category, Class<T> recipeClass, Function<T, RecipeDisplay> mappingFunction);
+
+ <T extends Recipe<?>> void registerRecipes(Identifier category, Function<Recipe, Boolean> recipeFilter, Function<T, RecipeDisplay> mappingFunction);
}