Skip to content

API reference / @jsprismarine/prismarine / command/function/load

command/function/load ​

Interfaces ​

FunctionContent ​

Defined in: packages/prismarine/src/command/function/load.ts:29

The two halves of a content build this module reads.

Narrower than ServerContent on purpose: a test states a map of functions and a tag table and gets the real compile, and nothing here is coupled to the eighteen other registries a content build carries.

Properties ​

functions ​

readonly functions: ReadonlyMap<string, Definition>

Defined in: packages/prismarine/src/command/function/load.ts:31

The functions registry of a loaded pack stack, whose data is the file's text.

tags? ​

readonly optional tags?: Pick<ContentTags, "tags" | "members" | "has">

Defined in: packages/prismarine/src/command/function/load.ts:33

The merged tags, read for the function registry alone.


ServerFunctions ​

Defined in: packages/prismarine/src/command/function/load.ts:37

What a pack stack's function half amounts to.

Properties ​

diagnostics ​

readonly diagnostics: readonly Diagnostic[]

Defined in: packages/prismarine/src/command/function/load.ts:45

Everything compiling reported. A file that did not compile is left out.

functions ​

readonly functions: FunctionRegistry

Defined in: packages/prismarine/src/command/function/load.ts:39

Every function that compiled, keyed by namespaced id.

tagIds ​

readonly tagIds: readonly string[]

Defined in: packages/prismarine/src/command/function/load.ts:43

Every tag id the stack declares, for a caller that wants to list them.

tags ​

readonly tags: FunctionTagLookup

Defined in: packages/prismarine/src/command/function/load.ts:41

The function tags, which /function #tag and the tick tag resolve through.

Variables ​

FUNCTION_TAG_REGISTRY ​

const FUNCTION_TAG_REGISTRY: "function" = 'function'

Defined in: packages/prismarine/src/command/function/load.ts:20

The registry a datapack's function tags live in, as routeDatapackPath names it.

Functions ​

functionContentOf() ​

functionContentOf(content): FunctionContent

Defined in: packages/prismarine/src/command/function/load.ts:100

The function half of a content build.

The one place the narrow FunctionContent is joined back to the whole, so everything else in this directory stays free of the eighteen registries it does not read.

Parameters ​

content ​

ServerContent

Returns ​

FunctionContent

The two registries the function loader reads.


loadServerFunctions() ​

loadServerFunctions(content): ServerFunctions

Defined in: packages/prismarine/src/command/function/load.ts:69

Compiles every function the stack registered.

A stack holding no datapack compiles to an empty registry rather than a refusal: /function then reports that the function it was given does not exist, which is what Java reports for the same input.

Parameters ​

content ​

FunctionContent

The function half of a content build.

Returns ​

ServerFunctions