Back to mods
ChunkAPI project artwork

CurseForge · Minecraft mod

ChunkAPI

Manage custom data inside chunks without hassle.

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which ChunkAPI release should I use?

Updated last month
Latest stable file 0.8.4
Game version 1.7.10
Loader Forge

ChunkAPI 0.8.4 targets 1.7.10 with Forge. The project page does not say whether this file belongs on the client, dedicated server, or both. All 1 required mods have matching files.

Where it goes

Is ChunkAPI required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release Forge
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does ChunkAPI 0.8.4 need?

0.8.4. Change the file and its required mods may change too.

All 1 required mods have matching files

Install UniMixins first. We found matching files for this game-version and loader setup.

UniMixins Needed by ChunkAPI 0.8.4
required
Matching file found Matched file: UniMixins 0.3.1

We only count dependency files that match this setup. A file for another loader does not fill the gap.

Before you install it

Add ChunkAPI without breaking your instance.

Built for ChunkAPI 0.8.4. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use 0.8.4. It targets 1.7.10 with Forge; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    Install UniMixins first. We found matching files for this game-version and loader setup.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside 0.8.4. It opens that exact file at the source.

About this project

What does ChunkAPI add?

A mod for adding custom data to chunks without the hassle of writing custom packets, event handling, loading hooks, and more.

Licensed under the LGPLv3 license

Originally developed by FalsePattern

Mod logo by Houstonruss

Goals

It is a goal to provide a way to add custom data to chunks without having to modify any vanilla classes. The API will also provide a simple way to implement the custom serialization/deserialization of the data, both for the networking and the NBT format. An optional goal is to provide a way to register DFUs for the custom data, but this is not a priority.

Non-Goals

It is not a goal to provide any kind of callback/hook system for anything except saving/loading and netcode, any kind of extra behavior should be implemented in the mod using ChunkAPI.

Storage is not provided by the API, the user is expected to implement their own storage system. A good example is using a mixin to add a field to the chunk class, and using that field to store the data.

Motivation

Modifying chunk packet data involved incompatibly modifying network packets, the chunk class, and the anvil chunk loader, which is a lot of work for a simple feature. This mod provides a way to add custom data to chunks without having to modify any of the vanilla classes yourself.

API and spec

The API exposes a way to add custom data to chunks, and a way to register custom serializers for the data.

ChunkDataManager

The ChunkDataManager itself is the primary class used for managing registrations, but does not implement functionality by itself. For that, you need to use the PacketDataManager, ChunkNBTDataManager, and SectionNBTDataManager interfaces included inside the ChunkDataManager class.

ChunkDataManager.PacketData

This interface is used for synchronizing data from the server to the client. If your data is only required on the server, you can freely skip implementing this interface.

ChunkDataManager.ChunkNBTData

This interface is used for saving/loading data from the chunk NBT. This is required if you want to keep persistent data across world reloads. Note, if you store data per block in the chunk, you should use SectionNBTData instead, as it is designed with the internal chunk format in mind.

ChunkDataManager.SectionNBTData

This interface is mostly identical to ChunkNBTData, but is designed for storing data per block in the chunk. Instead of being called once per chunk, it is called once per chunk section (16x16x16 blocks, ExtendedBlockStage class).

ChunkDataRegistry

This is where you actually register your manager. You need to do all registrations inside the init phase. You can also disable specific manager IDs by calling disableDataManager, but this is not recommended, and should only be used if you know what you are doing. You need to do all the disabling inside the postInit phase.

Packet specification

ChunkAPI modifies the S21PacketChunkData and S26PacketMapChunkBulk vanilla packets, and overwrites their default formats.

All sizes in the tables below are specified in bytes.

S21PacketChunkData new format:

Size (bytes) Datatype Name
4 int X position
4 int Z position
1 bool Force Update
2 short ExtendedBlockStorage mask
4 int Uncompressed data length
4 int (n) Compressed data length
n byte[n] Compressed data

S26PacketMapChunkBulk new format:

Size (bytes) Datatype Name
2 short (n) Chunk count in packet
n * 4 int[n] Uncompressed chunk data lengths
4 int (m) Compressed data length
1 1 Contains skylight data
m byte[m] Compressed data
n * 10 (int, int, short)[n] Chunk Headers (x, z, ebs mask)

In both cases, the compressed data is populated through the ChunkDataRegistryImpl.writeToBuffer method. The layout of this data is as follows:

Size (bytes) Datatype Name
4 int (n) Manager count
n * varying MGRData Manager data

Manager data:

Size (bytes) Datatype Name
4 int (n) Manager name length
n UTF-8 str Manager name
4 int (m) Manager data length
m byte[m] Manager data

Dependencies

FalsePatternLib

UniMixins

Project description from CurseForge.

Pick your setup

ChunkAPI by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

1 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

ChunkAPI versions and loaders

23 of 23 releases match

Looking for an older file? The official CurseForge project page is in Resources.