[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / world/cooking

# world/cooking

## Interfaces

### FurnaceExperience

Defined in: [packages/prismarine/src/world/cooking.ts:152](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L152)

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

#### Properties

##### data

> `readonly` **data**: [`BlockEntityData`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#blockentitydata)

Defined in: [packages/prismarine/src/world/cooking.ts:156](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L156)

The block entity's record with its tally cleared.

##### payouts

> `readonly` **payouts**: readonly `number`[]

Defined in: [packages/prismarine/src/world/cooking.ts:154](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L154)

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

***

### FurnaceTick

Defined in: [packages/prismarine/src/world/cooking.ts:254](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L254)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L258)

The block variant to use after the fuel timer advances.

##### changedSlots

> `readonly` **changedSlots**: readonly `number`[]

Defined in: [packages/prismarine/src/world/cooking.ts:260](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L260)

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

##### tags

> `readonly` **tags**: [`NBTTagCompound`](https://jsprismarine.dev/api/@jsprismarine/nbt/classes/NBTTagCompound.md)

Defined in: [packages/prismarine/src/world/cooking.ts:256](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L256)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L206)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L203)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L200)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L110)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L143)

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`](https://jsprismarine.dev/api/@jsprismarine/prismarine/utils/Random/index.md#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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L75)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L214)

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

#### Parameters

##### source

[`NBTTagCompound`](https://jsprismarine.dev/api/@jsprismarine/nbt/classes/NBTTagCompound.md) \| [`Furnace`](https://jsprismarine.dev/api/@jsprismarine/prismarine/blockentity/BlockEntities/classes/Furnace.md)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L67)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L104)

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`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/ServerContent/index.md#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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L85)

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

#### Parameters

##### content

[`ServerContent`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/ServerContent/index.md#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`](#furnaceexperience) \| `undefined`

Defined in: [packages/prismarine/src/world/cooking.ts:173](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L173)

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`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/ServerContent/index.md#servercontent)

The recipes the tally names.

##### data

[`BlockEntityData`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/world/adapter/index.md#blockentitydata)

The furnace's block entity record.

##### random

[`Random`](https://jsprismarine.dev/api/@jsprismarine/prismarine/utils/Random/index.md#random)

The chance of each recipe's extra point.

#### Returns

[`FurnaceExperience`](#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`](#furnacetick) \| `undefined`

Defined in: [packages/prismarine/src/world/cooking.ts:299](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/cooking.ts#L299)

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

#### Parameters

##### content

[`ServerContent`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/ServerContent/index.md#servercontent)

The item and recipe registries this world is running.

##### furnace

[`BlockEntity`](https://jsprismarine.dev/api/@jsprismarine/prismarine/blockentity/BlockEntity/classes/BlockEntity.md)

The block entity carrying its current burn and cook timers.

##### identifier

`string`

The block state at the block entity's position.

#### Returns

[`FurnaceTick`](#furnacetick) \| `undefined`

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