Class in @minecraft/server
Extends EntityComponent
A player’s inventory.
import { EntityInventoryComponent } from '@minecraft/server';Example
Section titled “Example”import { world, type EntityInventoryComponent } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const component: EntityInventoryComponent | undefined = player.getComponent('minecraft:inventory'); if (component) { console.log(player.name, component.inventorySize); }}import { world } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const component = player.getComponent('minecraft:inventory'); if (component) { console.log(player.name, component.inventorySize); }}Properties
Section titled “Properties”typeId
Section titled “typeId”read-only
readonly typeId: "minecraft:inventory";container
Section titled “container”read-only
readonly container: Container;Types
inventorySize
Section titled “inventorySize”read-only
readonly inventorySize: number;Used by
Section titled “Used by”EntityComponentTypeMap.minecraft:inventory, EntityComponentTypeMap.inventory