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

# inventory/slotAddress

## Interfaces

### MountScreenSlots

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:241](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L241)

The container slots a mount's inventory screen shows, by the screen's three parts.

#### Properties

##### body

> `readonly` **body**: `number` \| `undefined`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:245](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L245)

Where its armor or carpet is kept, or undefined for a mount that wears neither.

##### chest

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

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:247](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L247)

Its chest slots, three rows of them, empty for a mount without a chest on.

##### saddle

> `readonly` **saddle**: `number` \| `undefined`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:243](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L243)

Where its saddle is kept, or undefined for a mount that takes none, such as a llama.

***

### SlotNameOptions

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:390](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L390)

How to read a name.

#### Properties

##### offset?

> `readonly` `optional` **offset?**: `number`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:399](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L399)

How far past the named slot to read, which is how `/loot replace … <count>` walks on.

##### role?

> `readonly` `optional` **role?**: [`SlotRole`](#slotrole)

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:392](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L392)

Which side of a copy the name is on, for the refusal. Defaults to `target`.

##### single?

> `readonly` `optional` **single?**: `boolean`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:397](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L397)

Whether a Java name must stand for exactly one slot, as `/loot replace`'s `slot` argument
must. Java refuses a wildcard there before it looks at any entity.

## Type Aliases

### HeldSlot

> **HeldSlot** = [`SlotAddress`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/index.md#slotaddress) & `object` \| \{ `container`: `"block"`; `slot`: `number`; \}

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:36](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L36)

Where one named slot is: a container slot of an entity, or a slot of a block's container.

#### Union Members

[`SlotAddress`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/index.md#slotaddress) & `object`

***

##### Type Literal

\{ `container`: `"block"`; `slot`: `number`; \}

***

### SlotHolder

> **SlotHolder** = \{ `inventory`: [`EntityInventory`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/classes/EntityInventory.md); `kind`: `"player"`; \} \| \{ `chested`: `boolean`; `containerType`: `string` \| `undefined`; `equippable`: readonly `EquippableSlot`[]; `inventory`: [`EntityInventory`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/classes/EntityInventory.md); `kind`: `"mob"`; \} \| \{ `kind`: `"block"`; `size`: `number`; \}

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:56](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L56)

What a slot name is resolved against.

- A player has a hotbar, an ender chest and a cursor, and its main hand is a hotbar slot.
- A mob's `inventory` container means what its `minecraft:inventory` `container_type` says:
  `horse` is a mount's, whose chest slots are the ones its `minecraft:equippable` does not
  claim; `inventory`, the default, is a villager's or a piglin's pocket; any other type, such as
  `minecart_chest` or `chest_boat`, is a container Java addresses with `container.N`.
- A block has the slots of its container and nothing else.

#### Union Members

##### Type Literal

\{ `inventory`: [`EntityInventory`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/classes/EntityInventory.md); `kind`: `"player"`; \}

***

##### Type Literal

\{ `chested`: `boolean`; `containerType`: `string` \| `undefined`; `equippable`: readonly `EquippableSlot`[]; `inventory`: [`EntityInventory`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/classes/EntityInventory.md); `kind`: `"mob"`; \}

###### chested

> `readonly` **chested**: `boolean`

Whether a mount carries a chest (`minecraft:is_chested`). Its chest slots are there
only then, as Java's `AbstractChestedHorse` answers `horse.N` only with a chest on.

###### containerType

> `readonly` **containerType**: `string` \| `undefined`

The active `minecraft:inventory`'s `container_type`, or undefined when it has none.

###### equippable

> `readonly` **equippable**: readonly `EquippableSlot`[]

The slots the active `minecraft:equippable` lists, in its order.

###### inventory

> `readonly` **inventory**: [`EntityInventory`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/classes/EntityInventory.md)

###### kind

> `readonly` **kind**: `"mob"`

***

##### Type Literal

\{ `kind`: `"block"`; `size`: `number`; \}

***

### SlotResolution

> **SlotResolution** = \{ `ok`: `true`; `slots`: readonly [`HeldSlot`](#heldslot)[]; \} \| \{ `ok`: `false`; `refusal`: `string`; \}

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:93](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L93)

The slots a name resolved to on one holder, or the sentence that says why it did not.

***

### SlotRole

> **SlotRole** = `"source"` \| `"target"`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:90](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L90)

Which side of a copy a refusal is about, which is the word Java's messages use.

## Variables

### SLOT\_OFFSET\_LIMIT

> `const` **SLOT\_OFFSET\_LIMIT**: `number`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:194](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L194)

How many slots past the one a name names an offset can reach: one more than Java's largest slot
number, `horse.14`. A larger offset resolves on no holder, since no container this server
builds has that many slots either, so `/loot replace` with a huge count stops here.

## Functions

### currentJavaSlotNames()

> **currentJavaSlotNames**(): readonly `string`[]

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:197](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L197)

The Java slot names Java 26.3 has, leaving out the older spellings this server still reads.

#### Returns

readonly `string`[]

***

### javaSlotIds()

> **javaSlotIds**(`name`): readonly `number`[] \| `undefined`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:184](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L184)

The numbers a Java slot name stands for.

#### Parameters

##### name

`string`

A name such as `container.5`, `armor.*` or `weapon`.

#### Returns

readonly `number`[] \| `undefined`

The numbers in Java's order, or undefined for a name Java does not have.

***

### javaSlotNames()

> **javaSlotNames**(): readonly `string`[]

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:187](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L187)

Every Java slot name this server reads, for a command's suggestions.

#### Returns

readonly `string`[]

***

### mobSlotHolder()

> **mobSlotHolder**(`entity`): `object`

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:77](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L77)

A mob as a slot holder: its inventory, what its `minecraft:inventory` container is for, what
its `minecraft:equippable` lists, and whether it carries a chest.

#### Parameters

##### entity

`Pick`\<[`DataEntity`](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/data/DataEntity/classes/DataEntity.md), `"body"` \| `"instance"`\>

#### Returns

##### chested

> `readonly` **chested**: `boolean`

Whether a mount carries a chest (`minecraft:is_chested`). Its chest slots are there
only then, as Java's `AbstractChestedHorse` answers `horse.N` only with a chest on.

##### containerType

> `readonly` **containerType**: `string` \| `undefined`

The active `minecraft:inventory`'s `container_type`, or undefined when it has none.

##### equippable

> `readonly` **equippable**: readonly `EquippableSlot`[]

The slots the active `minecraft:equippable` lists, in its order.

##### inventory

> `readonly` **inventory**: [`EntityInventory`](https://jsprismarine.dev/api/@jsprismarine/prismarine/inventory/EntityInventory/classes/EntityInventory.md)

##### kind

> `readonly` **kind**: `"mob"`

***

### mountScreenSlotsOf()

> **mountScreenSlotsOf**(`holder`): [`MountScreenSlots`](#mountscreenslots)

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:255](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L255)

The `inventory` container slots a mount's screen shows: its saddle slot, its armor or carpet
slot, and the chest slots it has with a chest on, as Java's `HorseInventoryMenu` lays them out.

#### Parameters

##### holder

###### chested

`boolean`

Whether a mount carries a chest (`minecraft:is_chested`). Its chest slots are there
only then, as Java's `AbstractChestedHorse` answers `horse.N` only with a chest on.

###### containerType

`string` \| `undefined`

The active `minecraft:inventory`'s `container_type`, or undefined when it has none.

###### equippable

readonly `EquippableSlot`[]

The slots the active `minecraft:equippable` lists, in its order.

###### inventory

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

###### kind

`"mob"`

#### Returns

[`MountScreenSlots`](#mountscreenslots)

#### Java See

HorseInventoryMenu.&lt;init&gt;

***

### resolveSlotName()

> **resolveSlotName**(`slot`, `holder`, `options?`): [`SlotResolution`](#slotresolution)

Defined in: [packages/prismarine/src/inventory/slotAddress.ts:448](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/inventory/slotAddress.ts#L448)

Resolves a slot name against one holder.

#### Parameters

##### slot

Java's name (`container.3`, `armor.*`), or Bedrock's group with its index
  (`slot.hotbar` and 3). A name that starts with `slot.` is Bedrock's; Java has none.

###### index?

`number`

###### name

`string`

##### holder

[`SlotHolder`](#slotholder)

The player, the mob or the block the name is read on.

##### options?

[`SlotNameOptions`](#slotnameoptions) = `{}`

#### Returns

[`SlotResolution`](#slotresolution)

The slots the name means there, in Java's order for a wildcard, or a refusal written
  as a sentence a player can read: Java's own for an unknown name or a slot the holder lacks,
  Bedrock's for an index outside its group.
