From a813597e91924c2b8a33e1936aaecb65b421c6b9 Mon Sep 17 00:00:00 2001 From: Gravy Boat Date: Thu, 19 Feb 2026 03:57:27 -0330 Subject: [PATCH] feat: delete all landing blocks --- .../gui/screens/LandingBlockGuiScreen.java | 68 ++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/io/github/kurrycat/mpkmod/gui/screens/LandingBlockGuiScreen.java b/common/src/main/java/io/github/kurrycat/mpkmod/gui/screens/LandingBlockGuiScreen.java index bb7b90e9..f0cdc284 100644 --- a/common/src/main/java/io/github/kurrycat/mpkmod/gui/screens/LandingBlockGuiScreen.java +++ b/common/src/main/java/io/github/kurrycat/mpkmod/gui/screens/LandingBlockGuiScreen.java @@ -5,8 +5,8 @@ import io.github.kurrycat.mpkmod.compatibility.MCClasses.Renderer2D; import io.github.kurrycat.mpkmod.compatibility.MCClasses.WorldInteraction; import io.github.kurrycat.mpkmod.gui.ComponentScreen; -import io.github.kurrycat.mpkmod.gui.components.Button; import io.github.kurrycat.mpkmod.gui.components.*; +import io.github.kurrycat.mpkmod.gui.components.Button; import io.github.kurrycat.mpkmod.gui.interfaces.KeyInputListener; import io.github.kurrycat.mpkmod.gui.interfaces.MouseInputListener; import io.github.kurrycat.mpkmod.landingblock.LandingBlock; @@ -22,6 +22,7 @@ public class LandingBlockGuiScreen extends ComponentScreen { public static Color lbListColorBg = new Color(31, 31, 31, 150); private LBList lbList; + private DeletePane deletePane; public static List calculateLBOffsets() { List returnOffsets = new ArrayList<>(); @@ -47,6 +48,15 @@ public void onGuiInit() { new Vector2D(3 / 5D, 0.9) ); addChild(lbList, PERCENT.ALL, Anchor.TOP_CENTER); + lbList.topCover.addChild( + new Button( + "Delete All", + new Vector2D(20, 1), + new Vector2D(50, 11), + mouseButton -> this.openPane(deletePane) + ), + PERCENT.NONE, Anchor.CENTER_RIGHT + ); lbList.topCover.addChild( new Button( "x", @@ -56,6 +66,9 @@ public void onGuiInit() { ), PERCENT.NONE, Anchor.CENTER_RIGHT ); + + deletePane = new DeletePane(); + passPositionTo(deletePane, PERCENT.ALL, Anchor.CENTER); } @Override @@ -263,4 +276,57 @@ public boolean handleKeyInput(int keyCode, int scanCode, int modifiers, boolean ); } } + + public static class DeletePane extends Pane { + + public DeletePane() { + super(Vector2D.ZERO, new Vector2D(0.4, 0.4)); + + addChild( + new TextRectangle( + new Vector2D(0, 10), + new Vector2D(100, 40), + "Are you sure you want to", + null, + Color.WHITE + ), + PERCENT.NONE, Anchor.TOP_CENTER + ); + + addChild( + new TextRectangle( + new Vector2D(0, 20), + new Vector2D(100, 40), + "delete all landing blocks?", + null, + Color.WHITE + ), + PERCENT.NONE, Anchor.TOP_CENTER + ); + + addChild( + new Button( + "Cancel", + new Vector2D(20, 10), + new Vector2D(60, 17), + mouseButton -> this.close() + ), + PERCENT.NONE, Anchor.BOTTOM_LEFT + ); + + addChild( + new Button( + "Confirm", + new Vector2D(20, 10), + new Vector2D(60, 17), + mouseButton -> { + this.paneHolder.lbList.items.clear(); + LandingBlockGuiScreen.lbs.clear(); + this.close(); + } + ), + PERCENT.NONE, Anchor.BOTTOM_RIGHT + ); + } + } }