From 8af94d0768f57b59b56f019c9d40d95b77382187 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Wed, 17 Mar 2021 00:30:40 +0800 Subject: Expend DraggableStackProvider and DraggableStackVisitor to work in any widgets, implement renderBackToPosition Signed-off-by: shedaniel --- .../java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java') 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 setupDisplay, EntryStack noticeStack) { + private static void transformNotice(int marker, List 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); } } } -- cgit