diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java new file mode 100644 index 00000000..8b5cecdd --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java @@ -0,0 +1,56 @@ +package kr.syeyoung.dungeonsguide.roomedit; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import lombok.Data; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; + +import java.util.LinkedList; +import java.util.Stack; + +public class EditingContext { + + private static EditingContext editingContext; + + public static void createEditingContext(DungeonRoom dungeonRoom) { + editingContext = new EditingContext(dungeonRoom); + } + + public static EditingContext getEditingContext() { + return editingContext; + } + + public static void endEditingSession() { + editingContext = null; + Minecraft.getMinecraft().displayGuiScreen(null); + } + + + private EditingContext(DungeonRoom dungeonRoom) { + this.room = dungeonRoom; + } + + @Getter + private DungeonRoom room; + + private Stack<GuiScreen> guiStack = new Stack<GuiScreen>(); + + private GuiScreen current; + + public void openGui(GuiScreen gui) { + guiStack.push(current); + this.current = gui; + Minecraft.getMinecraft().displayGuiScreen(gui); + } + + public void goBack() { + current = guiStack.pop(); + Minecraft.getMinecraft().displayGuiScreen(current); + } + + public void reopen() { + Minecraft.getMinecraft().displayGuiScreen(current); + } +} |