@jsprismarine/prismarine
Version:
Dedicated Minecraft Bedrock Edition server written in TypeScript
63 lines • 1.84 kB
TypeScript
import { default as Air } from '../block/blocks/Air';
import { default as ContainerEntry } from './ContainerEntry';
import { Item } from '../item/Item';
/**
* Inventory.
*/
export default class Inventory {
/**
* Number of slots.
* @private
*/
private readonly slots;
/**
* <Slot number, Item in the slot>
* @private
*/
private readonly content;
constructor(slots?: number, items?: ContainerEntry[]);
/**
* Get window id.
* @todo: implement this.
*/
getId(): number;
/**
* Adds an array of items into the inventory.
* @param {ContainerEntry[]} [items=[]] - the entires.
*/
setItems(items?: ContainerEntry[]): void;
/**
* Returns all the items inside the inventory.
* @param {boolean} [includeAir=false] - if air should be accounted for.
* @returns {ContainerEntry[]} the entries.
*/
getItems(includeAir?: boolean): ContainerEntry[];
/**
* Sets an item in the inventory content.
* @param {number} slot - the slot.
* @param {ContainerEntry} item - the item.
*/
setItem(slot: number, item: ContainerEntry): boolean;
/**
* Add an item to the first available slot
* @param {ContainerEntry} item - the item.
*/
addItem(item: ContainerEntry): void;
/**
* Returns the item in the slot.
* @param {number} slot - the slot.
* @returns {Item | Air} the item in the slot.
*/
getItem(slot: number): Item;
/**
* Removes an item from a slot and returns it.
* @param {number} slot - the slot.
*/
removeItem(slot: number): Air | ContainerEntry | undefined;
/**
* Returns the slot count of the inventory.
* @returns {number} the slot count.
*/
getSlotCount(): number;
}
//# sourceMappingURL=Inventory.d.ts.map