aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-03-17 00:30:40 +0800
committershedaniel <daniel@shedaniel.me>2021-03-17 00:30:40 +0800
commit8af94d0768f57b59b56f019c9d40d95b77382187 (patch)
tree7b8c95251db7d54bec4e0ce10331c414c83ebea9 /runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
parent7451a88de892b5f3496eb63c7be44bc339df96b9 (diff)
downloadRoughlyEnoughItems-8af94d0768f57b59b56f019c9d40d95b77382187.tar.gz
RoughlyEnoughItems-8af94d0768f57b59b56f019c9d40d95b77382187.tar.bz2
RoughlyEnoughItems-8af94d0768f57b59b56f019c9d40d95b77382187.zip
Expend DraggableStackProvider and DraggableStackVisitor to work in any widgets, implement renderBackToPosition
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
index 02deb5231..0384a5b49 100644
--- a/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
+++ b/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
@@ -34,6 +34,8 @@ 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.components.events.ContainerEventHandler;
+import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.Nullable;
@@ -118,10 +120,10 @@ public abstract class AbstractRecipeViewingScreen extends Screen implements Reci
transformNotice(Slot.OUTPUT, setupDisplay, noticeStack);
}
- private static void transformNotice(int marker, List<Widget> setupDisplay, EntryStack<?> noticeStack) {
+ private static void transformNotice(int marker, List<? extends GuiEventListener> setupDisplay, EntryStack<?> noticeStack) {
if (noticeStack.isEmpty())
return;
- for (Widget widget : setupDisplay) {
+ for (GuiEventListener widget : setupDisplay) {
if (widget instanceof EntryWidget) {
EntryWidget entry = (EntryWidget) widget;
if (entry.getNoticeMark() == marker && entry.getEntries().size() > 1) {
@@ -131,6 +133,8 @@ public abstract class AbstractRecipeViewingScreen extends Screen implements Reci
entry.entry(stack);
}
}
+ } else if (widget instanceof ContainerEventHandler) {
+ transformNotice(marker, ((ContainerEventHandler) widget).children(), noticeStack);
}
}
}