named
named<
F>(id,fn):F
Give a function a fixed name, so players and other packs can run it: a path under your function
prefix ("tools/reset" is mypack:generated/tools/reset), or a full id. Use a full id to put
the functions people should run where they’re easy to find, outside the generated folder:
named("mypack:api/reset", () => { $.kill("@e[tag=mypack]");});// /function mypack:api/resetIt’s written to the pack even if nothing calls it, like @mcfunction. Inside a loop or a helper,
give each copy its own name (named(`mypack:api/give/${item}`, ...)); the same name twice is
only allowed when both have the same commands. Returns fn.
Type Parameters
Section titled “Type Parameters”F extends FnRef & Function
Parameters
Section titled “Parameters”string
F
Returns
Section titled “Returns”F