NotEnoughPalette (NEP) — 优化 Minecraft 的 PalettedContainer。
NEP 是 Minecraft PalettedContainer 的透明、即插即用替代方案,它是每个区块部分中区块和生物群系存储背后的数据结构。它用即时直接数组访问替换了原版基于位打包的 SimpleBitStorage,无需位打包,也无需单元格索引计算,同时保持与原版网络协议兼容,因此可以随时添加或移除,而不会出现世界或网络问题。
工作原理
每个区块部分会根据其内容选择最适合的存储模式:
| 模式 |
存储方式 |
用途 |
SingleStorage |
单个值 |
均匀区块(例如全空气) |
IndirectStorage |
byte[4096] + 调色板(≤256种类型) |
典型区块 |
CharGlobalStorage |
char[4096] 全局 ID |
多样化区块(>256种类型) |
IntGlobalStorage |
int[4096] 全局 ID |
极端整合包(>65535个方块) |
所有修改路径均已优化:工厂创建、编解码器反序列化、网络读写、复制和重建。内存使用量在典型区块下不超过原版的 1.5 倍,通常更少。
性能表现
在 24 核 i9-12900HX 处理器上使用 125 TNT 进行测试(Minecraft 26.2,两个配置均启用 Lithium 0.25.0,NEP 为唯一差异项):
| 指标 |
Lithium |
Lithium + NEP |
| TPS (1分钟) |
13.73 |
13.99 |
| MSPT (平均值) |
201.9 ms |
192.6 ms |
| MSPT (95%百分位) |
252.8 ms |
241.9 ms |
| MSPT (最大值) |
542.4 ms |
495.1 ms |
在仅使用 Lithium 的基础上,NEP 带来了 -4.6% 平均 MSPT、-4.3% p95、-8.7% 最大值提升,以及 +1.9% TPS。
兼容性
- Fabric (Loader ≥ 0.19.3) 和 NeoForge (≥ 26.2.0.1-beta) 集成在一个混合 JAR 中
- 支持纯客户端 / 纯服务器可选 — PalettedContainer 在两端运行,且 NEP 的序列化格式与原版字节完全一致,因此未安装 NEP 的客户端可以正常连接安装了 NEP 的服务器,反之亦然
- 可与 Lithium 和 Sodium 等性能模组共存
NotEnoughPalette (NEP) — Optimize Minecraft's PalettedContainer.
NEP is a transparent, drop-in replacement for Minecraft's PalettedContainer, the data structure behind block and biome storage in every chunk section. It replaces vanilla's bit-packed SimpleBitStorage storage with instant direct-array access — no bit packing, no cell-index math — while remaining wire-compatible with vanilla so it can be added or removed at any time without world or network issues.
How it works
Each chunk section picks the storage mode that fits its contents:
| Mode |
Storage |
Use |
SingleStorage |
single value |
uniform sections (e.g. all-air) |
IndirectStorage |
byte[4096] + palette (≤256 types) |
typical sections |
CharGlobalStorage |
char[4096] global IDs |
diverse sections (>256 types) |
IntGlobalStorage |
int[4096] global IDs |
extreme modpacks (>65535 blocks) |
Every mutation path is optimized: factory creation, codec deserialization, network read/write, copy and recreate. Memory usage is ≤1.5× vanilla for typical sections, often less.
Performance
Benchmarked with 125 TNT on a 24-core i9-12900HX (Minecraft 26.2, Lithium 0.25.0 enabled in both configs, NEP the only difference):
| Metric |
Lithium |
Lithium + NEP |
| TPS (1m) |
13.73 |
13.99 |
| MSPT (mean) |
201.9 ms |
192.6 ms |
| MSPT (95%ile) |
252.8 ms |
241.9 ms |
| MSPT (max) |
542.4 ms |
495.1 ms |
On top of Lithium alone, NEP delivers -4.6% mean MSPT, -4.3% p95, -8.7% max, and +1.9% TPS.
Compatibility
- Fabric (Loader ≥ 0.19.3) and NeoForge (≥ 26.2.0.1-beta) in a single hybrid JAR
- Pure client / pure server optional — PalettedContainer runs on both sides, and NEP's serialized format is byte-identical to vanilla, so clients without NEP connect fine to NEP servers and vice versa
- Works alongside performance mods like Lithium and Sodium
评论 0
登录后参与评分
还没有评论,来抢沙发吧