import type { ExecuteCommand } from '../commands/index.js'; import type { SandstoneCore } from '../core/index.js'; import type { ConditionClass } from './abstractClasses.js'; import { SelectorPickClass } from './abstractClasses.js'; import type { DataPointClass } from './Data.js'; import type { Score } from './Score.js'; import { SelectorClass } from './Selector.js'; export type UUIDinNumber = [number, number, number, number]; export type UUIDinScore = [Score, Score, Score, Score]; export type UUIDSource = string | UUIDinNumber | UUIDinScore | SelectorPickClass | DataPointClass; export type UUIDOptions = { /** Can set source types for the UUID that you did not set in `source`. */ sources?: { /** * Four `Score`'s representing the UUID. * * Options: * - `true` will automatically generate and set scores. If UUID is constructed within the context of a mcfunction commands will be called in-place, otherwise the commands will be added to __init__. * - `[UUIDinScore]` will automatically set the scores with the above rules. * - `UUIDinScore` will assume the UUID is already set to these scores. */ scores?: true | [UUIDinScore] | UUIDinScore; /** * `DataPoint` representing the UUID. * * Options: * - `true` will automatically generate and set a data point. If UUID is constructed within the context of a mcfunction the command will be called in-place, otherwise the command will be added to __init__. * - `[DataPointClass]` will automatically set the data point with the above rules. * - `DataPointClass` will assume the UUID is already set to these scores. */ data?: true | [DataPointClass] | DataPointClass; /** Selector for the entity with the UUID. If `known` is set this will go unused. */ selector?: SelectorClass; }; }; export declare class UUIDClass implements ConditionClass, SelectorPickClass { protected core: SandstoneCore; readonly __textComponentClassBrand: true; readonly __conditionClassBrand: true; /** * Phantom brand property for TypeScript type discrimination. * Uses `boolean` for player since a UUID can reference any entity type. */ readonly __selectorPickBrand: { single: true; player: boolean; }; readonly primarySource: PrimarySource; known: PrimarySource extends 'known' ? UUIDinNumber : UUIDinNumber | undefined; scores: PrimarySource extends 'scores' ? UUIDinScore : UUIDinScore | undefined; data: PrimarySource extends 'data' ? DataPointClass : DataPointClass | undefined; selector: PrimarySource extends 'selector' ? SelectorClass : SelectorClass | undefined; /** * * @param _source A primary source for the UUID. Either a UUID string, a UUID integer array, 4 scores set to the UUID, a selector, or a Data Point set to the UUID. */ constructor(core: SandstoneCore, _source: UUIDSource, options?: UUIDOptions); /** * Converts a string UUID to an integer array * @param uuid A UUID in string form */ stringToArray(uuid: string): UUIDinNumber; /** * Converts an integer array to a string UUID * @param array Optional. An integer array. Defaults to contained UUID (known; this does not work at pack runtime) */ arrayToString(array?: UUIDinNumber): `${string}-${string}-${string}-${string}`; setKnown(uuid: UUIDinNumber): this; setScores(scores?: UUIDinScore | [UUIDinScore]): this; setData(data?: DataPointClass | DataPointClass[]): this; /** Selector for the entity with the UUID. If `known` is set this will go unused. */ setSelector(selector: SelectorClass): this; /** * Converts the UUID to a string at runtime using guuid and caches it in storage. * * The converted string UUID is stored in `__sandstone:uuid_cache` indexed by a unique key: * - For scores source: indexed by the first score value (most significant part of UUID) * - For data source: indexed by the stringified UUID int array * * After calling this, use `.execute` to run commands as the entity. * * @example * ```ts * MCFunction('use_stored_uuid', () => { * const storedUUID = UUID(Data('storage', 'mypack:data', 'saved_uuid')) * storedUUID.convertForMacro() * storedUUID.execute.run.say('Hello!') * }) * ``` */ convertForMacro(): this; /** * Partial execute command executing as (not at) the entity. * * Works when: * - UUID was created from a known string/array (can convert to string at build time) * - UUID was created from a selector (uses the selector for execute) * - UUID was created from data/scores (requires `convertForMacro()` to be called first) * * For data/scores-based UUIDs, you must call `convertForMacro()` before using this * property. This converts the UUID to string format using guuid and caches it. * * @example * ```ts * // Known UUID - works directly * const known = UUID('f81d4fae-7dec-11d0-a765-00a0c91e6bf6') * known.execute.run.say('Hello!') * * // Selector UUID - works directly * const player = UUID(Selector('@p')) * player.execute.run.say('Hello!') * * // Data UUID - must call convertForMacro() first * MCFunction('use_data_uuid', () => { * const dataUUID = UUID(Data('storage', 'mypack:data', 'saved_uuid')) * dataUUID.convertForMacro() // Convert and cache the UUID * dataUUID.execute.run.say('Hello!') // Uses the cached value * }) * ``` */ get execute(): ExecuteCommand; toString(): string; } //# sourceMappingURL=UUID.d.ts.map