Skip to content

API reference / @jsprismarine/prismarine / inventory/slotAddress

inventory/slotAddress ​

Interfaces ​

MountScreenSlots ​

Defined in: packages/prismarine/src/inventory/slotAddress.ts:241

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

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

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

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

How to read a name.

Properties ​

offset? ​

readonly optional offset?: number

Defined in: packages/prismarine/src/inventory/slotAddress.ts:399

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

role? ​

readonly optional role?: SlotRole

Defined in: packages/prismarine/src/inventory/slotAddress.ts:392

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

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 & object | { container: "block"; slot: number; }

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

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

Union Members ​

SlotAddress & object


Type Literal ​

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


SlotHolder ​

SlotHolder = { inventory: EntityInventory; kind: "player"; } | { chested: boolean; containerType: string | undefined; equippable: readonly EquippableSlot[]; inventory: EntityInventory; kind: "mob"; } | { kind: "block"; size: number; }

Defined in: packages/prismarine/src/inventory/slotAddress.ts:56

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; kind: "player"; }


Type Literal ​

{ chested: boolean; containerType: string | undefined; equippable: readonly EquippableSlot[]; inventory: EntityInventory; 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

kind ​

readonly kind: "mob"


Type Literal ​

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


SlotResolution ​

SlotResolution = { ok: true; slots: readonly HeldSlot[]; } | { ok: false; refusal: string; }

Defined in: packages/prismarine/src/inventory/slotAddress.ts:93

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

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

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

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

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

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

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, "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

kind ​

readonly kind: "mob"


mountScreenSlotsOf() ​

mountScreenSlotsOf(holder): MountScreenSlots

Defined in: packages/prismarine/src/inventory/slotAddress.ts:255

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

kind ​

"mob"

Returns ​

MountScreenSlots

Java See ​

HorseInventoryMenu.<init>


resolveSlotName() ​

resolveSlotName(slot, holder, options?): SlotResolution

Defined in: packages/prismarine/src/inventory/slotAddress.ts:448

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

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

options? ​

SlotNameOptions = {}

Returns ​

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.