import type { SymbolDataComponent, SymbolDataComponentPredicate } from '../arguments/generated/dispatcher.js'; import type { Registry } from '../arguments/generated/registry.js'; import type { MinMaxBounds } from '../arguments/generated/data/util.js'; import type { SandstonePack } from '../pack/index.js'; import * as util from 'util'; import type { MacroArgument } from '../core/Macro.js'; import { TagClass } from '../core/resources/datapack/tag.js'; import type { NBTObject } from '../arguments/index.js'; import type { ItemModelBuilder } from '../core/resources/resourcepack/itemDefinition.js'; /** Item type: specific item, tag, or wildcard */ export type ItemPredicateItemType = Registry['minecraft:item'] | `#${string}` | TagClass<'item'> | '*'; /** Keys for sub-predicate matching (~ operator) */ type PredicateKeys = keyof SymbolDataComponentPredicate<'map'>; /** Keys for exact value matching (= operator) */ type ComponentKeys = keyof SymbolDataComponent<'map'>; /** Range for count test */ type CountRange = number | MinMaxBounds | { min?: number; max?: number; }; /** A single test entry */ type TestEntry = { negated: boolean; component: string; operator: '=' | '~' | 'exists'; value?: MacroArgument | NBTObject; }; /** A group of tests joined by OR */ type OrGroup = TestEntry[]; /** * Builder for item predicates used in commands like `clear` and `execute if items`. * * @example * ```ts * // Simple item match * ItemPredicate('minecraft:diamond') * * // With component tests * ItemPredicate('minecraft:diamond_sword') * .match('minecraft:enchantments', [{ enchantment: 'minecraft:sharpness', levels: { min: 3 } }]) * .has('minecraft:custom_name') * * // Wildcard with count * ItemPredicate('*').count({ max: 16 }) * * // Tag with negation * ItemPredicate('#minecraft:swords').without('minecraft:damage') * * // OR logic: items without damage OR with damage=0 * ItemPredicate('*').or( * i => i.without('minecraft:damage'), * i => i.exact('minecraft:damage', 0) * ) * ``` */ export declare class ItemPredicateClass { private readonly pack; private readonly itemType; protected readonly testGroups: OrGroup[]; constructor(pack: SandstonePack, itemType: ItemPredicateItemType); /** Check if a component exists */ has(component: K): this; /** Check if a component does NOT exist */ without(component: K): this; /** Exact match for a component value (= operator) */ exact(component: K, value: SymbolDataComponent<'map'>[K]): this; /** Negated exact match (!component=value) */ notExact(component: K, value: SymbolDataComponent<'map'>[K]): this; /** Sub-predicate match (~ operator) */ match(predicate: K, value: SymbolDataComponentPredicate<'map'>[K]): this; /** Negated sub-predicate match (!predicate~value) */ notMatch(predicate: K, value: SymbolDataComponentPredicate<'map'>[K]): this; /** Test stack count */ count(range: CountRange): this; /** * Create an OR group of conditions. * Each callback receives a fresh builder; all their tests are joined with |. * * @example * ```ts * ItemPredicate('*').or( * i => i.without('minecraft:damage'), * i => i.exact('minecraft:damage', 0) * ) * // Produces: *[!minecraft:damage|minecraft:damage=0] * ``` */ or(...builders: ((item: ItemPredicateClass) => ItemPredicateClass)[]): this; /** * Create an item model builder from this predicate. * The builder inherits all predicate tests and adds model-specific methods * for building ItemModel JSON for resource packs. * * @example * ```ts * ItemPredicate('minecraft:diamond_sword') * .has('minecraft:enchantments') * .without('minecraft:damage') * .model() * .onTrue('custom:enchanted_pristine') * .onFalse('minecraft:item/diamond_sword') * ``` */ model(): ItemModelBuilder; private addTest; private stringifyTest; private stringifyOrGroup; toString(): string; protected toJSON(): string; [util.inspect.custom](): string; } export {}; //# sourceMappingURL=ItemPredicate.d.ts.map