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

# Class: Metadata

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

Represents the metadata of an entity.

## Extends

- `MetadataWriter`

## Constructors

### Constructor

> **new Metadata**(`setDefaults?`): `Metadata`

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

Create a new metadata object.

#### Parameters

##### setDefaults?

`boolean` = `true`

#### Returns

`Metadata`

the metadata object.

#### Overrides

`MetadataWriter.constructor`

## Accessors

### affectedByGravity

#### Get Signature

> **get** **affectedByGravity**(): `boolean`

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

Get if the entity is affected by gravity.

##### Returns

`boolean`

if the entity is affected by gravity.

***

### air

#### Get Signature

> **get** **air**(): `number`

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

Get how much breath the entity has left, in ticks.

##### Returns

`number`

Ticks of breath remaining.

***

### breathing

#### Get Signature

> **get** **breathing**(): `boolean`

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

Get whether the entity is breathing.

##### Returns

`boolean`

`true` if the entity is breathing.

***

### canClimb

#### Get Signature

> **get** **canClimb**(): `boolean`

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

Get entity's can climb state.

##### Returns

`boolean`

if the entity can climb.

***

### canFly

#### Get Signature

> **get** **canFly**(): `boolean`

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

Get entity's can fly state.

##### Returns

`boolean`

if the entity can fly.

***

### collidable

#### Get Signature

> **get** **collidable**(): `boolean`

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

Get entity's collidable state.

##### Returns

`boolean`

if the entity is collidable.

***

### maxAir

#### Get Signature

> **get** **maxAir**(): `number`

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

Get how long the entity can stay underwater, in ticks.

##### Returns

`number`

The maximum breath, in ticks.

***

### nameTag

#### Get Signature

> **get** **nameTag**(): `string`

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

Get the entity's name tag.

##### Returns

`string`

The entity's name tag.

***

### onFire

#### Get Signature

> **get** **onFire**(): `boolean`

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

Get whether the entity is visibly alight.

##### Returns

`boolean`

if the entity is burning.

***

### sprinting

#### Get Signature

> **get** **sprinting**(): `boolean`

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

Get entity's sprinting state.

##### Returns

`boolean`

if the entity is sprinting.

***

### targetEntityId

#### Get Signature

> **get** **targetEntityId**(): `bigint`

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

What the entity is attacking, or `0n`.

##### Returns

`bigint`

## Methods

### getData()

> **getData**(): [`MetadataContainer`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#metadatacontainer)

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

Returns all stored properties keyed by their actor data id.

#### Returns

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

#### Inherited from

`MetadataWriter.getData`

***

### getDataFlag()

> **getDataFlag**(`propertyId`, `flagId`): `boolean`

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

Get the property value as a boolean.

#### Parameters

##### propertyId

`number`

The property id.

##### flagId

`bigint`

The flag id.

#### Returns

`boolean`

The flag value.

#### Inherited from

`MetadataWriter.getDataFlag`

***

### getFloat()

> **getFloat**(`key`): `number`

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

Get the property value as a float.

#### Parameters

##### key

`number`

The property id.

#### Returns

`number`

#### Inherited from

`MetadataWriter.getFloat`

***

### getGenericFlag()

> **getGenericFlag**(`flagId`): `boolean`

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

Whether one of the entity's generic flags is set, in whichever of the two flag longs
[setGenericFlag](#setgenericflag) writes it to.

#### Parameters

##### flagId

`number`

The flag id.

#### Returns

`boolean`

The flag value.

#### Inherited from

`MetadataWriter.getGenericFlag`

***

### getPropertyValue()

> **getPropertyValue**(`key`): `string` \| `number` \| `bigint` \| [`NBTTagCompound`](https://jsprismarine.dev/api/@jsprismarine/nbt/classes/NBTTagCompound.md) \| [`Vector3`](https://jsprismarine.dev/api/@jsprismarine/math/classes/Vector3.md) \| `null`

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

Returns a property's value, or `null` if that property is not set.

#### Parameters

##### key

`number`

#### Returns

`string` \| `number` \| `bigint` \| [`NBTTagCompound`](https://jsprismarine.dev/api/@jsprismarine/nbt/classes/NBTTagCompound.md) \| [`Vector3`](https://jsprismarine.dev/api/@jsprismarine/math/classes/Vector3.md) \| `null`

#### Inherited from

`MetadataWriter.getPropertyValue`

***

### getScale()

> **getScale**(): `number`

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

Get the entity's scale.

#### Returns

`number`

The entity's scale, or `1` when none has been set.

***

### getString()

> **getString**(`key`): `string`

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

Get the property value as a string.

#### Parameters

##### key

`number`

The property id.

#### Returns

`string`

The property value.

#### Inherited from

`MetadataWriter.getString`

***

### networkDeserialize()

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

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

Reads a `SynchedActorDataList` into this object, the mirror of
[MetadataWriter.networkSerialize](#networkserialize).

The one-of selector is what is dispatched on, and the alternative's own `Type` byte is
checked against it: the two carry the same `DataItemType`, and when they disagree the
payload's length cannot be known, so the stream cannot be trusted past this entry.

#### Parameters

##### stream

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

The network stream.

#### Returns

`void`

#### Throws

when the selector and the `Type` byte disagree, or name no known type.

#### Inherited from

`MetadataWriter.networkDeserialize`

***

### networkSerialize()

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

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

Writes the properties as a `SynchedActorDataList`.

A varuint32 count, then one `DataItemEntry` per property: the `ID` as a varuint32, the
payload's one-of selector as a varuint32, the same type again as the alternative's own
uint8 `Type` field, and the `Value` in that type's encoding.

The entries go out in ascending id order rather than in the order they were set. The
client reads some properties as a group and expects them to arrive in order - an NPC
shows neither its text nor its buttons when they do not - and ascending is also what a
Bedrock Dedicated Server writes, since it walks its own map.

#### Parameters

##### stream

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

The network stream.

#### Returns

`void`

#### Inherited from

`MetadataWriter.networkSerialize`

***

### setAffectedByGravity()

> **setAffectedByGravity**(`affected?`): `void`

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

Set if the entity should be affected by gravity.

#### Parameters

##### affected?

`boolean` = `true`

if the entity should be affected by gravity.

#### Returns

`void`

***

### setAir()

> **setAir**(`air?`): `void`

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

Set how much breath the entity has left, in ticks.

#### Parameters

##### air?

`number` = `MAX_AIR_TICKS`

Ticks of breath remaining, clamped to the maximum.

#### Returns

`void`

***

### setBoundingBox()

> **setBoundingBox**(`width`, `height`): `void`

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

Set the box the client draws and aims at.

This is the size the *client* uses - for the hitbox it highlights, for where an attack
lands, and for how far the entity is drawn from a wall. It has to be the same box the
server collides against or the two disagree visibly: everything used to be announced as
`0.6 x 1.8`, a player, whatever it actually was.

#### Parameters

##### width

`number`

Blocks across, on both horizontal axes.

##### height

`number`

Blocks tall, measured up from the feet.

#### Returns

`void`

***

### setBreathing()

> **setBreathing**(`breathing?`): `void`

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

Set whether the entity is breathing. False is what draws the bubble bar.

#### Parameters

##### breathing?

`boolean` = `true`

Whether the entity has air to breathe.

#### Returns

`void`

***

### setCanClimb()

> **setCanClimb**(`canClimb?`): `void`

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

Set the entity's can climb state.

#### Parameters

##### canClimb?

`boolean` = `true`

if the entity can climb.

#### Returns

`void`

***

### setCanFly()

> **setCanFly**(`canFly?`): `void`

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

Set the entity's can fly state.

#### Parameters

##### canFly?

`boolean` = `true`

if the entity can fly.

#### Returns

`void`

***

### setCollidable()

> **setCollidable**(`collidable?`): `void`

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

Set if the entity should be collidable.

#### Parameters

##### collidable?

`boolean` = `true`

if the entity should be collidable.

#### Returns

`void`

***

### setDataFlag()

> **setDataFlag**(`propertyId`, `flagId`, `value?`, `propertyType?`): `void`

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

Set a flag value.

#### Parameters

##### propertyId

`number`

The property id.

##### flagId

`number`

The flag id.

##### value?

`boolean` = `true`

The flag value.

##### propertyType?

[`LONG`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#long) = `FlagType.LONG`

The property type. Only `LONG` is
accepted: the flags are one 64-bit field, and any other type truncates it on the wire.

#### Returns

`void`

#### Inherited from

`MetadataWriter.setDataFlag`

***

### setFloat()

> **setFloat**(`key`, `value`): `void`

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

Set the property value as a float.

#### Parameters

##### key

`number`

The property id.

##### value

`number`

The property value.

#### Returns

`void`

#### Inherited from

`MetadataWriter.setFloat`

***

### setGenericFlag()

> **setGenericFlag**(`flagId`, `value?`): `void`

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

Set one of the entity's generic flags.

Always as a Long: the flags are a single 64-bit field, and the type sent with it says
how many bytes follow it. Sprinting, flying and climbing used to declare theirs a
`BYTE`, so the client read one byte of a 64-bit number and then carried on reading the
rest of it as further properties - which is why setting any of them lost collision and
gravity along the way.

#### Parameters

##### flagId

`number`

The flag id.

##### value?

`boolean` = `true`

The flag value.

#### Returns

`void`

#### Inherited from

`MetadataWriter.setGenericFlag`

***

### setIgnited()

> **setIgnited**(`ignited?`): `void`

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

Set whether a creeper is swelling.

The bulge and the flash are the client's own animation, driven entirely by this flag - so a
creeper whose fuse is lit only server-side stands there looking ordinary and then kills you
with no warning at all.

#### Parameters

##### ignited?

`boolean` = `true`

if the fuse is lit.

#### Returns

`void`

***

### setInt()

> **setInt**(`key`, `value`): `void`

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

Set the property value as an int.

#### Parameters

##### key

`number`

The property id.

##### value

`number`

The property value.

#### Returns

`void`

#### Remarks

Block runtime ids are why this exists: a falling block tells the client which block
it is through `VARIANT`, and that is an int - a short would truncate the hash to nonsense.

#### Inherited from

`MetadataWriter.setInt`

***

### setLong()

> **setLong**(`key`, `value`): `void`

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

Stores a property as a signed 64-bit value.

#### Parameters

##### key

`number`

##### value

`bigint`

#### Returns

`void`

#### Inherited from

`MetadataWriter.setLong`

***

### setMaxAir()

> **setMaxAir**(`maxAir?`): `void`

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

Set how long the entity can stay underwater, in ticks.

#### Parameters

##### maxAir?

`number` = `MAX_AIR_TICKS`

The maximum breath, in ticks.

#### Returns

`void`

***

### setNameTag()

> **setNameTag**(`name`): `void`

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

Set the entity's name tag.

#### Parameters

##### name

`string`

The name tag.

#### Returns

`void`

#### Example

```typescript
entity.setNameTag('Steve');
```

***

### setOnFire()

> **setOnFire**(`onFire?`): `void`

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

Set whether the entity is visibly alight.

Only the flames the client draws. Whether the burn actually hurts is the server's business
and is tracked separately - a creative player is set alight and takes nothing for it.

#### Parameters

##### onFire?

`boolean` = `true`

if the entity is burning.

#### Returns

`void`

***

### setPropertyValue()

> **setPropertyValue**(`key`, ...`entry`): `void`

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

Stores a property together with its wire type.

#### Parameters

##### key

`number`

##### entry

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

#### Returns

`void`

#### Inherited from

`MetadataWriter.setPropertyValue`

***

### setScale()

> **setScale**(`scale?`): `void`

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

Set the entity's scale.

#### Parameters

##### scale?

`number` = `1`

The entity's scale.

#### Returns

`void`

***

### setShort()

> **setShort**(`key`, `value`): `void`

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

Stores a property as a signed 16-bit value.

#### Parameters

##### key

`number`

##### value

`number`

#### Returns

`void`

#### Inherited from

`MetadataWriter.setShort`

***

### setSprinting()

> **setSprinting**(`sprinting?`): `void`

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

Set the entity's sprinting state.

#### Parameters

##### sprinting?

`boolean` = `true`

if the entity is sprinting.

#### Returns

`void`

***

### setString()

> **setString**(`key`, `value`): `void`

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

Set the property value as a string.

#### Parameters

##### key

`number`

The property id.

##### value

`string`

The property value.

#### Returns

`void`

#### Inherited from

`MetadataWriter.setString`

***

### setTargetEntityId()

> **setTargetEntityId**(`runtimeId`): `void`

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

Set what the entity is currently attacking, by runtime id.

Far more than bookkeeping: this is what drives a mob's whole combat pose on the client.
Mojang's own skeleton animation controller transitions into its attack state on
`query.has_target && !query.facing_target_to_range_attack` - it never looks at
`is_using_item` at all - so a skeleton whose target the client does not know about stands
with its bow at its side however faithfully the server sets every other flag.

#### Parameters

##### runtimeId

`bigint`

What it is attacking, or `0n` for nothing.

#### Returns

`void`

#### See

https://github.com/Mojang/bedrock-samples/blob/main/resource_pack/animation_controllers/skeleton.animation_controllers.json

***

### setUsingItem()

> **setUsingItem**(`usingItem?`): `void`

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

Set whether the entity is holding its item down.

The client's whole bow-drawing pose comes from this flag and nothing else: a skeleton that
fires without it appears to shoot arrows from a lowered bow, which is what makes the attack
read as a bug rather than as an attack.

#### Parameters

##### usingItem?

`boolean` = `true`

if the item is being drawn or held.

#### Returns

`void`
