Script API - v1.26.40.20
    Preparing search index...

    Class EntityFogComponentBeta

    Provides access to the fog definitions stack of a player entity, allowing scripts to push, pop, remove, and query active fog definitions.

    export class EntityFogComponent extends EntityComponent {
    private constructor();
    static readonly componentId = 'minecraft:player.fog';
    applyStack(fogIds: string[], tag?: string): void;
    getStack(): string[];
    getTags(): string[];
    pop(tag?: string): string | undefined;
    push(fogId: string, tag?: string): number;
    remove(tag?: string): boolean;
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    entity: Entity

    The entity that owns this component. The entity will be undefined if it has been removed.

    This property can throw when used.

    InvalidEntityError

    This property can't be read in early-execution mode.

    isValid: boolean

    Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.

    This property can't be read in early-execution mode.

    typeId: string

    Identifier of the component.

    This property can't be read in early-execution mode.

    componentId: "minecraft:player.fog" = 'minecraft:player.fog'

    Methods

    • Parameters

      • fogIds: string[]

        A stack of fog definition identifiers to set on the player's fog stack (e.g. ['minecraft:fog_bamboo_jungle']). Maximum of 16 entries.

      • Optionaltag: string

        An optional tag to associate with the new entries, used to target them with pop or remove.

      Returns void

      Sets the player's fog stack to the given list of fog identifiers, replacing any existing entries.

      This function can't be called in restricted-execution mode.

      Throws if the entity is invalid, if more than 16 fog identifiers are provided, or if any fog identifier is invalid.

      EntityFogComponentError

      InvalidEntityError

      This function can't be called in early-execution mode.

    • Returns string[]

      An array of fog definition identifiers currently on the stack.

      Returns the list of fog identifiers currently on the player's fog stack, ordered from bottom to top.

      This function can't be called in restricted-execution mode.

      Throws if the entity is invalid.

      InvalidEntityError

      This function can't be called in early-execution mode.

    • Returns string[]

      An array of tag strings associated with fog settings on the stack.

      Returns the list of tags currently present on the player's fog stack.

      This function can't be called in restricted-execution mode.

      Throws if the entity is invalid.

      InvalidEntityError

      This function can't be called in early-execution mode.

    • Parameters

      • Optionaltag: string

        An optional tag identifying which entry to pop. If provided, searches the stack from top to bottom and removes the most recently pushed entry with this tag. If omitted, removes the most recently pushed entry regardless of tag.

      Returns string | undefined

      Returns the identifier of the popped fog definition, or undefined if the stack was unchanged.

      Removes the most recently pushed fog definition from the player's fog stack.

      This function can't be called in restricted-execution mode.

      Throws if the entity is invalid.

      InvalidEntityError

      This function can't be called in early-execution mode.

    • Parameters

      • fogId: string

        The identifier of the fog definition to push onto the stack (e.g. 'minecraft:fog_bamboo_jungle').

      • Optionaltag: string

        An optional tag used to label this fog definition on the stack, allowing it to be targeted by pop or remove. If omitted, the entry is stored with the tag 'untagged'.

      Returns number

      Returns the zero-based index at which the fog definition was inserted into the stack.

      Pushes a new fog definition onto the player's fog stack.

      This function can't be called in restricted-execution mode.

      Throws if the entity is invalid, the fog identifier is invalid, or if the stack limit of 16 has been exceeded.

      EntityFogComponentError

      InvalidEntityError

      This function can't be called in early-execution mode.

    • Parameters

      • Optionaltag: string

        An optional tag identifying which the entries to remove. If omitted, clears all fog definitions regardless of tag.

      Returns boolean

      Returns true if at least one entry was removed, or false if the stack was unchanged.

      Removes all fog definitions with the given tag from the player's fog stack. If no tag is provided, clears all fog definitions.

      This function can't be called in restricted-execution mode.

      Throws if the entity is invalid.

      InvalidEntityError

      This function can't be called in early-execution mode.