Class MultiPositionMask
java.lang.Object
io.github.projectunified.craftux.mask.MultiMask<Button>
io.github.projectunified.craftux.mask.MultiPositionMask
A mask that applies a list of buttons to multiple positions, cycling through buttons if there are more positions than buttons.
Useful for repeating patterns across a grid.
Example usage:
MultiPositionMask mask = new MultiPositionMask(
uuid -> Arrays.asList(Position.of(0, 0), Position.of(1, 0), Position.of(2, 0))
);
mask.add(
new SimpleButton(new ItemStack(Material.RED_CONCRETE)),
new SimpleButton(new ItemStack(Material.BLUE_CONCRETE))
);
// Positions 0 and 2 get red concrete, position 1 gets blue concrete
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionMultiPositionMask(@NotNull Function<UUID, List<Position>> maskPositionFunction) Create a new mask -
Method Summary
Methods inherited from class io.github.projectunified.craftux.mask.MultiMask
add, add, getElements, init, stopMethods 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
-
Field Details
-
maskPositionFunction
-
-
Constructor Details
-
MultiPositionMask
Create a new mask- Parameters:
maskPositionFunction- the mask position function
-
-
Method Details
-
getMaskPositionFunction
Get the mask position function- Returns:
- the mask position
-
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)
-