Appearance
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 โ
slot โ
Returns โ
ItemSlotRef
Properties โ
on โ
Defined in: core/frontend/nodes/item-slot.ts:28
slot โ
readonlyslot: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 โ
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 โ
Returns โ
lacks() โ
lacks(
item):Detector
Defined in: core/frontend/nodes/item-slot.ts:39
Holds when the slot doesn't have item.
Parameters โ
item โ
Returns โ
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? โ
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? โ
Returns โ
this