aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/main/java/me/shedaniel
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src/main/java/me/shedaniel')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/PluginDetector.java23
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java36
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java1
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/FilteringScreen.java18
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/RecipeScreenTypeEntry.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java136
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java159
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/CurrentDraggingStack.java25
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java9
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/RecipeDisplayExporter.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/RecipeScreen.java7
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java181
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/SearchFilterSyntaxHighlightingScreen.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java81
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/modules/Menu.java8
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/modules/entries/EntryStackSubsetsMenuEntry.java18
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/modules/entries/GameModeMenuEntry.java3
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/modules/entries/SubSubsetsMenuEntry.java16
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/modules/entries/WeatherMenuEntry.java3
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java33
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/plugin/entry/ItemEntryDefinition.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java13
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java15
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java12
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/TabWidget.java7
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/InternalWidgets.java20
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/PluginManagerImpl.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java (renamed from runtime/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java)150
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/SearchArgument.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/filtering/FilteringContextImpl.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/filtering/FilteringResult.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/filtering/rules/ManualFilteringRule.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/filtering/rules/SearchFilteringRule.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/registry/CategoryRegistryImpl.java19
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/search/MatchStatus.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/widgets/FillRectangleDrawableConsumer.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/widgets/PanelWidget.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/widgets/TextFieldWidget.java7
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java4
47 files changed, 566 insertions, 510 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/PluginDetector.java b/runtime/src/main/java/me/shedaniel/rei/PluginDetector.java
index 5e6de2399..528e279a6 100644
--- a/runtime/src/main/java/me/shedaniel/rei/PluginDetector.java
+++ b/runtime/src/main/java/me/shedaniel/rei/PluginDetector.java
@@ -1,3 +1,26 @@
+/*
+ * 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;
import me.shedaniel.architectury.annotations.ExpectPlatform;
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index c668dc282..15bee847e 100644
--- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -74,7 +74,6 @@ import net.minecraft.client.gui.screens.recipebook.GhostRecipe;
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener;
import net.minecraft.client.resources.language.I18n;
-import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.network.chat.TextComponent;
@@ -392,7 +391,6 @@ public class RoughlyEnoughItemsCore {
return hasPermissionToUsePackets() || Minecraft.getInstance().gameMode.hasInfiniteItems();
}
- @SuppressWarnings("deprecation")
public void onInitializeClient() {
IssuesDetector.detect();
registerClothEvents();
@@ -456,8 +454,9 @@ public class RoughlyEnoughItemsCore {
if (!decider.isHandingScreen(screen))
continue;
InteractionResult result = decider.shouldScreenBeOverlaid(screen);
- if (result != InteractionResult.PASS)
- return result == InteractionResult.FAIL || REIHelper.getInstance().getPreviousContainerScreen() == null;
+ if (result != InteractionResult.PASS) {
+ return result == InteractionResult.FAIL || REIHelper.getInstance().getPreviousScreen() == null;
+ }
}
} catch (ConcurrentModificationException ignored) {
}
@@ -477,12 +476,11 @@ public class RoughlyEnoughItemsCore {
return InteractionResult.PASS;
});*/
GuiEvent.INIT_POST.register((screen, widgets, children) -> {
+ REIHelperImpl.getInstance().setPreviousScreen(screen);
if (shouldReturn(screen))
return;
if (screen instanceof InventoryScreen && client.gameMode.hasInfiniteItems())
return;
- if (screen instanceof AbstractContainerScreen)
- ScreenHelper.setPreviousContainerScreen((AbstractContainerScreen<?>) screen);
boolean alreadyAdded = false;
for (GuiEventListener element : Lists.newArrayList(children))
if (ContainerScreenOverlay.class.isAssignableFrom(element.getClass()))
@@ -491,14 +489,14 @@ public class RoughlyEnoughItemsCore {
else
alreadyAdded = true;
if (!alreadyAdded)
- children.add(ScreenHelper.getLastOverlay(true, false));
+ children.add(REIHelper.getInstance().getOverlay(true).get());
});
ClientScreenInputEvent.MOUSE_CLICKED_PRE.register((minecraftClient, screen, mouseX, mouseY, button) -> {
isLeftModePressed = true;
- if (ScreenHelper.getOptionalOverlay().isPresent())
+ if (REIHelper.getInstance().getOverlay().isPresent())
if (screen instanceof CreativeModeInventoryScreen)
- if (ScreenHelper.isOverlayVisible() && ScreenHelper.getLastOverlay().mouseClicked(mouseX, mouseY, button)) {
- screen.setFocused(ScreenHelper.getLastOverlay());
+ if (REIHelper.getInstance().isOverlayVisible() && REIHelper.getInstance().getOverlay().get().mouseClicked(mouseX, mouseY, button)) {
+ screen.setFocused(REIHelper.getInstance().getOverlay().get());
if (button == 0)
screen.setDragging(true);
return InteractionResult.SUCCESS;
@@ -509,8 +507,8 @@ public class RoughlyEnoughItemsCore {
isLeftModePressed = false;
if (shouldReturn(screen))
return InteractionResult.PASS;
- if (ScreenHelper.getOptionalOverlay().isPresent())
- if (ScreenHelper.isOverlayVisible() && ScreenHelper.getLastOverlay().mouseReleased(mouseX, mouseY, button)) {
+ if (REIHelper.getInstance().getOverlay().isPresent())
+ if (REIHelper.getInstance().isOverlayVisible() && REIHelper.getInstance().getOverlay().get().mouseReleased(mouseX, mouseY, button)) {
return InteractionResult.SUCCESS;
}
return InteractionResult.PASS;
@@ -518,29 +516,29 @@ public class RoughlyEnoughItemsCore {
ClientScreenInputEvent.MOUSE_SCROLLED_PRE.register((minecraftClient, screen, mouseX, mouseY, amount) -> {
if (shouldReturn(screen))
return InteractionResult.PASS;
- if (ScreenHelper.isOverlayVisible() && ScreenHelper.getLastOverlay().mouseScrolled(mouseX, mouseY, amount))
+ if (REIHelper.getInstance().isOverlayVisible() && REIHelper.getInstance().getOverlay().get().mouseScrolled(mouseX, mouseY, amount))
return InteractionResult.SUCCESS;
return InteractionResult.PASS;
});
ClientScreenInputEvent.CHAR_TYPED_PRE.register((minecraftClient, screen, character, keyCode) -> {
if (shouldReturn(screen))
return InteractionResult.PASS;
- if (ScreenHelper.getLastOverlay().charTyped(character, keyCode))
+ if (REIHelper.getInstance().getOverlay().get().charTyped(character, keyCode))
return InteractionResult.SUCCESS;
return InteractionResult.PASS;
});
GuiEvent.RENDER_POST.register((screen, matrices, mouseX, mouseY, delta) -> {
if (shouldReturn(screen))
return;
- ScreenHelper.getLastOverlay().render(matrices, mouseX, mouseY, delta);
- if (!ScreenHelper.isOverlayVisible())
+ REIHelper.getInstance().getOverlay().get().render(matrices, mouseX, mouseY, delta);
+ if (!REIHelper.getInstance().isOverlayVisible())
return;
- ScreenHelper.getLastOverlay().lateRender(matrices, mouseX, mouseY, delta);
+ ((ContainerScreenOverlay) REIHelper.getInstance().getOverlay().get()).lateRender(matrices, mouseX, mouseY, delta);
});
ClientScreenInputEvent.MOUSE_DRAGGED_PRE.register((minecraftClient, screen, mouseX1, mouseY1, button, mouseX2, mouseY2) -> {
if (shouldReturn(screen))
return InteractionResult.PASS;
- if (screen instanceof AbstractContainerScreen && ScreenHelper.getLastOverlay().mouseDragged(mouseX1, mouseY1, button, mouseX2, mouseY2))
+ if (screen instanceof AbstractContainerScreen && REIHelper.getInstance().getOverlay().get().mouseDragged(mouseX1, mouseY1, button, mouseX2, mouseY2))
return InteractionResult.SUCCESS;
return InteractionResult.PASS;
});
@@ -554,7 +552,7 @@ public class RoughlyEnoughItemsCore {
}
if (screen.getFocused() != null && screen.getFocused() instanceof EditBox || (screen.getFocused() instanceof RecipeBookComponent && ((RecipeBookComponent) screen.getFocused()).searchBox != null && ((RecipeBookComponent) screen.getFocused()).searchBox.isFocused()))
return InteractionResult.PASS;
- if (ScreenHelper.getLastOverlay().keyPressed(i, i1, i2))
+ if (REIHelper.getInstance().getOverlay().get().keyPressed(i, i1, i2))
return InteractionResult.SUCCESS;
return InteractionResult.PASS;
});
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
index 7308fbb38..dfe52a3a2 100644
--- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
+++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
@@ -49,7 +49,7 @@ public class RoughlyEnoughItemsInitializer {
initializeEntryPoint("me.shedaniel.rei.RoughlyEnoughItemsCore");
initializeEntryPoint("me.shedaniel.rei.REIModMenuEntryPoint");
initializeEntryPoint("me.shedaniel.rei.impl.ClientHelperImpl");
- initializeEntryPoint("me.shedaniel.rei.impl.ScreenHelper");
+ initializeEntryPoint("me.shedaniel.rei.impl.REIHelperImpl");
}
initializeEntryPoint("me.shedaniel.rei.impl.ErrorDisplayer");
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java
index 4f8c42bec..c827b50d9 100644
--- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java
+++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java
@@ -25,7 +25,6 @@ package me.shedaniel.rei;
import me.shedaniel.architectury.platform.Platform;
import me.shedaniel.architectury.utils.Env;
-import net.fabricmc.api.EnvType;
import net.minecraft.util.Tuple;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/FilteringScreen.java b/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/FilteringScreen.java
index f5d5464a2..cdd1b5add 100644
--- a/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/FilteringScreen.java
+++ b/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/FilteringScreen.java
@@ -26,7 +26,10 @@ package me.shedaniel.rei.api.gui.config.entry;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.mojang.blaze3d.systems.RenderSystem;
-import com.mojang.blaze3d.vertex.*;
+import com.mojang.blaze3d.vertex.BufferBuilder;
+import com.mojang.blaze3d.vertex.DefaultVertexFormat;
+import com.mojang.blaze3d.vertex.PoseStack;
+import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.math.Matrix4f;
import me.shedaniel.clothconfig2.ClothConfigInitializer;
import me.shedaniel.clothconfig2.api.ScissorsHandler;
@@ -36,13 +39,13 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.math.impl.PointHelper;
import me.shedaniel.rei.api.ConfigObject;
-import me.shedaniel.rei.api.registry.entry.EntryRegistry;
-import me.shedaniel.rei.api.ingredient.EntryStack;
import me.shedaniel.rei.api.REIHelper;
import me.shedaniel.rei.api.gui.widgets.Tooltip;
+import me.shedaniel.rei.api.ingredient.EntryStack;
+import me.shedaniel.rei.api.registry.entry.EntryRegistry;
+import me.shedaniel.rei.gui.ContainerScreenOverlay;
import me.shedaniel.rei.gui.OverlaySearchField;
import me.shedaniel.rei.gui.widget.EntryWidget;
-import me.shedaniel.rei.impl.ScreenHelper;
import me.shedaniel.rei.impl.SearchArgument;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button;
@@ -262,7 +265,7 @@ public class FilteringScreen extends Screen {
this.backButton.render(matrices, mouseX, mouseY, delta);
if (tooltip != null) {
- ScreenHelper.getLastOverlay().renderTooltip(matrices, tooltip);
+ ((ContainerScreenOverlay) REIHelper.getInstance().getOverlay().get()).renderTooltip(matrices, tooltip);
}
this.font.drawShadow(matrices, this.title.getVisualOrderText(), this.width / 2.0F - this.font.width(this.title) / 2.0F, 12.0F, -1);
@@ -378,10 +381,7 @@ public class FilteringScreen extends Screen {
return true;
}
}
- if (backButton.mouseClicked(double_1, double_2, int_1)) {
- return true;
- }
- return false;
+ return backButton.mouseClicked(double_1, double_2, int_1);
}
@Override
diff --git a/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/RecipeScreenTypeEntry.java b/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/RecipeScreenTypeEntry.java
index ed3aff6b7..3f32747e9 100644
--- a/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/RecipeScreenTypeEntry.java
+++ b/runtime/src/main/java/me/shedaniel/rei/api/gui/config/entry/RecipeScreenTypeEntry.java
@@ -27,8 +27,8 @@ import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.clothconfig2.gui.entries.TooltipListEntry;
-import me.shedaniel.rei.gui.PreRecipeViewingScreen;
import me.shedaniel.rei.api.gui.config.RecipeScreenType;
+import me.shedaniel.rei.gui.PreRecipeViewingScreen;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.chat.NarratorChatListener;
import net.minecraft.client.gui.components.AbstractButton;
diff --git a/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
new file mode 100644
index 000000000..fd8007d19
--- /dev/null
+++ b/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
@@ -0,0 +1,136 @@
+/*
+ * 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.gui;
+
+import com.google.common.collect.Lists;
+import me.shedaniel.math.Rectangle;
+import me.shedaniel.rei.api.gui.widgets.Widget;
+import me.shedaniel.rei.api.ingredient.EntryStack;
+import me.shedaniel.rei.api.registry.display.Display;
+import me.shedaniel.rei.api.registry.display.DisplayCategory;
+import me.shedaniel.rei.api.util.CollectionUtils;
+import me.shedaniel.rei.gui.widget.EntryWidget;
+import me.shedaniel.rei.impl.ClientHelperImpl;
+import net.minecraft.client.gui.chat.NarratorChatListener;
+import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.resources.ResourceLocation;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractRecipeViewingScreen extends Screen implements RecipeScreen {
+ protected final Map<DisplayCategory<?>, List<Display>> categoryMap;
+ protected final List<DisplayCategory<?>> categories;
+ protected EntryStack<?> ingredientStackToNotice = EntryStack.empty();
+ protected EntryStack<?> resultStackToNotice = EntryStack.empty();
+ protected int selectedCategoryIndex = 0;
+ protected int tabsPerPage;
+ protected Rectangle bounds;
+
+ protected AbstractRecipeViewingScreen(Map<DisplayCategory<?>, List<Display>> categoryMap, @Nullable ResourceLocation category, int tabsPerPage) {
+ super(NarratorChatListener.NO_TITLE);
+ this.categoryMap = categoryMap;
+ this.categories = Lists.newArrayList(categoryMap.keySet());
+ this.tabsPerPage = tabsPerPage;
+ if (category != null) {
+ for (int i = 0; i < categories.size(); i++) {
+ if (categories.get(i).getIdentifier().equals(category)) {
+ this.selectedCategoryIndex = i;
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ public Rectangle getBounds() {
+ return bounds;
+ }
+
+ @Override
+ public void addIngredientStackToNotice(EntryStack<?> stack) {
+ this.ingredientStackToNotice = stack;
+ }
+
+ @Override
+ public void addResultStackToNotice(EntryStack<?> stack) {
+ this.resultStackToNotice = stack;
+ }
+
+ @Override
+ public boolean isPauseScreen() {
+ return false;
+ }
+
+ @Override
+ public ResourceLocation getCurrentCategory() {
+ return getSelectedCategory().getIdentifier();
+ }
+
+ public DisplayCategory<Display> getSelectedCategory() {
+ return (DisplayCategory<Display>) categories.get(selectedCategoryIndex);
+ }
+
+ protected void previousCategory() {
+ int currentCategoryIndex = selectedCategoryIndex;
+ currentCategoryIndex--;
+ if (currentCategoryIndex < 0)
+ currentCategoryIndex = categories.size() - 1;
+ ClientHelperImpl.getInstance().openRecipeViewingScreen(categoryMap, categories.get(currentCategoryIndex).getIdentifier(), ingredientStackToNotice, resultStackToNotice);
+ }
+
+ protected void nextCategory() {
+ int currentCategoryIndex = selectedCategoryIndex;
+ currentCategoryIndex++;
+ if (currentCategoryIndex >= categories.size())
+ currentCategoryIndex = 0;
+ ClientHelperImpl.getInstance().openRecipeViewingScreen(categoryMap, categories.get(currentCategoryIndex).getIdentifier(), ingredientStackToNotice, resultStackToNotice);
+ }
+
+ protected void transformIngredientNotice(List<Widget> setupDisplay, EntryStack<?> noticeStack) {
+ transformNotice(1, setupDisplay, noticeStack);
+ }
+
+ protected void transformResultNotice(List<Widget> setupDisplay, EntryStack<?> noticeStack) {
+ transformNotice(2, setupDisplay, noticeStack);
+ }
+
+ private static void transformNotice(int marker, List<Widget> setupDisplay, EntryStack<?> noticeStack) {
+ if (noticeStack.isEmpty())
+ return;
+ for (Widget widget : setupDisplay) {
+ if (widget instanceof EntryWidget) {
+ EntryWidget entry = (EntryWidget) widget;
+ if (entry.getNoticeMark() == marker && entry.getEntries().size() > 1) {
+ EntryStack<?> stack = CollectionUtils.findFirstOrNullEqualsEntryIgnoreAmount(entry.getEntries(), noticeStack);
+ if (stack != null) {
+ entry.clearStacks();
+ entry.entry(stack);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
index e44a56f18..2daf4db4f 100644
--- a/runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
+++ b/runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
@@ -25,6 +25,7 @@ package me.shedaniel.rei.gui;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
@@ -34,28 +35,37 @@ import me.shedaniel.math.Rectangle;
import me.shedaniel.math.impl.PointHelper;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.api.*;
+import me.shedaniel.rei.api.favorites.FavoriteEntry;
+import me.shedaniel.rei.api.gui.config.SearchFieldLocation;
import me.shedaniel.rei.api.gui.drag.DraggableStack;
import me.shedaniel.rei.api.gui.drag.DraggableStackProvider;
import me.shedaniel.rei.api.gui.drag.DraggableStackVisitor;
import me.shedaniel.rei.api.gui.drag.DraggingContext;
-import me.shedaniel.rei.api.gui.widgets.*;
+import me.shedaniel.rei.api.gui.widgets.Button;
+import me.shedaniel.rei.api.gui.widgets.Tooltip;
+import me.shedaniel.rei.api.gui.widgets.Widget;
+import me.shedaniel.rei.api.gui.widgets.Widgets;
import me.shedaniel.rei.api.ingredient.EntryStack;
import me.shedaniel.rei.