Class ConfirmModal

java.lang.Object
me.hackware.api.gui.studio.ConfirmModal

public final class ConfirmModal extends Object
The full-screen destructive-confirm dialog (shadcn proportions): a dimmed backdrop, a title, a detail line, an "undo" warning, and right-aligned Cancel / Delete buttons. Exclusive — the host treats it as modal.

Built the same way as Popover, and shares its animation: the scrim and card fade in together while the card pops from 0.9 → 1 about the screen centre over Popover.ANIM_MS, reversed on close. The card carries the popover's shadow a shade darker (GuiUtils.drawShadowModal(net.minecraft.client.gui.GuiGraphics, int, int, int, int, float, float)), since it has to separate from a dimmed, frosted backdrop rather than a flat card.

Stateless about deletion: the caller supplies the label, detail, and an onConfirm runnable. Buttons register through a ConfirmModal.HitSink so they keep the host's ripple/press feel.

Hosts should gate rendering on isVisible() (open or fading) and input on isOpen(), which goes false the instant a close starts.

  • Constructor Details

    • ConfirmModal

      public ConfirmModal()
  • Method Details

    • isOpen

      public boolean isOpen()
      Live and interactive. False the moment a close begins, even mid-fade.
    • isVisible

      public boolean isVisible()
      On screen — open or fading out. Gate the host's render pass on this.
    • modalRect

      public int[] modalRect()
    • open

      public void open(String name, String detail, Runnable onConfirm)
    • close

      public void close()
      Stops taking input at once; the dialog then fades out over Popover.ANIM_MS.
    • confirm

      public void confirm()
      Runs the confirmed action and closes.
    • render

      public void render(UiContext ui, int logicalW, int logicalH, ConfirmModal.HitSink hits)
    • render

      public void render(UiContext ui, int logicalW, int logicalH, ConfirmModal.HitSink hits, Popover.Body overlay)
      render(UiContext, int, int, HitSink) with an overlay slot drawn last, inside the dialog's pop transform and handed its current alpha. Hosts pass their modal-layer ripple pass here so a button's ripple scales and fades with the dialog it lives on — drawn outside, it would hang at full strength over a dialog that had already animated away.