Skip to content

ProgressWidget

The ProgressWidget is a UI component that visually represents progress using a progress bar. It can be used in various contexts, such as tracking crafting progress, energy levels, or other dynamically changing values.


Features

  • Customizable progress texture – Define how the progress bar looks.
  • Dynamic progress updates – Uses a DoubleSupplier to fetch real-time progress.

Properties

Field Type Description
lastProgressValue double Stores the last recorded progress value.

APIs

setProgressSupplier

Sets a progress supplier from 0 to 1.

progressWidget.setProgressSupplier(() -> 0.3);
progressWidget.setProgressSupplier(() => 0.3);

setDynamicHoverTips

Sets a dynamic hovertips based on the progress value.

progressWidget.setDynamicHoverTips(progress -> "current progress is %.f%".format(progress * 100));
progressWidget.setDynamicHoverTips(progress => `current progress is ${progress * 100}%` );