DBSynchronizer

article published on 28th October 2019 (last modification on 3rd August 2022)

Minecraft is a video game that has a very large community around modding:

Minecraft constitutes a rather particular case since a simplified mods support system has been created, but by the community of players itself over the years, and not by developers as an official element.

— translated from Wikipedia FR

For example, some mods called "shaders" improve the graphic qualities of the game:

Minecraft with shaders

Wanting to make my own contribution, I started to develop some mods for the game. I then realized that there was, almost every time, a tedious task to perform: client/server data synchronization. This task is necessary even if we don’t want to use the mod in multiplayer, because Minecraft is built on a client/server architecture, so even when one is playing alone, a local server runs.

I then developed the mod "DBSynchronizer" which is completely transparent for the player, but which is a library for the other modders.

This library provides access to a lightweight key-value database stored in RAM. The data stored there is automatically synchronized between the server and the clients. The data can also be stored automatically on game save.

Quick example for storing an integer:

DatabaseGetter.getInstance(MOD_ID).getPersistentFolder().setInt("an integer", 42);

DBSyncronizer is available for download here and a tutorial is available here (in French).