# C02PacketUseEntity

A packet sent by the client to interact with entities.

### Extends

* [`Packet`](/api/net/minecraft/network/packet.md)

### Constructors

#### Constructor

> **new C02PacketUseEntity**(`wrapper`, `action`, `at`): `C02PacketUseEntity`

Creates a new C02PacketUseEntity packet

**Parameters**

**wrapper**

[`Entity`](/api/net/minecraft/entity/entity.md)

The entity to interact with

**action**

[`UseEntityAction`](/api/enum_types/useentityaction.md)

The action to perform (INTERACT, ATTACK or INTERACT\_AT)

**at**

[`Vec3`](/api/net/minecraft/util/vec3.md)

The hit vector for the interaction.

**Returns**

`C02PacketUseEntity`

**Overrides**

`Packet.constructor`

### Methods

#### getAction()

> **getAction**(): [`UseEntityAction`](/api/enum_types/useentityaction.md)

Gets the action performed on the entity

**Returns**

[`UseEntityAction`](/api/enum_types/useentityaction.md)

The action as a string (INTERACT, ATTACK or INTERACT\_AT)

***

#### getEntity()

> **getEntity**(): [`Entity`](/api/net/minecraft/entity/entity.md)

Gets the entity this packet is interacting with

**Returns**

[`Entity`](/api/net/minecraft/entity/entity.md)

The target entity

***

#### getHitVec()

> **getHitVec**(): [`Vec3`](/api/net/minecraft/util/vec3.md)

Gets the hit vector for INTERACT\_AT actions

**Returns**

[`Vec3`](/api/net/minecraft/util/vec3.md)

The hit vector or null if the action is not INTERACT\_AT

***

#### getPacketID()

> **getPacketID**(): `string`

Get the ID of the packet.

**Returns**

`string`

The ID of the packet.

**Inherited from**

[`Packet`](/api/net/minecraft/network/packet.md).[`getPacketID`](/api/net/minecraft/network/packet.md#getpacketid)

***

#### setAction()

> **setAction**(`action`): `void`

Sets the action to perform on the entity

**Parameters**

**action**

`string`

The new action (INTERACT, ATTACK or INTERACT\_AT)

**Returns**

`void`

***

#### setEntity()

> **setEntity**(`entity`): `void`

Sets the entity this packet is interacting with

**Parameters**

**entity**

[`Entity`](/api/net/minecraft/entity/entity.md)

The new target entity

**Returns**

`void`

***

#### setHitVec()

> **setHitVec**(`vec`): `void`

Sets the hit vector for INTERACT\_AT actions

**Parameters**

**vec**

[`Vec3`](/api/net/minecraft/util/vec3.md)

The new hit vector

**Returns**

`void`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://scripting.breeze.rip/api/net/minecraft/network/client/c02packetuseentity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
