NotEnoughPalette

NotEnoughPalette

Optimize Minecraft's PalettedContainer

65 downloads
1 followers

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

No gallery available for this project.