import { ATTPrefabs, LiquidContainerComponent, Prefab, type BinaryDataOptions, type BinaryReader, type LiquidContainerComponentProps, type PrefabProps, type ToSaveStringOptions } from 'att-string-transcoder'; import { EffectDefinition } from './types/EffectDefinition.js'; import { LiquidDefinition } from './types/LiquidDefinition.js'; import { LiquidVisualChunkDefinition } from './types/LiquidVisualChunkDefinition.js'; import { LiquidVisualData } from './types/LiquidVisualData.js'; type LiquidPrefabName = 'Cauldron_Medium' | 'Cave_Water_Mound' | 'Concoction_Crate' | 'Gourd_Canteen' | 'Pond_Test' | 'Pond_Water' | 'Potion_Medium' | 'Wooden_Barrel' | 'Wooden_Bowl' | 'Wooden_Bucket' | 'Wooden_Ladle'; type PrefabName = (typeof ATTPrefabs)[TPrefabName]['name']; type ColorRGBA = Exclude['color']; type Effects = Exclude['effects']; type VisualChunks = Exclude['foodChunks']; type CustomLiquidContainerComponent = LiquidContainerComponent & { isCustom: true; presetHash: 0; customData: Exclude; }; type PresetLiquidContainerComponent = LiquidContainerComponent & { isCustom: false; presetHash: number; customData: null; }; /** * Represents a prefab that can have a LiquidContainer component. This class extends the Prefab * class and has additional methods that make it easy to customise liquids. */ export declare class Liquid extends Prefab { private liquidContainerComponent; /** * Creates a prefab with a LiquidContainer component that can be easily manipulated with methods. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid * .setColor('#2a455800') * .setVisualAppearance('VisionStewCooked') * .addEffect('Feed', 2) * .addEffect('Heal', 10) * .addEffect('Nourish') * .addEffect('SpeedIndirectEffect', 5) * .addVisualChunk('Salt') * .addVisualChunk('BabuCooked') * .addVisualChunk('TomatoCooked') * .setServings(42); */ constructor(prefabName: TPrefabName, props?: PrefabProps>); /** * Adds an effect to the liquid. You may optionally pass an effect strength multiplier. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.addEffect('Nourish', 4.20); */ addEffect(effectName: keyof typeof EffectDefinition, strengthMultiplier?: number): this; /** * Adds visual chunks to the liquid, which can be observed when the liquid is poured into an * open container like a wooden bowl or ladle. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.addVisualChunk('SpriggullDrumstickCooked'); */ addVisualChunk(visualChunkName: keyof typeof LiquidVisualChunkDefinition): this; clone(options?: ToSaveStringOptions): Liquid; static fromBinary(reader: BinaryReader, componentVersions?: Map): Liquid; static fromSaveString(saveString: string, options?: BinaryDataOptions): Liquid; /** * Gets the color of the liquid. You may optionally specify an output format for the color, which * is an RGBA object by default. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * const rgba = liquid.getColor('rgba'); * const hexadecimal = liquid.getColor('hexadecimal'); */ getColor(format?: 'hexadecimal'): string | undefined; getColor(format?: 'rgba'): ColorRGBA | undefined; /** * Returns whether or not this liquid can be consumed through skin contact. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * const isConsumableThroughSkin = liquid.getConsumableThroughSkin(); */ getConsumableThroughSkin(): boolean; /** * Returns an array of all custom effects of the liquid. Does not return effects of preset * liquids. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * const effects = liquid.getEffects(); */ getEffects(): Effects | undefined; /** * Gets the LiquidContainer component of the liquid. If none is present on the liquid for whatever * reason, one will be created first. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * const liquidContainerComponent = liquid.getLiquidContainerComponent(); */ getLiquidContainerComponent(): LiquidContainerComponent; /** * Returns an array of all custom visual chunks of the liquid. Does not return visual chunks of * preset liquids. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * const visualChunkHashes = liquid.getVisualChunks(); */ getVisualChunks(): VisualChunks | undefined; /** * Converts a hexadecimal color code to an RGBA object. */ protected hexadecimalToRgba(colorHexadecimal: string): ColorRGBA; /** * Ensures the given LiquidContainerComponent has custom data. */ protected makeCustom(liquidContainerComponent: LiquidContainerComponent): asserts liquidContainerComponent is CustomLiquidContainerComponent; /** * Ensures the given LiquidContainerComponent is a preset. */ protected makePreset(liquidContainerComponent: LiquidContainerComponent): asserts liquidContainerComponent is PresetLiquidContainerComponent; /** * Removes all custom effects from the liquid. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.removeAllEffects(); */ removeAllEffects(): this; /** * Removes all custom visual chunks from the liquid. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.removeAllVisualChunks(); */ removeAllVisualChunks(): this; /** * Removes all custom effects matching the given name from the liquid. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.removeEffect('Nourish'); */ removeEffect(effectName: keyof typeof EffectDefinition): this; /** * Removes all custom visual chunks matching the given name from the liquid. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.removeVisualChunk('SpriggullDrumstickCooked'); */ removeVisualChunk(visualChunkName: keyof typeof LiquidVisualChunkDefinition): this; /** * Sets the color of the liquid. You may pass either a hexadecimal color code or an RGBA object. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.setColor('#2a455800'); * // or * liquid.setColor({ r: 42, g: 69, b: 88, a: 0 }); */ setColor(colorHexadecimal: string): this; setColor(colorRgba: ColorRGBA): this; /** * Sets whether or not the liquid can be consumed through skin contact. Sets true by default. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.setConsumableThroughSkin(); * // or * liquid.setConsumableThroughSkin(true); */ setConsumableThroughSkin(isConsumableThroughSkin?: boolean): this; /** * Sets the liquid to a preset liquid. Removes any customisations. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.setPreset('TeleportPotion'); */ setPreset(presetName: keyof typeof LiquidDefinition): this; /** * Sets the visual appearance of the liquid. * * @example * import { Liquid } from 'att-liquids'; * * const liquid = new Liquid('Potion_Medium'); * * liquid.setVisualAppearance('Teleport'); */ setVisualAppearance(visualAppearanceName: keyof typeof LiquidVisualData): this; /** * Converts an RGBA object to a hexadecimal color code. */ protected rgbaToHexadecimal(colorRgba: ColorRGBA): string; } export {};