Tetrachord Lib

Tetrachord Lib

A lightweight library mod that provides various data structures such as KD Trees and Segment Trees, alongside some other utilitarian functionalities.

by
36.1K Downloads
fabricforgeneoforgelibraryoptimization
Rent Server with this Mod

Screenshots

Effectiveness of Optimization Figure 1
Test Area 2
Test Area 1
Effectiveness of Optimization Figure 2

About this Mod

Introduction

Numerous Minecraft mods have integrated functional features within both 2D and 3D environments[1][2][3], yet brute-force methods frequently prove inefficient. In this regard, we introduce Tetrachord Lib, a lightweight library modification designed to optimize diverse data structures.

Related Works

Server-side Optimization Mods

jellysquid3_[4] introduced Lithium, a groundbreaking optimization mod that enhances various facets of Minecraft servers. Employing precise algorithms to minimize chunk and block access, this mod enhances not only world generation but also AI for mobs, collision detection, discovery of points of interests (poi), and other crucial aspects to boost computational efficiency and decrease milliseconds per tick (mspt) of servers.

Spottedstar[5] introduced Starlight, an innovative modification that redefines the light engine of Minecraft to improve performance in chunk generation, block placement and destruction. In contrast to Phosphor[6], Starlight does not alter the vanilla light engine system - instead, it revolutionizes it by introducing a new algorithm.

Data Structures

The KD Tree[7] is a data structure utilized in high-dimensional spaces for the storage and organization of k-dimensional data points. Functioning as a binary tree, each node within the KD Tree represents a k-dimensional data point and is partitioned according to the feature values (dimensions) of the data point. KD trees are particularly well-suited for conducting range queries and nearest neighbor searches within high-dimensional datasets, and they can also contribute to optimizing data retrieval within the Minecraft world.

KD Tree

The Segment Tree[8] is a data structure utilized for handling range updates and queries. It divides a segment into smaller subsections and organizes them hierarchically in a tree structure. Segment trees are efficient for updating and querying data ranges. In the context of a Minecraft world represented as a 3D tensor, employing a segment tree can greatly improve performance when frequent range updates and queries are involved.

Segment Tree

Experiments

Evaluation

Spark[9] is a lightweight performance profiler mod, which shows detailed time costs of mods, memory and CPU usage, milliseconds per tick (mspt) and other metrics of performance of clients and servers. We utilized Spark and chose time costs and mspt as metrics to evaluate the capability of optimization of Tetrachord Lib.

Benchmarks

We implemented the aforementioned data structures and conducted experiments using the following benchmarks:

No Hostiles around Campfire

In a specific scenario, when players light campfires, the surrounding areas within a radius of several blocks will no longer spawn monsters. The original mod[1] offers a brute-force method that involves multiple block accesses, leading to a significant increase in mspt on the server and slowing down the game program. We chose to utilize KD Tree to implement this requirement. We utilized Spark profiler to record 1 minute of normal game progress under different parameter setting, and the experimental results are shown in the following figure:

Effectiveness of Optimization on

Ore Blocks near Beacon Increase Xp Drop

Considering the scenario where players mine blocks close to a beacon, they can receive an additional XP reward based on the number of ore blocks surrounding the mined block. The table below illustrates the response area and "ore score" associated with each type of ore block:

Type of Ore Copper Iron Gold Diamond Netherite
Response Area 5x5 9x9 13x13 17x17 19x19
Ore Score 1 1 1 2 3

We utilized Spark profiler to record 32 ore block placing and 32 block mining under different parameter setting, and the experimental results are shown in the following figure:

Effectiveness of Optimization on

Conclusion

Experiments show that Tetrachord lib plays an emphatic role in different situation, and provides a highly efficient way to implement some requirements on 2D and 3D space updates and queries.

Tetrachord Lib mod is currently working as a library, so developers can use it as a dependency to improve their mod performance.

References

[1] Serilum. No Hostiles Around Campfire. Modrinth 2022.

[2] Serilum. Healing Campfire. Modrinth 2022.

[3] Mikul, chubbymomo, skinnymomo. Cold Sweat. Modrinth 2023.

[4] jellysquid3_. Lithium. Modrinth 2021.

[5] Spottedstar. Starlight. Modrinth 2021.

[6] jellysquid3_. Phosphor. Modrinth 2021.

[7] Jon Louis Bentley. Multidimensional binary search trees used for associative searching. Commun. ACM 18, 9 (Sept. 1975), 509–517.

[8] Jon Louis Bentley. Solutions to Klee's rectangle problems, Unpublished Manuscript, 1977.

[9] Iucko. Spark. Modrinth 2021.

Available Versions

Tetrachord Lib v26.1+1.0.3release
MC 26.1, 26.1.1, 26.1.2neoforge
June 2, 2026
Tetrachord Lib v1.21+1.0.3release
MC 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11fabric
June 29, 2025
Tetrachord Lib v1.21+1.0.3release
MC 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11neoforge
August 19, 2024
Tetrachord Lib v1.20.6+1.0.3release
MC 1.20.5, 1.20.6neoforge
August 19, 2024
Tetrachord Lib 1.20+1.0.3release
MC 1.20.2, 1.20.3, 1.20.4neoforge
July 11, 2024

How to Install Tetrachord Lib on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (26.1.2).

3

Install Mod

Open the mod browser in the dashboard and search for "Tetrachord Lib". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabricforgeneoforge

Minecraft Versions

26.1.2, 26.1.1, 26.1 (+35 more)

Server-side

~ Optional

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

Tetrachord Lib server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (26.1.2). You can switch loaders with one click in the panel.

Is Tetrachord Lib compatible with fabric and forge and neoforge?

Tetrachord Lib officially supports fabric, forge, neoforge for Minecraft 26.1.2, 26.1.1, 26.1. Note: Forge and Fabric mods are NOT cross-compatible – pick one loader and stick with it. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with Tetrachord Lib – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Tetrachord Lib consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install Tetrachord Lib with just one click on your server.

Recommended RAM
4 GBfrom €5.2/mo
Minimum 3 GB | per 8 players
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
GNU Lesser General Public License v2.1 or later
Server-side
Optional

Supported Versions

26.1.226.1.126.11.21.111.21.101.21.91.21.81.21.71.21.61.21.5+28 more