Skip to content

API reference / @jsprismarine/prismarine / world/cooking

world/cooking ​

Interfaces ​

FurnaceExperience ​

Defined in: packages/prismarine/src/world/cooking.ts:152

What a player taking from a furnace's result slot is paid, and the record left behind.

Properties ​

data ​

readonly data: BlockEntityData

Defined in: packages/prismarine/src/world/cooking.ts:156

The block entity's record with its tally cleared.

payouts ​

readonly payouts: readonly number[]

Defined in: packages/prismarine/src/world/cooking.ts:154

One payout per recipe the furnace finished, each for its own ExperienceOrb.award.


FurnaceTick ​

Defined in: packages/prismarine/src/world/cooking.ts:254

One cooker update and the block identifier that represents its resulting burn state.

Properties ​

blockIdentifier ​

readonly blockIdentifier: string

Defined in: packages/prismarine/src/world/cooking.ts:258

The block variant to use after the fuel timer advances.

changedSlots ​

readonly changedSlots: readonly number[]

Defined in: packages/prismarine/src/world/cooking.ts:260

The input, fuel, and output slots whose stacks changed, in slot order; empty for none.

tags ​

readonly tags: NBTTagCompound

Defined in: packages/prismarine/src/world/cooking.ts:256

The complete block entity after its timers and inventory advance.

Variables ​

FURNACE_DATA_BURN_DURATION ​

const FURNACE_DATA_BURN_DURATION: 2 = 2

Defined in: packages/prismarine/src/world/cooking.ts:206

The property holding what that fuel started with, which the flame is a fraction of.


FURNACE_DATA_BURN_REMAINING ​

const FURNACE_DATA_BURN_REMAINING: 1 = 1

Defined in: packages/prismarine/src/world/cooking.ts:203

The property holding how much of the burning fuel is left, which is the flame's height.


FURNACE_DATA_COOK_TICKS ​

const FURNACE_DATA_COOK_TICKS: 0 = 0

Defined in: packages/prismarine/src/world/cooking.ts:200

The ContainerSetDataPacket property a cooking screen draws its progress arrow from: how many ticks the current item has cooked.

The three ids are the furnace screen's own, and the packet documents that an id means whatever the open container says it means. A client divides this by a cook total it holds itself - 200 ticks for a furnace, 100 for a blast furnace or smoker - rather than by the CookTimeTotal the block entity carries, so the total is not sent.


FURNACE_RESULT_SLOT ​

const FURNACE_RESULT_SLOT: 2 = 2

Defined in: packages/prismarine/src/world/cooking.ts:110

The furnace's result slot, which Java's FurnaceResultSlot pays experience out of.

Functions ​

cookingExperience() ​

cookingExperience(count, experience, random): number

Defined in: packages/prismarine/src/world/cooking.ts:143

The experience a number of finished cooks of one recipe pays: the whole points, and one more with the chance of the fraction left over, in Java's float arithmetic.

Parameters ​

count ​

number

How many times the recipe finished.

experience ​

number

The recipe's experience.

random ​

Random

The chance of the extra point.

Returns ​

number

The points, for one ExperienceOrb.award.

Java Source ​

AbstractFurnaceBlockEntity.createExperience


cookingStationOf() ​

cookingStationOf(identifier): "smelting" | "blasting" | "smoking" | undefined

Defined in: packages/prismarine/src/world/cooking.ts:75

The recipes a furnace, blast furnace or smoker cooks, by its block, lit or not.

Parameters ​

identifier ​

string

The block's identifier.

Returns ​

"smelting" | "blasting" | "smoking" | undefined

The station, or undefined for a block that is no furnace.


furnaceScreenData() ​

furnaceScreenData(source): ReadonlyMap<number, number>

Defined in: packages/prismarine/src/world/cooking.ts:214

What a cooking screen has to be told after a tick, by property id.

Parameters ​

source ​

NBTTagCompound | Furnace

The current furnace entity or its serialized block entity.

Returns ​

ReadonlyMap<number, number>

The three furnace properties, for a caller to send to whoever is watching.


isCookingStation() ​

isCookingStation(identifier): boolean

Defined in: packages/prismarine/src/world/cooking.ts:67

Whether a block is a furnace, blast furnace or smoker, lit or not.

Parameters ​

identifier ​

string

The block's identifier.

Returns ​

boolean


isFurnaceFuel() ​

isFurnaceFuel(content, identifier): boolean

Defined in: packages/prismarine/src/world/cooking.ts:104

Whether an item burns in a furnace: whether its minecraft:cooking_fuel gives it a burn time, which is what a furnace's fuel slot asks of an item a hopper offers it.

Parameters ​

content ​

ServerContent

The server's content, whose item types carry the burn times.

identifier ​

string

The item's Bedrock identifier.

Returns ​

boolean

Java See ​

AbstractFurnaceBlockEntity.canPlaceItem


stationCooks() ​

stationCooks(content, station, item): boolean

Defined in: packages/prismarine/src/world/cooking.ts:85

Whether a station has a recipe that cooks an item: what a shift-click puts in its input slot.

Parameters ​

content ​

ServerContent

The server's content, whose recipes are read.

station ​

string

The station's block identifier, lit or not.

item ​

The item, by its Bedrock identifier and data.

identifier ​

string

meta ​

number

Returns ​

boolean

Java See ​

AbstractFurnaceMenu.canSmelt


takeFurnaceExperience() ​

takeFurnaceExperience(content, data, random): FurnaceExperience | undefined

Defined in: packages/prismarine/src/world/cooking.ts:173

Pays out everything a furnace has cooked since it last paid, as Java does when a player takes any part of the result stack.

A recipe the server no longer knows pays nothing, as Java's RecipeManager.byKey lookup skips it, and the tally is cleared either way.

Parameters ​

content ​

ServerContent

The recipes the tally names.

data ​

BlockEntityData

The furnace's block entity record.

random ​

Random

The chance of each recipe's extra point.

Returns ​

FurnaceExperience | undefined

The payouts and the cleared record, or undefined when the furnace owes nothing.

Java Source ​

AbstractFurnaceBlockEntity.getRecipesToAwardAndPopExperience

Java See ​

RecipeManager.byKey


tickFurnace() ​

tickFurnace(content, furnace, identifier): FurnaceTick | undefined

Defined in: packages/prismarine/src/world/cooking.ts:299

Advances one active furnace-style block entity by a game tick.

Parameters ​

content ​

ServerContent

The item and recipe registries this world is running.

furnace ​

BlockEntity

The block entity carrying its current burn and cook timers.

identifier ​

string

The block state at the block entity's position.

Returns ​

FurnaceTick | undefined

Updated tags and lit variant, or undefined for a non-cooking block.