Class ConfirmModal
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe host's click-region registrar (ripple colour, corner radius, action). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops taking input at once; the dialog then fades out overPopover.ANIM_MS.voidconfirm()Runs the confirmed action and closes.booleanisOpen()Live and interactive.booleanOn screen — open or fading out.int[]voidvoidrender(UiContext ui, int logicalW, int logicalH, ConfirmModal.HitSink hits) voidrender(UiContext ui, int logicalW, int logicalH, ConfirmModal.HitSink hits, Popover.Body overlay) render(UiContext, int, int, HitSink)with anoverlayslot drawn last, inside the dialog's pop transform and handed its current alpha.
-
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
-
close
public void close()Stops taking input at once; the dialog then fades out overPopover.ANIM_MS. -
confirm
public void confirm()Runs the confirmed action and closes. -
render
-
render
public void render(UiContext ui, int logicalW, int logicalH, ConfirmModal.HitSink hits, Popover.Body overlay) render(UiContext, int, int, HitSink)with anoverlayslot 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.
-