Skip to main content

Class: EntityBreathableComponent

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

Extends

Constructors

new EntityBreathableComponent()

private new EntityBreathableComponent(): EntityBreathableComponent

Returns

EntityBreathableComponent

Overrides

EntityComponent . constructor

Properties

breathesAir

readonly breathesAir: boolean

Remarks

If true, this entity can breathe in air.

Throws

This property can throw when used.


breathesLava

readonly breathesLava: boolean

Remarks

If true, this entity can breathe in lava.

Throws

This property can throw when used.


breathesSolids

readonly breathesSolids: boolean

Remarks

If true, this entity can breathe in solid blocks.

Throws

This property can throw when used.


breathesWater

readonly breathesWater: boolean

Remarks

If true, this entity can breathe in water.

Throws

This property can throw when used.


entity

Beta

readonly entity: Entity

Remarks

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

Inherited from

EntityComponent . entity


generatesBubbles

readonly generatesBubbles: boolean

Remarks

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

Throws

This property can throw when used.


inhaleTime

readonly inhaleTime: number

Remarks

Time in seconds to recover breath to maximum.

Throws

This property can throw when used.


suffocateTime

readonly suffocateTime: number

Remarks

Time in seconds between suffocation damage.

Throws

This property can throw when used.


totalSupply

readonly totalSupply: number

Remarks

Time in seconds the entity can hold its breath.

Throws

This property can throw when used.


typeId

readonly typeId: string

Remarks

Identifier of the component.

Inherited from

EntityComponent . typeId


componentId

static readonly componentId: "minecraft:breathable" = 'minecraft:breathable'

Methods

getBreatheBlocks()

getBreatheBlocks(): BlockPermutation[]

Returns

BlockPermutation[]

Remarks

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

Throws

This function can throw errors.


getNonBreatheBlocks()

getNonBreatheBlocks(): BlockPermutation[]

Returns

BlockPermutation[]

Remarks

List of blocks this entity can't breathe in.

Throws

This function can throw errors.


isValid()

isValid(): boolean

Returns

boolean

Whether the component is valid.

Inherited from

EntityComponent . isValid

Remarks

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.


setAirSupply()

setAirSupply(value): void

Parameters

ParameterTypeDescription
valuenumberNew air supply for the entity.

Returns

void

Remarks

Sets the current air supply of the entity.

Throws

This function can throw errors.