Skip to content
 
 

Repository files navigation

Not Enough Bandwidth (NEB) — Fabric Port

Fabric mod for Minecraft 26.1 — Network bandwidth optimization through packet header indexing, aggregation + Zstd compression, delayed chunk caching, persistent client-side chunk deduplication, and chunk light stripping.

Need support or a port for another version? Open an issue, join QQ group 362669270 (invite link), or email support@rms.net.cn.

This is an unofficial Fabric port of the original NeoForge mod by USS_Shenzhou. If you want to contribute to the upstream project, please discuss with USS_Shenzhou on Discord first.

Introduction

NEB uses various methods to save as much network traffic as possible during Minecraft gameplay, while remaining transparent to both mods and players.

In the TeaCon Jiachen dataset, compared to raw uncompressed data, NEB can theoretically reduce the server's outbound traffic to 7.6% of its original size. For comparison, the outbound traffic of Vanilla's default compression mechanism is 39% of the original data size.

In tests conducted in a Vanilla environment, the server outbound traffic was reduced to 18% of its original size. As the number of installed mods increases, compression performance improves.

Press N in-game to view the network traffic status.

Main Features

Compact Packet Header

Optimizes CustomPacketPayload encoding and decoding by replacing the packet header Identifier (Packet Type) with a compact VarInt index. This reduces the mod network packet header overhead to a fixed 3-4 bytes, instead of the length of the string corresponding to the network packet type.

Note

Fixed 8 bits header

+------------- 1 byte (8 bits) ---------------+
|               function flags                 |
+---+---+--------------------------------------+
| i | t |      reserved (6 bits)               |
+---+---+--------------------------------------+
  • i = indexed (1 bit)
  • t = tight_indexed (1 bit, only valid if i=1)
  • reserved = 6 bits (for future use)

Indexed packet type

  • If i=0 (not indexed): full Identifier in UTF-8 follows.
  • If i=1 and t=0 (indexed, NOT tight): 3 bytes — 12-bit namespace-id + 12-bit path-id (capacity 4096 each).
  • If i=1 and t=1 (indexed, tight): 2 bytes — 8-bit namespace-id + 8-bit path-id (capacity 256 each).

Aggregation and Compression

Optimizes the situation where vanilla often produces a large number of small network packets. Intercepts transmission at the Connection level, assembles them into one large network packet every 20ms, and sends it after Zstd compression.

Note

+---+-----+----+----+----+----+----+----...
| B | (S) | p0 | s0 | d0 | p1 | s1 | d1 ...
+---+-----+----+----+----+----+----+----...
          +--packet 1---++--packet 2---+
          +---------compressed---------+
  • B = bool, whether compressed
  • S = varint, size of uncompressed data (only present if compressed)
  • p = prefix (medium/int/utf-8), type of this subpacket
  • s = varint, size of this subpacket
  • d = bytes, data of this subpacket

Delayed Chunk Cache (DCC)

In Vanilla, when a player moves, the server instructs the client to immediately forget the chunks behind them; if the player returns to the original position, the full chunk data must be sent again. By delaying this "forgetting", the chunk transmission traffic generated when moving back and forth can be saved.

Persistent Chunk Cache (PCC)

Caches chunk data persistently on the client side using a local LevelDB database, keyed by a 64-bit content hash. On each connection, the client sends a Bloom Filter of all cached chunk hashes to the server. When the server is about to send a chunk whose hash is in the filter, it sends only the 20-byte hash instead of the full packet (~10–20 KB). The client loads the chunk from its local database. On a Bloom Filter false positive, the client requests the full data as a fallback. The Bloom Filter is refreshed every 64 newly cached chunks so the optimization takes effect within the same session.

Chunk Light Stripping

When enabled, the server omits sky/block light nibble layers from chunk packets and the client recomputes full-chunk lighting after the chunk loads. This is useful for measuring and reducing the light-data share of chunk transmission without changing chunk block or block-entity data.

Configuration

Modify the configuration file at config/NotEnoughBandwidthConfig.json.

compatibleMode

Works independently on client and server.

Whether to enable compatibility mode. If set to true, the blackList below will be used.

blackList

Works independently on client and server.

The blacklist for compatibility mode. Packets listed here will be skipped by NEB. You can add packets as needed.

Warning

To ensure packet ordering, packets in the blacklist will interrupt the ongoing aggregation. If there are many packets in the blacklist, or if the corresponding packets are sent too frequently, the efficiency of aggregation-compression will decrease.

compressionLevel

Works independently on client and server.

The Zstd compression level (integer 1-19). Default is 6. Higher values produce better compression but use more CPU.

contextLevel

Works independently on client and server.

The Zstd context window size (integer 21-25, representing 2-32MB). Default is 23 (8MB). Larger values result in better compression but consume more memory.

Tip

For a server with 100 players, a setting of 25 will result in approximately 3200MB of additional memory usage.

dccSizeLimit, dccDistance, dccTimeout

Server only.

Delayed Chunk Cache (DCC) parameters: max cached chunks, cache distance, cache timeout (seconds). Larger values may consume more memory, while smaller values may trigger updates more frequently.

chunkCacheEnabled

Client only.

Whether to enable the Persistent Chunk Cache. Default is true.

chunkCacheMaxSizeMB

Client only.

Maximum size of the local chunk cache database in megabytes. Default is 2048 (2 GB).

lightStripEnabled

Client and server.

Whether to strip chunk light data from server chunk packets and recompute it on the client. Default is false.

Installation

Requires:

  • Minecraft 1.20.1, 1.21.1 – 26.1 (download the jar matching your version)
  • Fabric Loader (>= 0.15 on 1.20.1, >= 0.16 on 1.21.1, >= 0.18.4 on 26.1)
  • Fabric API

Both client and server must install NEB. When a client without NEB connects, the server falls back to vanilla behavior for that connection.

Development

All supported Minecraft versions build from this single branch using the ReplayMod preprocessor:

  • src/main is the source of truth, written against the newest version (26.1).
  • Version differences use //#if MC>=<ver> comment conditionals, @Pattern templates (util/VersionPatterns.java) for shape changes, and versions/mapping-*.txt for renames the mapping join cannot infer.
  • Gradle subprojects are auto-discovered from the versions/<mc>/ directories and share common.gradle. Per-version settings (loader/fabric-api versions, MC dependency range) live in versions/<mc>/gradle.properties; per-version resource overrides (such as the access widener) live in versions/<mc>/src/main/resources/.

Common commands:

./gradlew build collectJars   # build every version; jars land in build/libs/
./gradlew :1.21.4:build       # build a single version
./gradlew benchmark           # run the bandwidth benchmark (26.1)

License

Copyright (C) 2025 USS_Shenzhou

This mod is free software under the GNU GPL 3.0. See LICENSE for details.

Additional Permissions

As a game player, when you load and play this program in Minecraft, this license automatically grants you all rights necessary, which are not covered in the GPL-3.0 license, or are prohibited by the GPL-3.0 license, for the normal loading and playing of this program in Minecraft. In case of conflicts between the GPL-3.0 license and the Minecraft EULA or other Mojang/Microsoft terms, the latter shall prevail.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages