aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-07-15 22:27:07 +0800
committershedaniel <daniel@shedaniel.me>2020-07-15 22:27:07 +0800
commitcd57003454840efd74ef072072402ea3822ab2ba (patch)
tree481af32e3a330d48eba88e1fa4c4fa5a976f5377 /src/main/java/me/shedaniel/rei/api
parent7d1e39007a1e7de6fd0381fa1e21cf9b6e927f97 (diff)
downloadRoughlyEnoughItems-cd57003454840efd74ef072072402ea3822ab2ba.tar.gz
RoughlyEnoughItems-cd57003454840efd74ef072072402ea3822ab2ba.tar.bz2
RoughlyEnoughItems-cd57003454840efd74ef072072402ea3822ab2ba.zip
Close #322
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api')
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayHelper.java3
-rw-r--r--src/main/java/me/shedaniel/rei/api/EntryRegistry.java14
-rw-r--r--src/main/java/me/shedaniel/rei/api/REIHelper.java5
-rw-r--r--src/main/java/me/shedaniel/rei/api/REIOverlay.java31
4 files changed, 49 insertions, 4 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
index fe5c77950..33752431f 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
@@ -99,6 +99,9 @@ public interface DisplayHelper {
*/
<T> Rectangle getOverlayBounds(DisplayPanelLocation location, T screen);
+ @ApiStatus.Experimental
+ void resetCache();
+
interface DisplayBoundsProvider<T> extends OverlayDecider {
/**
* @param screen the screen
diff --git a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java
index 449dae8d7..da334aac4 100644
--- a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java
+++ b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java
@@ -24,7 +24,6 @@
package me.shedaniel.rei.api;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.utils.CollectionUtils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.Item;
@@ -36,6 +35,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -68,6 +68,9 @@ public interface EntryRegistry {
@NotNull
List<EntryStack> getPreFilteredList();
+ @ApiStatus.Experimental
+ void refilter();
+
@NotNull
List<ItemStack> appendStacksForItem(@NotNull Item item);
@@ -145,8 +148,11 @@ public interface EntryRegistry {
* @param stack the stack to check
* @return whether the stack has been registered
*/
- default boolean alreadyContain(EntryStack stack) {
- return CollectionUtils.anyMatchEqualsAll(getStacksList(), stack);
- }
+ boolean alreadyContain(EntryStack stack);
+
+ @ApiStatus.Experimental
+ void removeEntry(EntryStack stack);
+ @ApiStatus.Experimental
+ void removeEntryIf(Predicate<EntryStack> stackPredicate);
}
diff --git a/src/main/java/me/shedaniel/rei/api/REIHelper.java b/src/main/java/me/shedaniel/rei/api/REIHelper.java
index 2a0dffc64..0c0275b70 100644
--- a/src/main/java/me/shedaniel/rei/api/REIHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/REIHelper.java
@@ -30,9 +30,11 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.ingame.ContainerScreen;
import net.minecraft.item.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import java.util.List;
+import java.util.Optional;
@Environment(EnvType.CLIENT)
public interface REIHelper {
@@ -44,6 +46,9 @@ public interface REIHelper {
return ScreenHelper.getInstance();
}
+ @ApiStatus.Experimental
+ Optional<REIOverlay> getOverlay();
+
ContainerScreen<?> getPreviousContainerScreen();
@Deprecated
diff --git a/src/main/java/me/shedaniel/rei/api/REIOverlay.java b/src/main/java/me/shedaniel/rei/api/REIOverlay.java
new file mode 100644
index 000000000..24eaf15bd
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/api/REIOverlay.java
@@ -0,0 +1,31 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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;
+
+import org.jetbrains.annotations.ApiStatus;
+
+@ApiStatus.Experimental
+public interface REIOverlay {
+ void queueReloadOverlay();
+}