EntityBreathableComponent Class

Caution

This class is still in pre-release. Its signature may change or it may be removed in future releases.

Extends

Defines what blocks this entity can breathe in and gives them the ability to suffocate.

Properties

breathesAir

read-only breathesAir: boolean;

If true, this entity can breathe in air.

Type: boolean

Warning

This property can throw errors when used.

breathesLava

read-only breathesLava: boolean;

If true, this entity can breathe in lava.

Type: boolean

Warning

This property can throw errors when used.

breathesSolids

read-only breathesSolids: boolean;

If true, this entity can breathe in solid blocks.

Type: boolean

Warning

This property can throw errors when used.

breathesWater

read-only breathesWater: boolean;

If true, this entity can breathe in water.

Type: boolean

Warning

This property can throw errors when used.

generatesBubbles

read-only generatesBubbles: boolean;

If true, this entity will have visible bubbles while in water.

Type: boolean

Warning

This property can throw errors when used.

inhaleTime

read-only inhaleTime: number;

Time in seconds to recover breath to maximum.

Type: number

Warning

This property can throw errors when used.

suffocateTime

read-only suffocateTime: number;

Time in seconds between suffocation damage.

Type: number

Warning

This property can throw errors when used.

totalSupply

read-only totalSupply: number;

Time in seconds the entity can hold its breath.

Type: number

Warning

This property can throw errors when used.

Methods

getBreatheBlocks

getBreatheBlocks(): BlockPermutation[]

List of blocks this entity can breathe in, in addition to the separate properties for classes of blocks.

Returns BlockPermutation[]

Warning

This function can throw errors.

getNonBreatheBlocks

getNonBreatheBlocks(): BlockPermutation[]

List of blocks this entity can't breathe in.

Returns BlockPermutation[]

Warning

This function can throw errors.

setAirSupply

setAirSupply(value: number): void

Sets the current air supply of the entity.

Parameters

  • value: number

    New air supply for the entity.

Warning

This function can throw errors.

Constants

componentId

static read-only componentId = "minecraft:breathable";

Type: string