API reference / @jsprismarine/prismarine / crafting/loom
crafting/loom
Type Aliases
LoomWindow
LoomWindow =
Pick<OpenBlockContainer,"inputs"|"loomSelection">
Defined in: packages/prismarine/src/crafting/loom.ts:36
What the loom's rules read and write of an open loom: its slots and the pattern picked.
Variables
LOOM_BANNER
constLOOM_BANNER:0=0
Defined in: packages/prismarine/src/crafting/loom.ts:15
The loom's banner slot.
LOOM_DYE
constLOOM_DYE:1=1
Defined in: packages/prismarine/src/crafting/loom.ts:18
The loom's dye slot.
LOOM_MAX_LAYERS
constLOOM_MAX_LAYERS:6=6
Defined in: packages/prismarine/src/crafting/loom.ts:27
The most layers a banner holds; a banner with this many takes no more at a loom.
Java See
LoomMenu.slotsChanged
LOOM_PATTERN
constLOOM_PATTERN:2=2
Defined in: packages/prismarine/src/crafting/loom.ts:21
The loom's banner pattern item slot.
Functions
isLoomBanner()
isLoomBanner(
item):boolean
Defined in: packages/prismarine/src/crafting/loom.ts:45
Whether a stack may go into the loom's banner slot: any banner.
Parameters
item
Returns
boolean
Java See
LoomMenu$3.mayPlace
isLoomPattern()
isLoomPattern(
item):boolean
Defined in: packages/prismarine/src/crafting/loom.ts:60
Whether a stack may go into the loom's pattern slot: a banner pattern item.
Parameters
item
Returns
boolean
Java Source
LoomMenu.isPatternItem
loomDyeColorOf()
loomDyeColorOf(
item):string|undefined
Defined in: packages/prismarine/src/crafting/loom.ts:51
The color a dye paints a layer, or undefined for a stack that is no loom dye.
Parameters
item
Returns
string | undefined
Java Source
LoomMenu.isDyeItem
loomPatterns()
loomPatterns(
content,patternItem): readonlystring[]
Defined in: packages/prismarine/src/crafting/loom.ts:79
The patterns the loom offers, in the order it lists them: those of the banner pattern item in its slot, or with none there, every pattern that needs no item.
Parameters
content
The server's content, whose banner_pattern tags list the patterns.
patternItem
Item | null
The banner pattern item in the loom, or null.
Returns
readonly string[]
Java See
LoomMenu.getSelectablePatterns(Lnet/minecraft/world/item/ItemStack;)Ljava/util/List;
loomPreview()
loomPreview(
open):Item|undefined
Defined in: packages/prismarine/src/crafting/loom.ts:160
What the loom's result slot holds now: its slots with the picked pattern.
Parameters
open
The open loom.
Returns
Item | undefined
loomResult()
loomResult(
inputs,pattern):Item|undefined
Defined in: packages/prismarine/src/crafting/loom.ts:92
The banner the loom makes of its slots with one pattern: one of the banner, with the pattern added on top in the dye's color.
Parameters
inputs
readonly (Item | null)[]
The loom's slots: the banner, the dye and the pattern item.
pattern
string
The Java pattern to add.
Returns
Item | undefined
Undefined when the banner or the dye is missing, or the banner holds as many layers as it can.
Java See
LoomMenu.setupResultSlot
loomResultNamed()
loomResultNamed(
inputs,content,pattern):Item|undefined
Defined in: packages/prismarine/src/crafting/loom.ts:113
The banner the loom makes of its slots with a pattern the client names, for a client that names the pattern rather than picking one: only a pattern the loom offers for the item in its slot.
Parameters
inputs
readonly (Item | null)[]
The loom's slots: the banner, the dye and the pattern item.
content
The server's content.
pattern
string
The Java pattern the client named.
Returns
Item | undefined
Undefined when the loom does not offer the pattern or makes nothing of its slots.
pickLoomPattern()
pickLoomPattern(
open,button):boolean
Defined in: packages/prismarine/src/crafting/loom.ts:148
Picks one of the patterns the loom offers, by its place among them.
Parameters
open
button
number
Returns
boolean
Whether the loom took the pick.
Java Source
LoomMenu.clickMenuButton
refreshLoom()
refreshLoom(
open,content):void
Defined in: packages/prismarine/src/crafting/loom.ts:128
Works out which patterns the loom offers and which stays picked, after its slots changed: a single offer is picked at once, and a picked pattern the loom still offers stays picked. A banner with as many layers as it holds has nothing picked.
Parameters
open
The open loom, whose window keeps the slots and the pick.
content
The server's content.
Returns
void
Java Source
LoomMenu.slotsChanged
spendLoomInputs()
spendLoomInputs(
open):void
Defined in: packages/prismarine/src/crafting/loom.ts:167
Takes one banner and one dye out of the loom's slots, which every result spends; the pattern item stays.
Parameters
open
Returns
void
takeLoomResult()
takeLoomResult(
open,content):Item|undefined
Defined in: packages/prismarine/src/crafting/loom.ts:182
Takes the loom's result: spends a banner and a dye, and clears the pick when either runs out.
Parameters
open
The open loom.
content
The server's content.
Returns
Item | undefined
The banner made, or undefined when the result slot is empty.
Java See
LoomMenu$6.onTake