Class AnimatedMask
java.lang.Object
io.github.projectunified.craftux.mask.MultiMask<Mask>
io.github.projectunified.craftux.mask.AnimatedMask
A mask that cycles through a list of child masks as animation frames over time.
Each frame is displayed for a configurable period, creating an animated GUI layout.
Example usage:
AnimatedMask animatedMask = new AnimatedMask();
animatedMask.add(
new SingleMask(Position.of(0, 0), new SimpleButton(new ItemStack(Material.REDSTONE))),
new SingleMask(Position.of(0, 0), new SimpleButton(new ItemStack(Material.LAPIS_LAZULI))),
new SingleMask(Position.of(0, 0), new SimpleButton(new ItemStack(Material.GOLD_INGOT)))
);
animatedMask.setPeriodMillis(1000); // 1 second per frame
Map<Position, Consumer<ActionItem>> actions = animatedMask.apply(playerUUID);
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Map<Position, Consumer<ActionItem>> Get a map of positions to action item consumersvoidsetMode(AnimationMode mode) Set the mode of the animationvoidsetPeriodMillis(long periodMillis) Set the period of the animationvoidstop()Stop the element.Methods inherited from class io.github.projectunified.craftux.mask.MultiMask
add, add, getElements, initMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.projectunified.craftux.common.Mask
getActionMap
-
Constructor Details
-
AnimatedMask
public AnimatedMask()
-
-
Method Details
-
setPeriodMillis
public void setPeriodMillis(long periodMillis) Set the period of the animation- Parameters:
periodMillis- the period in milliseconds
-
setMode
Set the mode of the animation- Parameters:
mode- the mode of the animation
-
stop
public void stop()Description copied from interface:ElementStop the element. Should be called after removing from the GUI. -
apply
Description copied from interface:MaskGet a map of positions to action item consumers- Parameters:
uuid- the uuid of the player- Returns:
- the map, or null if no items should be displayed. Can return null in a conditional case (e.g. predicate mask)
-