> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opai.today/llms.txt
> Use this file to discover all available pages before exploring further.

# Safe Knowledge

> Common knowledge to keep in mind when developing extensions

This page lists important things to keep in mind during development to avoid issues.

## Packets must be sent during Tick

Most operation packets must only be sent during player update events (such as `onPlayerUpdate` or `onMotionUpdate`), because these events are triggered when the player updates.\
If you send them in other events (e.g., `onPacketReceive`), it may trigger anticheats (such as Post checks).

If you are unsure whether your packet sending is safe, you can test on `eu.loyisa.cn` with anticheat set to `Vulcan` and `Grim` (use `/ac vulcan grim`).\
If no `BadPackets` or `Post` flags are triggered, it is generally safe.

## Rotation must support movement correction

The `Rotation Manager` provides the following method for setting rotations:

```java theme={null}
void applyRotation(RotationData rotationData, int speed, boolean correction);
```

If `correction` is set to `true`, movement correction will be applied during rotation.
You **must** use `applyRotation` inside `onPlayerUpdate`, because if you call it in `onMotionUpdate`, the client’s movement has already been updated and cannot be corrected.

Unless you never plan to support Hypixel or GrimAC servers, you must either provide this option or enable movement correction by default.

## Do not manually send Transaction packets

Transaction packets are also known as `CPacket0FTransaction` or `C0F`.
Most anticheats use them (due to their instant acknowledgment nature) to validate player positions, implementing reach or hitbox checks via latency compensation.

If you manually send these packets, it breaks the transaction order.
Most anticheats will automatically ban players that send invalid `C0F` packets.

## Rendering methods must only be called in render events

Rendering methods (e.g., 2D/GUI drawing) must only be called inside `onRender2D`.

Some rendering methods (e.g., collision box rendering) must instead be called inside `onRender3D`.
