-
Notifications
You must be signed in to change notification settings - Fork 0
Map functions
Map functions can be used in the map operation to map elements in a list.
A map function can be specified using the $listutils.function listutils.in
score. This score corresponds to the ID of the function.
By default, there is currently one map function in the List Utils datapack. This is located in the listutils.custom/functions/map/functions/built_in
directory:
ID | Function | Description |
---|---|---|
0 | map_copy |
Copies the element to the map function output. |
NOTE: IDs 0 to 99 should be reserverd for map functions native to the List Utils datapack, in case more functions are included in the future.
Users can create custom map functions for their own needs. These functions should adhere to the return values below. For more information, see the Custom functions page.
The data element to map is located in the In
field in the listutils:map
storage. The current index of the iteration is stored in the $listutils.current_index listutils.in
score.
The return value should be stored in the Out
field in the listutils:map
storage. The return value is appended to the output list.