MapEngine

MapEngine is a specialized library for Paper servers designed for working with maps in Minecraft. This solution offers developers a convenient API for creating maps with custom content, while using optimized working methods that have minimal impact on server performance.
Main Features
The library has a wide range of functions, including:
- Pipeline API for creating custom handlers
- Asynchronous content rendering
- Completely packet-based data transmission system
- Optional image smoothing using Floyd-Steinberg algorithm
- Layer grouping for significant network traffic reduction
- Individual buffering for each player with transmission of only changed pixels
- Packet bundling to prevent image tearing
- Drawing tools (text, components, lines, triangles, rectangles, circles, ellipses, polygons)
Color Conversion Cache Performance Graph
Live streaming via RTMP on maps
Example of live streaming on maps. The stream is played on a 7x4 map array. The stream source has 1920x1080@20 resolution and is transmitted via OBS.
Floyd-Steinberg dithering
Example of Floyd-Steinberg dithering in action. The stream is played on a 7x4 map array. The stream source has 1920x1080@20 resolution and is transmitted via OBS.
Supported Versions
| Server Version | Support |
|---|---|
| Paper 1.21.4 | ✔️ |
| Paper 1.21.3 | ✔️ |
| Paper 1.21.2 | ✔️ |
| Paper 1.21.1 | ✔️ |
| Paper 1.21 | ✔️ |
| Paper 1.20.x | ✔️ |
| Paper 1.19.4 | ✔️ |
| Paper 1.19.3 | ✔️ |
Usage
To work with MapEngine, you need to add the dependency to the plugin.yml file regardless of the build system used.
Maven
xml <repositories> <repository> <id>tjcserver</id> <url>https://repo.thejocraft.net/releases/</url> </repository> </repositories>
xml <dependencies> <dependency> <groupid>de.pianoman911</groupid> <artifactid>mapengine-api</artifactid> <version>1.8.7</version> <scope>provided</scope> </dependency> </dependencies>
Gradle (groovy)
groovy repositories { maven { url = 'https://repo.thejocraft.net/releases/' name = 'tjcserver' } } dependencies { compileOnly 'de.pianoman911:mapengine-api:1.8.7' }
Gradle (kotlin)
kotlin repositories { maven("https://repo.thejocraft.net/releases/") { name = "tjcserver" } } dependencies { compileOnly("de.pianoman911:mapengine-api:1.8.7") }
Code Example
public class Bar {
// getting the API instance
private static final MapEngineApi MAP_ENGINE = Bukkit.getServicesManager().load(MapEngineApi.class);
public void foo(BufferedImage image, BlockVector cornerA, BlockVector cornerB, BlockFace facing, Player viewer) {
// creating a map display instance
IMapDisplay display = MAP_ENGINE.displayProvider().createBasic(cornerA, cornerB, facing);
display.spawn(viewer); // displaying the map for the player
// creating an input pipeline element
// this object can also be used to draw simple shapes and text
IDrawingSpace input = MAP_ENGINE.pipeline().createDrawingSpace(display);
// drawing the image to the input pipeline element
input.image(image,0,0);
// drawing a triangle
input.triangle(0, 0, 10, 10, 20, 0, 0xff0000ff);
// adding a player to the pipeline context,
// so the player receives the map
input.ctx().receivers().add(viewer);
// enabling Floyd-Steinberg dithering
input.ctx().converter(Converter.FLOYD_STEINBERG);
// enabling per-player buffering
input.ctx().buffering(true);
// completing the pipeline work
// the drawing space can be reused
input.flush();
}
}
Project Building
- Clone the project (
git clone https://github.com/TheJoCraftNET/MapEngine.git) - Go to the cloned directory (
cd MapEngine) - Build the JAR file (
./gradlew buildon Linux/MacOS,gradlew buildon Windows)
The built plugin file will be located in the build → libs directory