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
readonlyrecipeId:string
Defined in: packages/prismarine/src/inventory/workstationTakes.ts:112
The recipe the stack was made by.
spent
readonlyspent: readonlyItem[]
Defined in: packages/prismarine/src/inventory/workstationTakes.ts:114
The stacks the craft spent from, as they were before it.
stack
readonlystack: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
readonlycost:number
Defined in: packages/prismarine/src/inventory/workstationTakes.ts:49
Experience levels spent.
stack
readonlystack: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<typeoftakeFromAnvil>[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
constCARTOGRAPHY_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
constCARTOGRAPHY_MAP:0=0
Defined in: packages/prismarine/src/inventory/workstationTakes.ts:237
The cartography table's map slot.
SMITHING_INPUTS
constSMITHING_INPUTS:3=3
Defined in: packages/prismarine/src/inventory/workstationTakes.ts:201
The smithing table's template, base and addition slots.
STONECUTTER_DATA_RECIPE
constSTONECUTTER_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
constSTONECUTTER_INPUT:0=0
Defined in: packages/prismarine/src/inventory/workstationTakes.ts:118
The stonecutter's input slot.
WORKSTATION_ITEM
constWORKSTATION_ITEM:0=0
Defined in: packages/prismarine/src/inventory/workstationTakes.ts:33
The slot the item being worked on sits in.
WORKSTATION_MATERIAL
constWORKSTATION_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
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
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
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
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): readonlyRecipeMatch[]
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
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
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
open
registry
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
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
open
row
number
registry
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
content
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
content
Returns
StationCraft | undefined
Undefined when the result slot holds nothing.
Java See
StonecutterMenu$2.onTake