API reference / @jsprismarine/script-host / shape/implementations
shape/implementations
Classes
Interfaces
AccessorImplementation
Defined in: script-host/src/shape/implementations.ts:57
A writable property's implementation. A half left out throws NotImplementedError when used.
Properties
get?
readonlyoptionalget?:MemberFunction
Defined in: script-host/src/shape/implementations.ts:58
set?
readonlyoptionalset?: (call) =>void
Defined in: script-host/src/shape/implementations.ts:59
Parameters
call
Returns
void
GetterImplementation
Defined in: script-host/src/shape/implementations.ts:52
A read-only property's implementation.
Properties
get
readonlyget:MemberFunction
Defined in: script-host/src/shape/implementations.ts:53
ImplementationCoverage
Defined in: script-host/src/shape/implementations.ts:146
Implemented members over members, for one served version.
Properties
implemented
readonlyimplemented:number
Defined in: script-host/src/shape/implementations.ts:147
total
readonlytotal:number
Defined in: script-host/src/shape/implementations.ts:148
ImplementationOptions
Defined in: script-host/src/shape/implementations.ts:92
How a member's implementation takes its arguments.
Properties
converts?
readonlyoptionalconverts?: readonlystring[]
Defined in: script-host/src/shape/implementations.ts:99
The arguments, by their metadata names, that the implementation converts and checks itself. The binding passes them on unchecked, for a member whose errors BDS words itself, such as setDynamicProperty's value, which refuses NaN with Native variant type conversion failed. and nothing after it.
ScriptCall
Defined in: script-host/src/shape/implementations.ts:9
One call from a script into a member's implementation.
Properties
args
readonlyargs: readonlyScriptValue[]
Defined in: script-host/src/shape/implementations.ts:39
The arguments after the metadata's checks, with each omitted argument's default filled in. A setter's one argument is the value. Handles last until the implementation returns.
engine
readonlyengine:ScriptEngine
Defined in: script-host/src/shape/implementations.ts:10
pack
readonlypack:string
Defined in: script-host/src/shape/implementations.ts:12
The pack whose script made the call, as its binding names it.
packId?
readonlyoptionalpackId?:string
Defined in: script-host/src/shape/implementations.ts:14
The pack's stable identity, distinct even when two packs share a display name.
self
readonlyself:ScriptValue
Defined in: script-host/src/shape/implementations.ts:16
The call's this: the instance, the class for a static member, or undefined for a module function.
state
readonlystate:string
Defined in: script-host/src/shape/implementations.ts:23
The state the host gave self when it made the instance, or the one a constructor's implementation returned: an empty string when it has none.
tag
readonlytag:number
Defined in: script-host/src/shape/implementations.ts:18
The tag the host gave self when it made the instance, or 0. See ScriptApiContext.create.
Methods
setState()
setState(
state):void
Defined in: script-host/src/shape/implementations.ts:25
Replaces the state of self, for a member that changes its own object, such as ItemStack.amount.
Parameters
state
string
Returns
void
setStateOf()
setStateOf(
value,state):void
Defined in: script-host/src/shape/implementations.ts:32
Replaces the state of another object the host made, for a member that changes the object it belongs to, such as an item stack's component writing its stack. Leaves any other value alone.
Parameters
value
state
string
Returns
void
stateOf()
stateOf(
value):string
Defined in: script-host/src/shape/implementations.ts:27
The state of an object the host made, such as a BlockPermutation argument; empty for any other value.
Parameters
value
Returns
string
stringify()
stringify(
value):string|undefined
Defined in: script-host/src/shape/implementations.ts:34
A plain argument, such as a Record of block states, as JSON; undefined when it has none.
Parameters
value
Returns
string | undefined
Type Aliases
Implementation
Implementation =
MemberFunction|GetterImplementation|AccessorImplementation
Defined in: script-host/src/shape/implementations.ts:75
Any member's implementation.
ImplementationOf
ImplementationOf<
Slot> =Slotextends"method"|"constructor"?MemberFunction:Slotextends"getter"?GetterImplementation:Slotextends"accessor"?AccessorImplementation:never
Defined in: script-host/src/shape/implementations.ts:66
The implementation a member of each slot takes. A member whose slot changed between versions takes any of them.
Type Parameters
Slot
Slot
MemberFunction
MemberFunction = (
call) =>ScriptValue
Defined in: script-host/src/shape/implementations.ts:49
A method's, constructor's or module function's behavior, or a property's getter.
A member whose metadata return type is plain data, an interface such as Vector3 or an array of plain values such as string[], returns it as one JSON string, which the binding parses inside the engine. A constructor may return a string, which becomes the new object's state.
Parameters
call
Returns
MemberSlot
MemberSlot =
"method"|"constructor"|"getter"|"accessor"
Defined in: script-host/src/shape/implementations.ts:63
How a member binds, as ScriptApiMembers records it.
ScriptMemberName
ScriptMemberName<
Module,Owner> = keyofScriptApiMembers[Module][Owner] &string
Defined in: script-host/src/shape/implementations.ts:84
A member of a class.
Type Parameters
Module
Module extends ScriptModuleName
Owner
Owner extends ScriptOwnerName<Module>
ScriptModuleName
ScriptModuleName = keyof
ScriptApiMembers
Defined in: script-host/src/shape/implementations.ts:78
A generated module name.
ScriptOwnerName
ScriptOwnerName<
Module> = keyofScriptApiMembers[Module] &string
Defined in: script-host/src/shape/implementations.ts:81
A class of a module with members to implement, or '' for its module-level functions.
Type Parameters
Module
Module extends ScriptModuleName
Functions
implementationCoverage()
implementationCoverage(
shape,implementations):ImplementationCoverage
Defined in: script-host/src/shape/implementations.ts:156
Counts the members of a version that need behavior and how many have it: every method, constructor and property of a class, an iterable class's next, and every module function. Enums, constants, errors and interfaces need none.