Alpha: this compiler is under active development and updates will break your projects. Not recommended for real use yet.
Skip to content

helix / defineEntityNbt

Function: defineEntityNbt() โ€‹

Call Signature โ€‹

defineEntityNbt<F>(schema, entity): (fields) => IdentifiedEntityNbt

Defined in: core/values/entity-nbt/define.ts:24

Builds a typed entity NBT factory from a field schema, for entities helix doesn't cover:

const Blob = defineEntityNbt<{ size?: number }>({ size: field({ key: "Size", encode: Short }), }, "mymod:blob");

Name the entity so ctx.summon(Blob({ size: 3 }), pos) knows its type.

Type Parameters โ€‹

F โ€‹

F extends object

Parameters โ€‹

schema โ€‹

EntityNbtSchema<F>

entity โ€‹

string

Returns โ€‹

(fields) => IdentifiedEntityNbt

Call Signature โ€‹

defineEntityNbt<F>(schema): (fields) => EntityNbtValue

Defined in: core/values/entity-nbt/define.ts:28

Builds a typed entity NBT factory from a field schema, for entities helix doesn't cover:

const Blob = defineEntityNbt<{ size?: number }>({ size: field({ key: "Size", encode: Short }), }, "mymod:blob");

Name the entity so ctx.summon(Blob({ size: 3 }), pos) knows its type.

Type Parameters โ€‹

F โ€‹

F extends object

Parameters โ€‹

schema โ€‹

EntityNbtSchema<F>

Returns โ€‹

(fields) => EntityNbtValue

Released under the MIT License ยท Credits
These docs were written with AI; the layout and every page have been reviewed by a human.