File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ public record UpdatePacket(String data) implements ISensitiveBiPacket {
224224
225225- Each packet class ** must** declare static `TYPE ` (`CustomPacketPayload . Type `) and `STREAM_CODEC ` fields —
226226 `NetworkRegistrar ` reads them via reflection;
227- - `handleOnClient` and `handleOnServer ` callbacks are automatically dispatched to the main thread via
227+ - `handleOnClient`, `handleOnServer` and `handleOnBothSide ` callbacks are automatically dispatched to the main thread via
228228 `ctx. enqueueWork()` — no manual queuing needed;
229229- It is recommended to place packets for different `PacketProtocol ` values in separate sub- packages (e. g. ,
230230 `network. play`, `network. configuration`) each with their own `@Network ` annotation;
Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ public record UpdatePacket(String data) implements ISensitiveBiPacket {
222222## 六、注意事项
223223
224224- 每个网络包类** 必须** 声明静态的 `TYPE `(`CustomPacketPayload . Type `)和 `STREAM_CODEC ` 字段,`NetworkRegistrar ` 通过反射读取它们;
225- - `handleOnClient` 和 `handleOnServer ` 的回调默认会通过 `ctx. enqueueWork()` 在主线程执行,无需手动排队;
225+ - `handleOnClient`、 `handleOnServer` 和 `handleOnBothSide ` 的回调默认会通过 `ctx. enqueueWork()` 在主线程执行,无需手动排队;
226226- 建议为不同 `PacketProtocol ` 的包分别建立子包(如 `network. play`、`network. configuration`)并各自添加 `@Network ` 注解;
227227- `NetworkRegistrar . register` 仅扫描同一 JAR 内的类,跨模组包不会被扫描。
228228
You can’t perform that action at this time.
0 commit comments