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

helix / ItemSlotRef

Class: ItemSlotRef โ€‹

Defined in: core/frontend/nodes/item-slot.ts:26

One item slot on an entity or a container block, like an AttributeRef for items. Checks are detectors for ctx.if; changes emit into the ambient context.

const hand = Selector.self().slot(Slot.MAINHAND); ctx.if(hand.has(Item.CROSSBOW), () => hand.enchant(fireBolts));

Extended by โ€‹

Constructors โ€‹

Constructor โ€‹

new ItemSlotRef(on, slot): ItemSlotRef

Defined in: core/frontend/nodes/item-slot.ts:27

Parameters โ€‹

on โ€‹

PosValue | Selector

slot โ€‹

SlotRange

Returns โ€‹

ItemSlotRef

Properties โ€‹

on โ€‹

readonly on: PosValue | Selector

Defined in: core/frontend/nodes/item-slot.ts:28


slot โ€‹

readonly slot: SlotRange

Defined in: core/frontend/nodes/item-slot.ts:29

Methods โ€‹

apply() โ€‹

apply(...fns): this

Defined in: core/frontend/nodes/item-slot.ts:54

Runs these loot functions on the item, in order.

Parameters โ€‹

fns โ€‹

...LootFunction[]

Returns โ€‹

this


enchant() โ€‹

enchant(enchantment, level?): this

Defined in: core/frontend/nodes/item-slot.ts:75

Sets enchantment to level on the item; 0 removes it.

Parameters โ€‹

enchantment โ€‹

Enchantment

level? โ€‹

number = 1

Returns โ€‹

this


has() โ€‹

has(item): Detector

Defined in: core/frontend/nodes/item-slot.ts:33

Holds when the slot has item.

Parameters โ€‹

item โ€‹

ItemLike

Returns โ€‹

Detector


lacks() โ€‹

lacks(item): Detector

Defined in: core/frontend/nodes/item-slot.ts:39

Holds when the slot doesn't have item.

Parameters โ€‹

item โ€‹

ItemLike

Returns โ€‹

Detector


modify() โ€‹

modify(modifier, ctx?): this

Defined in: core/frontend/nodes/item-slot.ts:45

Runs modifier on the item. An unregistered ItemModifier is written into the command.

Parameters โ€‹

modifier โ€‹

ItemModifier | ItemModifierRef

ctx? โ€‹

FunctionContext

Returns โ€‹

this


replace() โ€‹

replace(source, ctx?): this

Defined in: core/frontend/nodes/item-slot.ts:61

Puts source in the slot: an item, or a copy of what another slot holds.

Parameters โ€‹

source โ€‹

ItemLike | ItemSlotRef

ctx? โ€‹

FunctionContext

Returns โ€‹

this

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