PacketEdit
为 Fabric 服务器和客户端提供网络优化。 PacketEdit 通过两个独立模块减少网络流量和包处理 CPU 开销。
?️ ZSTD 数据包压缩
用 Zstandard (ZSTD) 替换原版 zlib 数据包压缩——这是一种更现代、压缩率更高且速度数倍于原版的算法。
- 与原版相同的线框格式(
[VarInt size][payload]),仅算法变更——其余管线保持不变。
- 小于 256 字节的数据包将直接透传(不对微小数据包浪费 CPU)。
- 堆外缓冲区之间的零拷贝原生压缩——Netty 线程上无额外分配。
- 解码时完全遵循原版验证逻辑(防解压炸弹保护、大小检查)。
⚠️ PacketEdit 必须同时安装在服务器和每个客户端上。 原版客户端无法读取 ZSTD 流。你可以通过 JVM 参数 -Dpacketedit.zstd=false 禁用此模块。
✂️ NBT / 数据组件清理器
当物品不在玩家的活动快捷栏中时,服务器会在发送容器数据包之前剥离沉重的纯装饰性物品数据:
minecraft:custom_data(来自模组/插件的自定义 NBT——装饰、动画、标记)
minecraft:lore(长篇背景描述文本)
- 书本内容(只有在实际持有书本时才需要页面数据)
快捷栏、副手和盔甲槽始终接收完整数据。一旦物品被移入快捷栏,服务器会自动重新发送该槽位并附带完整数据——客户端永远不会持有“被剥离”的活动物品。仅从物品栈的副本中移除白名单内的组件,因此数据包对原版编解码器而言完全有效:无需客户端补丁、无物品栏不同步、无崩溃。
此模块仅在服务端生效,可通过 -Dpacketedit.scrubber=false 禁用。
配置(JVM 参数)
| 参数 |
默认值 |
说明 |
-Dpacketedit.zstd |
true |
启用 ZSTD 压缩 |
-Dpacketedit.zstd.level |
3 |
ZSTD 压缩级别(推荐实时使用 1–3) |
-Dpacketedit.zstd.threshold |
256 |
最小压缩数据包大小(字节) |
-Dpacketedit.scrubber |
true |
启用数据包清理器 |
要求
- Minecraft 1.21.11,Fabric Loader ≥ 0.19.3,Fabric API
- Java 21+
- ZSTD 压缩需在两端安装
PacketEdit
Network optimization for Fabric servers and clients. PacketEdit cuts network traffic and packet-processing CPU cost with two independent modules.
?️ ZSTD Packet Compression
Replaces vanilla's zlib packet compression with Zstandard (ZSTD) — a modern algorithm that compresses better and several times faster.
- Same wire framing as vanilla (
[VarInt size][payload]), only the algorithm changes — the rest of the pipeline is untouched.
- Packets smaller than 256 bytes are passed through uncompressed (no wasted CPU on tiny packets).
- Zero-copy native compression between off-heap buffers — no extra allocations on the Netty threads.
- Full vanilla-style validation on decode (decompression-bomb protection, size checks).
⚠️ PacketEdit must be installed on BOTH the server and every client. A vanilla client cannot read a ZSTD stream. You can disable this module with the JVM flag -Dpacketedit.zstd=false.
✂️ NBT / Data Component Scrubber
The server strips heavy, purely-cosmetic item data from container packets before they are sent, when the item is not in the player's active hotbar:
minecraft:custom_data (custom NBT from mods/plugins — cosmetics, animations, markers)
minecraft:lore (huge lore walls)
- Book contents (pages are not needed until the book is actually held)
Hotbar, offhand and armor slots always receive full data. As soon as an item is moved into the hotbar, the server automatically re-sends the slot with complete data — the client never ends up holding a "stripped" active item. Only whitelisted components are removed from a copy of the stack, so packets stay fully valid for the vanilla codec: no client-side patches, no inventory desync, no crashes.
This module is server-side only in effect and can be disabled with -Dpacketedit.scrubber=false.
Configuration (JVM flags)
| Flag |
Default |
Description |
-Dpacketedit.zstd |
true |
Enable ZSTD compression |
-Dpacketedit.zstd.level |
3 |
ZSTD compression level (1–3 recommended for realtime) |
-Dpacketedit.zstd.threshold |
256 |
Minimum packet size (bytes) to compress |
-Dpacketedit.scrubber |
true |
Enable the packet scrubber |
Requirements
- Minecraft 1.21.11, Fabric Loader ≥ 0.19.3, Fabric API
- Java 21+
- Installed on both sides for ZSTD compression
?? Кратко по-русски
PacketEdit — оптимизация сети: ZSTD-компрессия пакетов вместо ванильного zlib (быстрее и жмёт лучше) и срезание избыточного NBT (кастомные данные модов, огромный Lore, страницы книг) у предметов вне активного хотбара. Для ZSTD мод обязателен и на сервере, и на клиенте.
评论 0
登录后参与评分
还没有评论,来抢沙发吧