> For the complete documentation index, see [llms.txt](https://daikirai.gitbook.io/scripting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daikirai.gitbook.io/scripting/documentation/events.md).

# events

### getRotations

called when Minecraft gets your yaw and pitch for movement calculations, also applies for server-side rotations.

```java
float[] getRotations(float lastYaw, float lastPitch)
```

***

### onAntiCheatFlag

called when the AntiCheat module flags a player.

```java
void onAntiCheatFlag(String flag, Entity player)
```

***

### onBedWarsAlert

called when the BedWars module sends an alert for a player.

```java
void onBedWarsAlert(String mode, Entity player)
```

***

### onChat

called whenever a message is sent in chat, return `false` to cancel.

```java
boolean onChat(String msg, int type)
```

***

### onDisable

called whenever the script is disabled.

```java
void onDisable()
```

***

### onEnable

called whenever the script is enabled.

```java
void onEnable()
```

***

### onGuiUpdate

called when a GUI updates.

```java
void onGuiUpdate(String name, boolean opened)
```

***

### onIRCMessage

called when you receive an IRC message, return `false` to cancel printing.

```java
boolean onIRCMessage(String message)
```

***

### onKey

called when a key is pressed.

```java
void onKey(String keyName, int keyCode, boolean state, boolean inGui)
```

***

### onLoad

called when the script is loaded. register buttons/sliders here.

```java
void onLoad()
```

***

### onLocRaw

calls on `/locraw` (auto-runs on world join), gives raw response as string.

```java
void onLocRaw(String locraw)
```

***

### onMouse

called whenever a button on the mouse is pressed, return `false` to cancel.

```java
boolean onMouse(int button, boolean state, int mouseX, int mouseY)
```

<table><thead><tr><th width="125">button</th><th>description</th></tr></thead><tbody><tr><td>-1</td><td>scroll wheel, state = up (true)/down (false)</td></tr><tr><td>0</td><td>left click</td></tr><tr><td>1</td><td>right click</td></tr><tr><td>2</td><td>middle click</td></tr></tbody></table>

***

### onPacketReceived

called before a packet gets processed by the client, return `false` to cancel.

```java
boolean onPacketReceived(SPacket packet)
```

***

### onPacketSent

called before a packet gets sent to the server, return `false` to cancel.

```java
boolean onPacketSent(CPacket packet)
```

***

### onPostMotion

called after updates sent to server.

```java
void onPostMotion()
```

***

### onPostPlayerInput

called after the client processes player inputs.

```java
void onPostPlayerInput()
```

***

### onPreMotion

called before player updates are sent to the server.

{% hint style="info" %}
see also: [`playerstate`](/scripting/documentation/playerstate.md) for `PlayerState` properties.
{% endhint %}

```java
void onPreMotion(PlayerState state)
```

***

### onPreUpdate

called at the beginning of every update to the local player.

```java
void onPreUpdate()
```

***

### onRenderTick

called every time the HUD renders.

```java
void onRenderTick(float partialTicks)
```

***

### onRenderWorld

called every time the world renders.

```java
void onRenderWorld(float partialTicks)
```

***

### onWorldJoin

called whenever an entity spawns in.

```java
void onWorldJoin(Entity entity)
```
