### Java Example: Creating and Drawing on a Map Display
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
This Java code demonstrates how to use the MapEngine API to create a map display, draw an image and a triangle onto it, configure rendering options like dithering and buffering, and send it to a specific player. It requires the MapEngine API and Bukkit API.
```java
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) {
// create a map display instance
IMapDisplay display = MAP_ENGINE.displayProvider().createBasic(cornerA, cornerB, facing);
display.spawn(viewer); // spawn the map display for the player
// create an input pipeline element
// this object can also be used to draw simple shapes and text
IDrawingSpace input = MAP_ENGINE.pipeline().createDrawingSpace(display);
// draw the image to the input pipeline element
input.image(image, 0, 0);
// draw a triangle
input.triangle(0, 0, 10, 10, 20, 0, 0xff0000ff);
// add a player to the pipeline context,
// making the player receive the map
input.ctx().receivers().add(viewer);
// enable floyd-steinberg dithering
input.ctx().converter(Converter.FLOYD_STEINBERG);
// enable per player buffering
input.ctx().buffering(true);
// flush the pipeline
// the drawing space can be reused
input.flush();
}
}
```
--------------------------------
### Clone MapEngine Project
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
Clones the MapEngine project repository from GitHub. This is the first step in setting up the project for building.
```bash
git clone https://github.com/TheJoCraftNET/MapEngine.git
```
--------------------------------
### Build MapEngine Plugin JAR (Linux/MacOS)
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
Builds the MapEngine plugin JAR file using the Gradle wrapper on Linux or macOS. The resulting JAR will be located in the build/libs directory.
```bash
./gradlew build
```
--------------------------------
### Build MapEngine Plugin JAR (Windows)
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
Builds the MapEngine plugin JAR file using the Gradle wrapper on Windows. The resulting JAR will be located in the build/libs directory.
```batch
gradlew build
```
--------------------------------
### Navigate to Project Directory
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
Changes the current directory to the root of the cloned MapEngine project. This is necessary before running build commands.
```bash
cd MapEngine
```
--------------------------------
### Gradle (Groovy) Dependency for MapEngine API
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
This snippet demonstrates how to include the MapEngine API as a dependency in a Gradle project using Groovy syntax. It configures the Maven repository and specifies the compile-only dependency.
```groovy
repositories {
maven {
url = 'https://repo.minceraft.dev/releases/'
name = 'tjcserver'
}
}
dependencies {
compileOnly 'de.pianoman911:mapengine-api:1.8.9'
}
```
--------------------------------
### Gradle (Kotlin) Dependency for MapEngine API
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
This snippet illustrates how to add the MapEngine API dependency to a Gradle project using Kotlin syntax. It sets up the required Maven repository and defines the compile-only dependency.
```kotlin
repositories {
maven("https://repo.minceraft.dev/releases/") {
name = "tjcserver"
}
}
dependencies {
compileOnly("de.pianoman911:mapengine-api:1.8.9")
}
```
--------------------------------
### Maven Dependency for MapEngine API
Source: https://github.com/froglightnet/mapengine/blob/master/README.md
This snippet shows how to add the MapEngine API as a dependency in a Maven project. It specifies the repository to use and the artifact details, including version and scope.
```xml
tjcserver
https://repo.minceraft.dev/releases/
de.pianoman911
mapengine-api
1.8.9
provided
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.