Skip to content

API reference / @jsprismarine/protocol / CommandEnumConstraint

Class: CommandEnumConstraint ​

Defined in: protocol/src/wire/structures/CommandEnumConstraint.ts:4

Restrictions applied to one value of a hard enum in AvailableCommandsPacket.

Constructors ​

Constructor ​

new CommandEnumConstraint(_enum, valueOffset, constraints): CommandEnumConstraint

Defined in: protocol/src/wire/structures/CommandEnumConstraint.ts:15

Associates a value in an enum with protocol constraint indices.

Parameters ​

_enum ​

CommandEnum

The hard enum containing the affected value.

valueOffset ​

number

The value's zero-based position in the enum.

constraints ​

number[]

Constraint identifiers encoded as bytes.

Returns ​

CommandEnumConstraint

Methods ​

getAffectedValue() ​

getAffectedValue(): string

Defined in: protocol/src/wire/structures/CommandEnumConstraint.ts:35

Returns ​

string

The string value selected by the stored position.


getConstraints() ​

getConstraints(): number[]

Defined in: protocol/src/wire/structures/CommandEnumConstraint.ts:40

Returns ​

number[]

The byte-sized protocol constraint identifiers.


getEnum() ​

getEnum(): CommandEnum

Defined in: protocol/src/wire/structures/CommandEnumConstraint.ts:25

Returns ​

CommandEnum

The hard enum that owns the constrained value.


getValueOffset() ​

getValueOffset(): number

Defined in: protocol/src/wire/structures/CommandEnumConstraint.ts:30

Returns ​

number

The zero-based value position in the enum.