[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/protocol](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md) / CommandOriginData

# Class: CommandOriginData

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:48](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L48)

The `Origin` of a `CommandRequestPacket` and the `Origin Data` a `CommandOutputPacket`
sends back, Mojang's `CommandOriginData`.

Wire order at protocol 2193: `Type` string, `UUID` as two uint64 LE halves with the most
significant first, `RequestId` string, `PlayerId` int64 LE. All four are always present;
`PlayerId` is not conditional on the origin.

## See

https://mojang.github.io/bedrock-protocol-docs/1.26.60/types/command-origin-data/

## Constructors

### Constructor

> **new CommandOriginData**(`type`, `uuid`, `requestId`, `uniqueEntityId`): `CommandOriginData`

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:61](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L61)

#### Parameters

##### type

[`CommandOriginType`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#commandorigintype)

##### uuid

[`UUIDValue`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/UUIDValue.md)

##### requestId

`string`

##### uniqueEntityId

`bigint`

#### Returns

`CommandOriginData`

## Properties

### requestId

> **requestId**: `string`

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:56](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L56)

`RequestId`: the request's id, as the sender chose it.

***

### type

> **type**: [`CommandOriginType`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#commandorigintype)

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:50](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L50)

`Type`: who or what issued the command. A client's own commands carry `Player`.

***

### uniqueEntityId

> **uniqueEntityId**: `bigint`

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:59](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L59)

`PlayerId`: the unique entity id of the player the origin stands for.

***

### uuid

> **uuid**: [`UUIDValue`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/UUIDValue.md)

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:53](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L53)

`UUID`: identifies this run of the command. The reply carries the same one.

## Methods

### networkSerialize()

> **networkSerialize**(`stream`): `void`

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:88](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L88)

Writes one origin to the stream, so that a `CommandOutputPacket` can carry back the
origin its request arrived with.

`Type` goes out in lower case, the form gophertunnel and Dragonfly send. The reader above
matches a name in any casing.

#### Parameters

##### stream

[`BinaryStream`](https://jsprismarine.dev/api/@jsprismarine/binaryutils/classes/BinaryStream.md)

#### Returns

`void`

***

### networkDeserialize()

> `static` **networkDeserialize**(`stream`): `CommandOriginData`

Defined in: [protocol/src/bedrock/wire/structures/CommandOriginData.ts:72](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/protocol/src/bedrock/wire/structures/CommandOriginData.ts#L72)

Reads one origin from the stream. A "Type" name this server does not know decodes as
`Player`.

#### Parameters

##### stream

[`BinaryStream`](https://jsprismarine.dev/api/@jsprismarine/binaryutils/classes/BinaryStream.md)

#### Returns

`CommandOriginData`
