aboutsummaryrefslogtreecommitdiff
path: root/api/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/main/java')
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java5
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/screen/DisplayScreen.java10
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/TextField.java4
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java39
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java (renamed from api/src/main/java/me/shedaniel/rei/api/client/REIOverlay.java)10
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/view/ViewSearchBuilder.java17
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/view/Views.java33
7 files changed, 62 insertions, 56 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java b/api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java
index b8066133b..94d57de3b 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java
@@ -27,6 +27,7 @@ import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.config.SearchFieldLocation;
import me.shedaniel.rei.api.client.gui.widgets.TextField;
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
+import me.shedaniel.rei.api.client.overlay.ScreenOverlay;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.registry.Reloadable;
@@ -52,11 +53,11 @@ public interface REIHelper extends Reloadable<REIClientPlugin> {
void toggleOverlayVisible();
- default Optional<REIOverlay> getOverlay() {
+ default Optional<ScreenOverlay> getOverlay() {
return getOverlay(false);
}
- Optional<REIOverlay> getOverlay(boolean reset);
+ Optional<ScreenOverlay> getOverlay(boolean reset);
@Nullable
AbstractContainerScreen<?> getPreviousContainerScreen();
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/screen/DisplayScreen.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/screen/DisplayScreen.java
index 68c4a0205..9174d9112 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/gui/screen/DisplayScreen.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/screen/DisplayScreen.java
@@ -29,16 +29,18 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.entry.EntryStack;
+import java.util.List;
+
public interface DisplayScreen {
Rectangle getBounds();
- void setIngredientStackToNotice(EntryStack<?> stack);
+ void addIngredientToNotice(EntryStack<?> stack);
- void setResultStackToNotice(EntryStack<?> stack);
+ void addResultToNotice(EntryStack<?> stack);
- EntryStack<?> getIngredientStackToNotice();
+ List<EntryStack<?>> getIngredientsToNotice();
- EntryStack<?> getResultStackToNotice();
+ List<EntryStack<?>> getResultsToNotice();
default CategoryIdentifier<?> getCurrentCategoryId() {
return getCurrentCategory().getCategoryIdentifier();
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/TextField.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/TextField.java
index 0f1c55142..51f039421 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/TextField.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/TextField.java
@@ -52,9 +52,9 @@ public interface TextField {
void setEditableColor(int editableColor);
- void setNotEditableColor(int int_1);
+ void setNotEditableColor(int notEditableColor);
boolean isFocused();
- void setFocused(boolean boolean_1);
+ void setFocused(boolean focused);
}
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java b/api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java
new file mode 100644
index 000000000..b3752af2e
--- /dev/null
+++ b/api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java
@@ -0,0 +1,39 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.api.client.overlay;
+
+import me.shedaniel.rei.api.common.entry.EntryStack;
+
+import java.util.stream.Stream;
+
+public interface OverlayListWidget {
+ /**
+ * Returns the mouse hovered stack within the overlay list widget.
+ *
+ * @return the mouse hovered stack, returns {@link EntryStack#empty()} if none is hovered
+ */
+ EntryStack<?> getFocusedStacK();
+
+ Stream<EntryStack<?>> getEntries();
+}
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/REIOverlay.java b/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java
index 9d6778237..01aa56e38 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/REIOverlay.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java
@@ -21,13 +21,15 @@
* SOFTWARE.
*/
-package me.shedaniel.rei.api.client;
+package me.shedaniel.rei.api.client.overlay;
import me.shedaniel.rei.api.client.gui.drag.DraggingContext;
import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds;
import org.jetbrains.annotations.ApiStatus;
-public abstract class REIOverlay extends WidgetWithBounds {
+import java.util.Optional;
+
+public abstract class ScreenOverlay extends WidgetWithBounds {
@ApiStatus.Internal
public abstract void closeOverlayMenu();
@@ -36,4 +38,8 @@ public abstract class REIOverlay extends WidgetWithBounds {
public abstract DraggingContext<?> getDraggingContext();
public abstract boolean isNotInExclusionZones(double mouseX, double mouseY);
+
+ public abstract OverlayListWidget getEntryList();
+
+ public abstract Optional<OverlayListWidget> getFavoritesList();
}
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/view/ViewSearchBuilder.java b/api/src/main/java/me/shedaniel/rei/api/client/view/ViewSearchBuilder.java
index 2dd4b0cff..589970db9 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/view/ViewSearchBuilder.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/view/ViewSearchBuilder.java
@@ -23,6 +23,7 @@
package me.shedaniel.rei.api.client.view;
+import me.shedaniel.rei.api.client.ClientHelper;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
@@ -65,19 +66,9 @@ public interface ViewSearchBuilder {
@Nullable
CategoryIdentifier<?> getPreferredOpenedCategory();
- ViewSearchBuilder fillPreferredOpenedCategory();
-
- <T> ViewSearchBuilder setInputNotice(@Nullable EntryStack<T> stack);
-
- @Nullable
- EntryStack<?> getInputNotice();
-
- <T> ViewSearchBuilder setOutputNotice(@Nullable EntryStack<T> stack);
-
- @Nullable
- EntryStack<?> getOutputNotice();
-
Map<DisplayCategory<?>, List<Display>> buildMap();
-
+ default boolean open() {
+ return ClientHelper.getInstance().openView(this);
+ }
} \ No newline at end of file
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java b/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java
index 731c94f15..6ddd1b416 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java
@@ -24,26 +24,17 @@
package me.shedaniel.rei.api.client.view;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
-import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
-import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.registry.Reloadable;
-import org.jetbrains.annotations.ApiStatus;
import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
public interface Views extends Reloadable<REIClientPlugin> {
static Views getInstance() {
return PluginManager.getClientInstance().get(Views.class);
}
- @ApiStatus.Internal
- Map<DisplayCategory<?>, List<Display>> buildMapFor(ViewSearchBuilder builder);
-
/**
* Returns all craftable items from materials.
*
@@ -51,28 +42,4 @@ public interface Views extends Reloadable<REIClientPlugin> {
* @return the list of craftable entries
*/
Collection<EntryStack<?>> findCraftableEntriesByMaterials(Iterable<? extends EntryStack<?>> inventoryItems);
-
- /**
- * Returns a map of recipes for an entry
- *
- * @param stack the stack to be crafted
- * @return the map of recipes
- */
- default <T> Map<DisplayCategory<?>, List<Display>> getRecipesFor(EntryStack<T> stack) {
- return ViewSearchBuilder.builder().addRecipesFor(stack).setInputNotice(stack).buildMap();
- }
-
- /**
- * Returns a map of usages for an entry
- *
- * @param stack the stack to be used
- * @return the map of recipes
- */
- default <T> Map<DisplayCategory<?>, List<Display>> getUsagesFor(EntryStack<T> stack) {
- return ViewSearchBuilder.builder().addUsagesFor(stack).setInputNotice(stack).buildMap();
- }
-
- default Map<DisplayCategory<?>, List<Display>> getAllRecipes() {
- return ViewSearchBuilder.builder().addAllCategories().buildMap();
- }
}