Skip to content

API reference / @jsprismarine/prismarine / inventory/workstationTakes

inventory/workstationTakes ​

Interfaces ​

StationCraft ​

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:108

What a stonecutter or a smithing table made, and the recipe it made it by.

Properties ​

recipeId ​

readonly recipeId: string

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:112

The recipe the stack was made by.

spent ​

readonly spent: readonly Item[]

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:114

The stacks the craft spent from, as they were before it.

stack ​

readonly stack: Item

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:110

The finished stack, which the client takes out of the result slot.


WorkstationCraft ​

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:45

What a workstation craft produced, and what it cost.

Properties ​

cost ​

readonly cost: number

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:49

Experience levels spent.

stack ​

readonly stack: Item

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:47

The finished stack, which the client takes out of the result slot.

Type Aliases ​

CartographyLevel ​

CartographyLevel = Pick<Level, "getMap" | "addMap">

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:246

The saved maps a cartography table reads, and saves a zoomed or locked copy in.


WorkstationPlayer ​

WorkstationPlayer = EnchantingPlayer & KeyedPlayerHolder & Parameters<typeof takeFromAnvil>[1]

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:42

The player at a workstation: who is shown the enchanting table's rows, whose seed draws them, who is told of an enchanting, and whose experience a craft spends.

Variables ​

CARTOGRAPHY_ADDITION ​

const CARTOGRAPHY_ADDITION: 1 = 1

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:240

The cartography table's second slot: paper, an empty map or a glass pane.


CARTOGRAPHY_MAP ​

const CARTOGRAPHY_MAP: 0 = 0

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:237

The cartography table's map slot.


SMITHING_INPUTS ​

const SMITHING_INPUTS: 3 = 3

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:201

The smithing table's template, base and addition slots.


STONECUTTER_DATA_RECIPE ​

const STONECUTTER_DATA_RECIPE: 0 = 0

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:121

The stonecutter screen's one property: the picked recipe's place in the list, or -1 for none.


STONECUTTER_INPUT ​

const STONECUTTER_INPUT: 0 = 0

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:118

The stonecutter's input slot.


WORKSTATION_ITEM ​

const WORKSTATION_ITEM: 0 = 0

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:33

The slot the item being worked on sits in.


WORKSTATION_MATERIAL ​

const WORKSTATION_MATERIAL: 1 = 1

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:36

The slot the material sits in: an enchanting table's lapis, an anvil's second item.

Functions ​

cartographyResultOf() ​

cartographyResultOf(open, level): Item | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:274

The stack a cartography table's result slot holds: the map zoomed out one step with paper, while it is not locked and not at the widest zoom; locked with a glass pane, while it is not locked already; or cloned onto an empty map, two maps in all. The zoom and the lock are marked on the stack and made as it is taken, when the level saves the new map under an id of its own.

Parameters ​

open ​

Pick<OpenBlockContainer, "inputs">

level ​

CartographyLevel

The level the map is saved in.

Returns ​

Item | undefined

Undefined when the slots make nothing, or the map has no saved data.

Java Source ​

CartographyTableMenu.setupResultSlot


cartographySlotTakes() ​

cartographySlotTakes(slot, item): boolean

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:259

Whether a cartography table's slot takes a stack: the map slot a map with saved data's id, the second slot paper, an empty map or a glass pane.

Parameters ​

slot ​

number

The slot: CARTOGRAPHY_MAP or CARTOGRAPHY_ADDITION.

item ​

Item

Returns ​

boolean

Java Source ​

CartographyTableMenu$3.mayPlace

Java Source ​

CartographyTableMenu$4.mayPlace


pickStonecutterRecipe() ​

pickStonecutterRecipe(open, content, index): boolean

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:154

Picks a stonecutter recipe by its place in the input's list, as a Java client's button does.

Parameters ​

open ​

Pick<OpenBlockContainer, "inputs" | "pickedRecipe">

content ​

ServerContent

index ​

number

Returns ​

boolean

Whether the pick changed the result: false for the recipe already picked or a place the list does not have.

Java Source ​

StonecutterMenu.clickMenuButton


smithingResultOf() ​

smithingResultOf(open, content): { match: RecipeMatch; stack: Item; } | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:208

The stack the smithing table's result slot holds: what the first recipe its three slots match makes of them, or undefined when they match none.

Parameters ​

open ​

Pick<OpenBlockContainer, "inputs">

content ​

ServerContent

Returns ​

{ match: RecipeMatch; stack: Item; } | undefined

Java See ​

SmithingMenu.createResult


stonecutterInputChanged() ​

stonecutterInputChanged(open, before): boolean

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:172

Forgets the stonecutter's pick when the kind of item in its input changed, as vanilla lists the recipes again with none picked.

Parameters ​

open ​

Pick<OpenBlockContainer, "inputs" | "pickedRecipe">

before ​

Item | null

The input before the change.

Returns ​

boolean

Whether the pick was forgotten.

Java Source ​

StonecutterMenu.slotsChanged


stonecutterRecipesFor() ​

stonecutterRecipesFor(open, content): readonly RecipeMatch[]

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:128

The stonecutter recipes the stack in its input slot is cut by, in the order a Java client lists them and picks one by.

Parameters ​

open ​

Pick<OpenBlockContainer, "inputs">

content ​

ServerContent

Returns ​

readonly RecipeMatch[]

Java See ​

SelectableRecipe$SingleInputSet.selectByInput


stonecutterResultOf() ​

stonecutterResultOf(open, content): Item | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:136

The stack the stonecutter's result slot holds: what the picked recipe makes of the input, or undefined while no recipe is picked or the pick is not one of the input's.

Parameters ​

open ​

Pick<OpenBlockContainer, "inputs" | "pickedRecipe">

content ​

ServerContent

Returns ​

Item | undefined

Java See ​

StonecutterMenu.setupResultSlot


takeAnvilResult() ​

takeAnvilResult(player, open, registry, name?, infinite?): WorkstationCraft | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:96

Takes an anvil's result: the two inputs combined, renamed to whatever the player typed.

Parameters ​

player ​

WorkstationPlayer

open ​

OpenBlockContainer

registry ​

EnchantmentRegistry

name? ​

string

infinite? ​

boolean = false

Whether the player has infinite materials, who pays no levels.

Returns ​

WorkstationCraft | undefined

Undefined when there is nothing in the base slot, the combination does nothing, or the player cannot pay.


takeCartographyResult() ​

takeCartographyResult(open, level): Item | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:301

Takes a cartography table's result: one of each slot goes into it, and a zoomed or locked map is saved under a new id.

Parameters ​

open ​

Pick<OpenBlockContainer, "inputs">

level ​

CartographyLevel

The level the map is saved in.

Returns ​

Item | undefined

Undefined when the slots make nothing.

Java See ​

CartographyTableMenu$5.onTake


takeEnchantRow() ​

takeEnchantRow(player, open, row, registry, infinite?): WorkstationCraft | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:63

Takes one of an enchanting table's three rows, by its place from 0.

takeEnchantingRow is what charges for it and rerolls the seed, so a caller cannot enchant twice from one draw, and it redraws the row from the stored seed rather than trusting the client's number for anything but which of the three.

Parameters ​

player ​

WorkstationPlayer

open ​

OpenBlockContainer

row ​

number

registry ​

EnchantmentRegistry

infinite? ​

boolean = false

Whether the player has infinite materials, so needs no levels for the row.

Returns ​

WorkstationCraft | undefined

Undefined when there is no item in the table, the row is empty, or the player cannot pay - each of which is a refusal rather than a free enchantment.


takeSmithingResult() ​

takeSmithingResult(open, content): StationCraft | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:222

Takes the smithing table's result: one of each of the template, the base and the addition goes into it.

Parameters ​

open ​

OpenBlockContainer

content ​

ServerContent

Returns ​

StationCraft | undefined

Undefined when the slots make nothing.

Java See ​

SmithingMenu.onTake


takeStonecutterResult() ​

takeStonecutterResult(open, content): StationCraft | undefined

Defined in: packages/prismarine/src/inventory/workstationTakes.ts:188

Takes the stonecutter's result: one of the input is cut into the picked recipe's stack. The pick lasts while the input does.

Parameters ​

open ​

OpenBlockContainer

content ​

ServerContent

Returns ​

StationCraft | undefined

Undefined when the result slot holds nothing.

Java See ​

StonecutterMenu$2.onTake