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

helix / Datapack

Class: Datapack โ€‹

Defined in: core/ir/datapack/datapack.ts:30

A datapack being built: functions, objectives, tags and data files for one Minecraft version. Packs built with the helix CLI get one passed to their entry.

Extends โ€‹

  • DatapackEntry

Constructors โ€‹

Constructor โ€‹

new Datapack(name, version, target?, opts?): Datapack

Defined in: core/ir/datapack/core.ts:120

Parameters โ€‹

name โ€‹

string

version โ€‹

VersionProfile

target? โ€‹

RuntimeTarget = DEFAULT_TARGET

opts? โ€‹
debug? โ€‹

DebugOptions

layout? โ€‹

FunctionLayout

optimize? โ€‹

OptimizeOptions

Returns โ€‹

Datapack

Inherited from โ€‹

DatapackEntry.constructor

Properties โ€‹

debug โ€‹

readonly debug: DebugOptions

Defined in: core/ir/datapack/core.ts:76

Debug-only build settings (source tracking); all off by default.

Inherited from โ€‹

DatapackEntry.debug


name โ€‹

name: string

Defined in: core/ir/datapack/core.ts:57

Inherited from โ€‹

DatapackEntry.name


objectives โ€‹

protected objectives: Map<string, Objective>

Defined in: core/ir/datapack/core.ts:66

Inherited from โ€‹

DatapackEntry.objectives


onPluginUse? โ€‹

optional onPluginUse?: (name) => void

Defined in: core/ir/datapack/core.ts:88

Called with the name each time plugin is asked for a plugin's home, e.g. to see who uses it.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.onPluginUse


optimize โ€‹

readonly optimize: OptimizeOptions

Defined in: core/ir/datapack/core.ts:78

Which output optimization passes run; all on by default.

Inherited from โ€‹

DatapackEntry.optimize


path โ€‹

readonly path: string = ""

Defined in: core/ir/datapack/core.ts:85

This view's group path; empty on the pack itself. See group.

Inherited from โ€‹

DatapackEntry.path


tags โ€‹

tags: Map<FunctionTag, Set<string>>

Defined in: core/ir/datapack/core.ts:74

Inherited from โ€‹

DatapackEntry.tags


target โ€‹

target: RuntimeTarget

Defined in: core/ir/datapack/core.ts:63

The runtime this build targets. Only ctx.native(...) depends on it. See useTarget.

Inherited from โ€‹

DatapackEntry.target


timing โ€‹

readonly timing: ScoreboardTiming

Defined in: core/ir/datapack/core.ts:112

How run-for-a-duration / periodic timing compiles.

Inherited from โ€‹

DatapackEntry.timing


version โ€‹

readonly version: VersionProfile

Defined in: core/ir/datapack/core.ts:58

Inherited from โ€‹

DatapackEntry.version

Accessors โ€‹

objectiveDefs โ€‹

Get Signature โ€‹

get protected objectiveDefs(): ReadonlyMap<string, Objective>

Defined in: core/ir/datapack/functions.ts:50

Declared objectives, for the load-time init injection.

Returns โ€‹

ReadonlyMap<string, Objective>

Inherited from โ€‹

DatapackEntry.objectiveDefs


root โ€‹

Get Signature โ€‹

get root(): this

Defined in: core/ir/datapack/core.ts:141

The pack itself, from any group view.

Returns โ€‹

this

Inherited from โ€‹

DatapackEntry.root

Methods โ€‹

addAssets() โ€‹

addAssets(dir): this

Defined in: core/ir/datapack/assets.ts:203

Copies every file under dir into the resource pack's assets/, keeping subfolders. dir should contain <ns>/... folders.

Parameters โ€‹

dir โ€‹

string

Returns โ€‹

this

Inherited from โ€‹

DatapackEntry.addAssets


addStructures() โ€‹

addStructures(dir): this

Defined in: core/ir/datapack/core.ts:189

Ships every .nbt under dir into the pack's structure folder. cog.nbt becomes <ns>:cog. Copied when the datapack is written.

Parameters โ€‹

dir โ€‹

string

Returns โ€‹

this

Inherited from โ€‹

DatapackEntry.addStructures


advancement() โ€‹

advancement(name, def): Advancement

Defined in: core/ir/datapack/data.ts:78

Registers an AdvancementDef and returns its id. The same name with a different object throws.

Parameters โ€‹

name โ€‹

string

def โ€‹

AdvancementDef

Returns โ€‹

Advancement

Inherited from โ€‹

DatapackEntry.advancement


after() โ€‹

after(ctx, time, fn, append?): FunctionRef

Defined in: core/ir/datapack/entry.ts:28

Runs fn once after time:

dp.after(ctx, Time.seconds(3), (c) => c.say("done")); dp.after(ctx, Time(5), swap);

A body goes in an auto-named child function, so you don't invent a name. append queues instead of replacing a pending run. Not a coroutine: it runs later at the world origin as the server, so it must set its own as/at.

Parameters โ€‹

ctx โ€‹

FunctionContext

time โ€‹

TimeValue

fn โ€‹

FunctionRef | ((ctx) => void)

append? โ€‹

boolean = false

Returns โ€‹

FunctionRef

Inherited from โ€‹

DatapackEntry.after


allow() โ€‹

allow(rule, fn, reason): void

Defined in: core/ir/datapack/datapack.ts:100

Marks fn's hits of lint rule as intentional, including functions it calls. Keep the expensive commands in their own function so new ones elsewhere still warn. Inside the function's builder, ctx.allow does the same without naming it.

Parameters โ€‹

rule โ€‹

LintRule

fn โ€‹

string | FunctionRef

reason โ€‹

string

Returns โ€‹

void


allowNbtRead() โ€‹

allowNbtRead(fn, reason): void

Defined in: core/ir/datapack/datapack.ts:115

allow for "nbt-read": NBT reads faster than the t5 clock.

Parameters โ€‹

fn โ€‹

string | FunctionRef

reason โ€‹

string

Returns โ€‹

void


biome() โ€‹

biome(name, def): Biome

Defined in: core/ir/datapack/data.ts:200

Registers a BiomeDef and returns its id.

A namespaced name writes outside this pack, which is how you replace a vanilla biome:

dp.biome("sky/void", def) -> data/mypack/worldgen/biome/sky/void.json dp.biome("minecraft:plains", def) -> data/minecraft/worldgen/biome/plains.json

Parameters โ€‹

name โ€‹

string

def โ€‹

BiomeDef

Returns โ€‹

Biome

Inherited from โ€‹

DatapackEntry.biome


blockModel() โ€‹

blockModel(name, def): ModelRef

Defined in: core/ir/datapack/assets.ts:124

Registers a block Model and returns a ref for BlockState variants.

Parameters โ€‹

name โ€‹

string

def โ€‹

Model

Returns โ€‹

ModelRef

Inherited from โ€‹

DatapackEntry.blockModel


blockState() โ€‹

blockState(block, def): void

Defined in: core/ir/datapack/assets.ts:142

Overrides an existing block's appearance. block defaults to the minecraft: namespace.

Parameters โ€‹

block โ€‹

string

def โ€‹

BlockState

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.blockState


blockTag() โ€‹

blockTag(name, blocks, opts?): BlockValue

Defined in: core/ir/datapack/tags.ts:89

Declares a block tag and returns it as a block (#<pack>:<name>) for commands and predicates. Registering again appends.

Parameters โ€‹

name โ€‹

string

blocks โ€‹

readonly BlockValue<string>[]

opts? โ€‹
replace? โ€‹

boolean

Returns โ€‹

BlockValue

Inherited from โ€‹

DatapackEntry.blockTag


createFunction() โ€‹

createFunction(name, ...tags): FunctionRef

Defined in: core/ir/datapack/functions.ts:59

Creates the private function name in this group: zzzprivate/<group>/<name>.

Use public for a function run by hand with /function.

Parameters โ€‹

name โ€‹

string

tags โ€‹

...FunctionTag[]

Returns โ€‹

FunctionRef

Inherited from โ€‹

DatapackEntry.createFunction


dialog() โ€‹

dialog(name, def): Dialog

Defined in: core/ir/datapack/data.ts:179

Registers a DialogDef and returns its id for ctx.dialog().show or click.dialog. 1.21.6+.

Parameters โ€‹

name โ€‹

string

def โ€‹

DialogDef

Returns โ€‹

Dialog

Inherited from โ€‹

DatapackEntry.dialog


enchantment() โ€‹

enchantment(name, def): Enchantment

Defined in: core/ir/datapack/data.ts:165

Registers an EnchantmentDef and returns its id. The same name with a different object throws.

Parameters โ€‹

name โ€‹

string

def โ€‹

EnchantmentDef

Returns โ€‹

Enchantment

Inherited from โ€‹

DatapackEntry.enchantment


entityTypeTag() โ€‹

entityTypeTag(name, types): EntityType

Defined in: core/ir/datapack/tags.ts:75

Declares an entity type tag and returns it as a type for Selector.type(...), so one selector can match several types. Registering again appends.

Parameters โ€‹

name โ€‹

string

types โ€‹

readonly EntityType[]

Returns โ€‹

EntityType

Inherited from โ€‹

DatapackEntry.entityTypeTag


event() โ€‹

event(name, trigger, body): object

Defined in: core/ir/datapack/data.ts:103

A repeatable event: body runs as the player every time trigger fires.

Emits the advancement and a reward function that revokes it first, so the event re-arms even when body returns early:

dp.event("eat_chorus", Trigger.consumeItem(Item.CHORUS_FRUIT), (ctx) => { ... });

Pass a record of named triggers to fire on any of them. The function and advancement are private and share one name. For conditions you could test on a tick, use a Predicate instead.

Parameters โ€‹

name โ€‹

string

trigger โ€‹

Trigger | Record<string, Trigger>

body โ€‹

(ctx) => void

Returns โ€‹

object

advancement โ€‹

advancement: Advancement

fn โ€‹

fn: FunctionRef

Inherited from โ€‹

DatapackEntry.event


everySeconds() โ€‹

everySeconds(seconds, phase?): FunctionRef

Defined in: core/ir/datapack/datapack.ts:120

A function that runs every seconds seconds. phase (in ticks) staggers it, as in everyTicks.

Parameters โ€‹

seconds โ€‹

number

phase? โ€‹

number = 0

Returns โ€‹

FunctionRef


everyTicks() โ€‹

everyTicks(ticks, phase?): FunctionRef

Defined in: core/ir/datapack/datapack.ts:133

A function that runs every ticks ticks. phase offsets it so same-period hooks spread out.

Parameters โ€‹

ticks โ€‹

number

phase? โ€‹

number = 0

Returns โ€‹

FunctionRef


fn() โ€‹

fn<P>(name, body, opts?): CallableFn<P>

Defined in: core/ir/datapack/functions.ts:85

A function whose params are scores and whose result is the score body returns.

Params are counted from body.length, so they can't have defaults or be a rest param. They are locals, so a recursive call overwrites them.

Type Parameters โ€‹

P โ€‹

P extends Score<number>[]

Parameters โ€‹

name โ€‹

string

body โ€‹

(ctx, ...params) => void | Score<number>

opts? โ€‹
public? โ€‹

boolean

Returns โ€‹

CallableFn<P>

Inherited from โ€‹

DatapackEntry.fn


functionAt() โ€‹

functionAt(name, ...tags): FunctionRef

Defined in: core/ir/datapack/functions.ts:141

Gets or creates the function with output name name, as is. For names already resolved.

Parameters โ€‹

name โ€‹

string

tags โ€‹

...FunctionTag[]

Returns โ€‹

FunctionRef

Inherited from โ€‹

DatapackEntry.functionAt


functionName() โ€‹

functionName(name, opts?): string

Defined in: core/ir/datapack/core.ts:178

The output name of function name in this group. Private unless public.

load and tick at the top are always public, since their tags name them.

Parameters โ€‹

name โ€‹

string

opts? โ€‹
public? โ€‹

boolean

Returns โ€‹

string

Inherited from โ€‹

DatapackEntry.functionName


functionRef() โ€‹

functionRef(name): FunctionRef | undefined

Defined in: core/ir/datapack/functions.ts:149

A ref to the function with output name name, or undefined if none exists.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

FunctionRef | undefined

Inherited from โ€‹

DatapackEntry.functionRef


functionTag() โ€‹

functionTag(name, spec?): FunctionTagRefValue

Defined in: core/ir/datapack/tags.ts:60

Declares a function tag and returns a ref for ctx.callTag(...) / schedule. Members are FunctionRefs, so they must exist. Registering again appends.

Parameters โ€‹

name โ€‹

string

spec? โ€‹
replace? โ€‹

boolean

values โ€‹

FunctionRef[]

Returns โ€‹

FunctionTagRefValue

Inherited from โ€‹

DatapackEntry.functionTag


getOrCreateFunction() โ€‹

getOrCreateFunction(name, ...tags): FunctionRef

Defined in: core/ir/datapack/functions.ts:136

Like createFunction, but reuses an existing function so several authors can append to it.

Parameters โ€‹

name โ€‹

string

tags โ€‹

...FunctionTag[]

Returns โ€‹

FunctionRef

Inherited from โ€‹

DatapackEntry.getOrCreateFunction


group() โ€‹

group(name): this

Defined in: core/ir/datapack/core.ts:152

A view of this pack whose functions are created under name: dp.group("door").group("lobby") creates door/lobby/<fn>.

Pass it wherever a Datapack goes, so plugins called with it nest their output there too. The same path always returns the same view.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

this

Inherited from โ€‹

DatapackEntry.group


idOf() โ€‹

idOf(ref): FunctionId

Defined in: core/ir/datapack/functions.ts:173

The typed id (<ns>:<name>) of a function in this pack.

Parameters โ€‹

ref โ€‹

FunctionRef

Returns โ€‹

FunctionId

Inherited from โ€‹

DatapackEntry.idOf


itemDefinition() โ€‹

itemDefinition(name, model, options?, legacyModelData?): ModelRef

Defined in: core/ir/datapack/assets.ts:93

Registers a full ItemModel item definition (1.21.4+) and returns a ref for Item.X.model(ref).

For branching models and tints; model is the simple case. Referenced models must come from model, blockModel or addAssets.

Parameters โ€‹

name โ€‹

string

model โ€‹

ItemModel

options? โ€‹
handAnimationOnSwap? โ€‹

boolean

oversizedInGui? โ€‹

boolean

legacyModelData? โ€‹

number

Returns โ€‹

ModelRef

Inherited from โ€‹

DatapackEntry.itemDefinition


itemModifier() โ€‹

itemModifier(name, modifier): ItemModifierRef

Defined in: core/ir/datapack/data.ts:137

Registers an ItemModifier and returns its ref for /item modify.

Parameters โ€‹

name โ€‹

string

modifier โ€‹

ItemModifier

Returns โ€‹

ItemModifierRef

Inherited from โ€‹

DatapackEntry.itemModifier


itemOverride() โ€‹

itemOverride(item, model): void

Defined in: core/ir/datapack/assets.ts:157

Overrides an existing item's appearance (1.21.4+). item defaults to the minecraft: namespace.

Parameters โ€‹

item โ€‹

string

model โ€‹

ItemModel

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.itemOverride


itemTag() โ€‹

itemTag(name, items, opts?): ItemValue

Defined in: core/ir/datapack/tags.ts:105

Declares an item tag and returns it as an item (#<pack>:<name>) for clear, predicates and the like. Registering again appends.

Parameters โ€‹

name โ€‹

string

items โ€‹

readonly ItemLike[]

opts? โ€‹
replace? โ€‹

boolean

Returns โ€‹

ItemValue

Inherited from โ€‹

DatapackEntry.itemTag


keep() โ€‹

keep(fn): void

Defined in: core/ir/datapack/datapack.ts:110

Keeps fn a function of its own: the inliner never pastes it into its callers. For a body the author asked to keep separate, so it shows by name in reports and profiles.

Parameters โ€‹

fn โ€‹

string | FunctionRef

Returns โ€‹

void


load() โ€‹

load(builder): FunctionRef

Defined in: core/ir/datapack/entry.ts:12

Append to the load function (runs on pack load / /reload).

Parameters โ€‹

builder โ€‹

(ctx) => void

Returns โ€‹

FunctionRef

Inherited from โ€‹

DatapackEntry.load


lootTable() โ€‹

lootTable(name, table): LootTableRef

Defined in: core/ir/datapack/data.ts:123

Registers a LootTableDef and returns its ref.

Parameters โ€‹

name โ€‹

string

table โ€‹

LootTableDef

Returns โ€‹

LootTableRef

Inherited from โ€‹

DatapackEntry.lootTable


macro() โ€‹

macro<A>(name, body, opts?): MacroFn<A>

Defined in: core/ir/datapack/functions.ts:113

A macro function: body reads each arg as a $(name) placeholder, typed by A.

Args are placeholders, so use them only as command arguments, not in TS logic. Prefer fn where scores will do: a macro line is re-parsed on every call.

Type Parameters โ€‹

A โ€‹

A extends object

Parameters โ€‹

name โ€‹

string

body โ€‹

(ctx, args) => void

opts? โ€‹
public? โ€‹

boolean

Returns โ€‹

MacroFn<A>

Inherited from โ€‹

DatapackEntry.macro


model() โ€‹

model(name, def, legacyModelData?): ModelRef

Defined in: core/ir/datapack/assets.ts:69

Registers a Model and (1.21.4+) its item definition, returning a ref for Item.X.model(ref). legacyModelData also supports versions before item_model. A different model under the same name throws.

Parameters โ€‹

name โ€‹

string

def โ€‹

Model

legacyModelData? โ€‹

number

Returns โ€‹

ModelRef

Inherited from โ€‹

DatapackEntry.model


objective() โ€‹

objective(name, kind?, displayName?): Objective

Defined in: core/ir/datapack/functions.ts:23

Declares a scoreboard objective, created at load. kind is its criterion (default dummy); asking again for the same name returns the same objective.

Parameters โ€‹

name โ€‹

string

kind? โ€‹

ObjectiveKind = "dummy"

displayName? โ€‹

ComponentValue

Returns โ€‹

Objective

Inherited from โ€‹

DatapackEntry.objective


onFinalize() โ€‹

onFinalize(fn): void

Defined in: core/ir/datapack/core.ts:263

Registers work to run once before codegen, after authoring, so chained settings are final.

Parameters โ€‹

fn โ€‹

() => void

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.onFinalize


plugin() โ€‹

plugin(name): this

Defined in: core/ir/datapack/core.ts:168

The shared home of plugin name: its functions go in zzzplugin/<name>/, public or not.

Keeps plugin code out of the pack's own zzzprivate/ tree.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

this

Inherited from โ€‹

DatapackEntry.plugin


postEffect() โ€‹

postEffect(name): PostEffect

Defined in: core/ir/datapack/assets.ts:213

The id of a post effect shipped in an addAssets folder, for ctx.self.postEffects. Writing the resource pack fails if no folder has its <ns>/post_effect/<name>.json, so a typo is caught at build time instead of silently showing nothing.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

PostEffect

Inherited from โ€‹

DatapackEntry.postEffect


predicate() โ€‹

predicate(name, predicate): PredicateRef

Defined in: core/ir/datapack/data.ts:61

Registers a Predicate and returns its ref for Selector.predicate or predicateCheck. The same name with a different object throws.

Parameters โ€‹

name โ€‹

string

predicate โ€‹

Predicate

Returns โ€‹

PredicateRef

Inherited from โ€‹

DatapackEntry.predicate


prepareForCodegen() โ€‹

protected prepareForCodegen(): void

Defined in: core/ir/datapack/entry.ts:49

Runs finalizers and injects load setup before codegen. Idempotent.

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.prepareForCodegen


profileReport() โ€‹

profileReport(raw): ProfileReport

Defined in: core/ir/datapack/datapack.ts:71

Matches a measured profile from the helix-profiler mod to this pack's functions and lines. helix profile shows it.

Parameters โ€‹

raw โ€‹

ProfileDump

Returns โ€‹

ProfileReport


public() โ€‹

public(name, ...tags): FunctionRef

Defined in: core/ir/datapack/functions.ts:64

Creates the public function name in this group: <group>/<name>.

Parameters โ€‹

name โ€‹

string

tags โ€‹

...FunctionTag[]

Returns โ€‹

FunctionRef

Inherited from โ€‹

DatapackEntry.public


recipe() โ€‹

recipe(name, recipe): RecipeRef

Defined in: core/ir/datapack/data.ts:151

Registers a RecipeDef and returns its ref for /recipe give|take.

Parameters โ€‹

name โ€‹

string

recipe โ€‹

RecipeDef

Returns โ€‹

RecipeRef

Inherited from โ€‹

DatapackEntry.recipe


registerDef() โ€‹

protected registerDef<T>(map, kind, name, def): void

Defined in: core/ir/datapack/core.ts:293

Registers def under name. The same object twice is fine; a different one throws.

Type Parameters โ€‹

T โ€‹

T

Parameters โ€‹

map โ€‹

Map<string, T>

kind โ€‹

string

name โ€‹

string

def โ€‹

T

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.registerDef


registryFile() โ€‹

registryFile(folder, name, json): void

Defined in: core/ir/datapack/tags.ts:121

Escape hatch for data types without a builder: writes json to data/<ns>/<folder>/<name>.json.

Parameters โ€‹

folder โ€‹

string

name โ€‹

string

json โ€‹

unknown

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.registryFile


report() โ€‹

report(): CostReport

Defined in: core/ir/datapack/datapack.ts:61

Static per-tick cost report: worst-case commands per tick and unbounded @e scans. Runs codegen first; call when authoring is done. helix report prints it.

Returns โ€‹

CostReport


requestClearVariant() โ€‹

requestClearVariant(structureId, fill): void

Defined in: core/ir/datapack/core.ts:231

Requests a _clear variant of a shipped structure, with fill replacing its solid cells. A conflicting fill for the same structure throws.

Parameters โ€‹

structureId โ€‹

string

fill โ€‹

ClearFill

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.requestClearVariant


resourceFile() โ€‹

resourceFile(folder, name, json): void

Defined in: core/ir/datapack/assets.ts:187

Escape hatch for resource pack files without a builder: writes json to assets/<ns>/<folder>/<name>.json. A namespaced name (minecraft:blocks) writes into that namespace instead, for files whose id is fixed, like atlases.

Parameters โ€‹

folder โ€‹

string

name โ€‹

string

json โ€‹

unknown

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.resourceFile


storage() โ€‹

storage(name): Storage

Defined in: core/ir/datapack/core.ts:206

A command storage: dp.storage("state") is <ns>:state.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

Storage

Inherited from โ€‹

DatapackEntry.storage


tag() โ€‹

tag(registry, name, spec): void

Defined in: core/ir/datapack/tags.ts:31

Registers a registry tag (block, item, entity_type...). Registering again appends. replace: true drops members from lower-priority packs.

Parameters โ€‹

registry โ€‹

string

name โ€‹

string

spec โ€‹
replace? โ€‹

boolean

values โ€‹

string[]

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.tag


template() โ€‹

template(name): Template

Defined in: core/ir/datapack/core.ts:199

A structure template for ctx.place().template(...): dp.template("cog") is <ns>:cog. When the pack ships structures, writing it fails if a template in its own namespace isn't among them (or a requested _clear variant), so a typo fails the build.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

Template

Inherited from โ€‹

DatapackEntry.template


texture() โ€‹

texture(name): Texture

Defined in: core/ir/datapack/assets.ts:232

A texture shipped in an addAssets folder, for Model: dp.texture("item/wand"). Writing the resource pack fails if no folder has its <ns>/textures/<path>.png.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

Texture

Inherited from โ€‹

DatapackEntry.texture


tick() โ€‹

tick(builder): FunctionRef

Defined in: core/ir/datapack/entry.ts:42

Append to the tick function (runs every game tick).

Parameters โ€‹

builder โ€‹

(ctx) => void

Returns โ€‹

FunctionRef

Inherited from โ€‹

DatapackEntry.tick


untag() โ€‹

untag(name, tag): void

Defined in: core/ir/datapack/functions.ts:155

Removes name from a function tag without deleting the function.

Parameters โ€‹

name โ€‹

string

tag โ€‹

FunctionTag

Returns โ€‹

void

Inherited from โ€‹

DatapackEntry.untag


useTarget() โ€‹

useTarget(target): this

Defined in: core/ir/datapack/core.ts:254

Sets the runtime target (default "vanilla").

Parameters โ€‹

target โ€‹

RuntimeTarget

Returns โ€‹

this

Inherited from โ€‹

DatapackEntry.useTarget


vanillaTexture() โ€‹

vanillaTexture(name, from, opts?): Texture

Defined in: core/ir/datapack/assets.ts:255

Copies a vanilla texture into the pack as assets/<ns>/textures/<name>.png and returns its id, e.g. dp.vanillaTexture("gui/arrow", { item: "minecraft:arrow" }, { opacity: 0.4 }). A namespaced name (minecraft:entity/minecart/minecart) replaces that texture.

Read from the client jar at MC_CLIENT_JAR, or one downloaded once into the cache, when the resource pack is written. An item with no flat icon (most blocks) fails the write.

Parameters โ€‹

name โ€‹

string

from โ€‹

{ item: string; } | { texture: string; }

opts? โ€‹
fullWidth? โ€‹

boolean

opacity? โ€‹

number

Returns โ€‹

Texture

Inherited from โ€‹

DatapackEntry.vanillaTexture


variable() โ€‹

variable(name): Score

Defined in: core/ir/datapack/functions.ts:45

A pack-wide score named name, on an objective the pack owns.

The same name returns the same score, so two callers asking for one name share it.

Parameters โ€‹

name โ€‹

string

Returns โ€‹

Score

Inherited from โ€‹

DatapackEntry.variable


writeDatapack() โ€‹

writeDatapack(outputPath, opts?): Promise<void>

Defined in: core/ir/datapack/datapack.ts:41

Writes the datapack to outputPath. Async because the disk code is imported lazily, keeping helix browser-safe.

Parameters โ€‹

outputPath โ€‹

string

opts? โ€‹
zip? โ€‹

boolean

Returns โ€‹

Promise<void>


writeResourcePack() โ€‹

writeResourcePack(outputPath): Promise<void>

Defined in: core/ir/datapack/datapack.ts:51

Writes the resource pack to outputPath, separate from writeDatapack. Async for the same reason.

Parameters โ€‹

outputPath โ€‹

string

Returns โ€‹

Promise<void>

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