MapEngine
描述
MapEngine 是一个面向 Paper 服务器的地图库插件。它提供了一个简单的 API,用于创建包含自定义内容的地图。 通过采用轻量级和异步技术,MapEngine 对服务器性能的影响非常小。
特性
- 用于自定义管道的流水线 API
- 异步渲染
- 完全基于数据包
- 可选抖动处理(Floyd-Steinberg)
- 将图层组解释为 Z 层,以节省巨大的网络流量
- 按玩家进行缓冲,仅向玩家发送更改的像素
- 可选的数据包捆绑可防止撕裂现象
- 绘图工具(文本、组件、线条、三角形、矩形、圆形、椭圆、多边形)
颜色转换缓存性能图表
地图上的 RTMP 实时流媒体
这是一个在地图上播放直播流的示例。该流在一个 7x4 的地图数组上播放。 流源为 1920x1080@20,使用 OBS 进行推流。Floyd-Steinberg 抖动效果
这是一个启用了 Floyd-Steinberg 抖动效果的地图示例。该流在一个 7x4 的地图数组上播放。 流源为 1920x1080@20,使用 OBS 进行推流。Javadoc
托管版本的 Javadoc 请参阅 此处。
支持
| 服务器版本 | 是否支持 |
|---|---|
| Paper 1.21.11 | ✔️ |
| Paper 1.21.10 | ✔️ |
| Paper 1.21.9 | ✔️ |
| Paper 1.21.8 | ✔️ |
| Paper 1.21.7 | ✔️ |
| Paper 1.21.6 | ✔️ |
| Paper 1.21.5 | ✔️ |
| 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 | ✔️ |
用法
无论使用何种构建系统,都必须在 plugin.yml 中将 MapEngine 添加为依赖项。
Maven
<repositories>
<repository>
<id>minceraft</id>
<url>https://repo.minceraft.dev/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>de.pianoman911</groupId>
<artifactId>mapengine-api</artifactId>
<version>1.8.11</version>
<scope>provided</scope>
</dependency>
</dependencies>
Gradle (groovy)
repositories {
maven {
url = 'https://repo.minceraft.dev/releases/'
name = 'minceraft'
}
}
dependencies {
compileOnly 'de.pianoman911:mapengine-api:1.8.11'
}
Gradle (kotlin)
repositories {
maven("https://repo.minceraft.dev/releases/") {
name = "minceraft"
}
}
dependencies {
compileOnly("de.pianoman911:mapengine-api:1.8.11")
}
示例
public class Bar {
// 获取 API 实例
private static final MapEngineApi MAP_ENGINE = Bukkit.getServicesManager().load(MapEngineApi.class);
public void foo(BufferedImage image, BlockVector cornerA, BlockVector cornerB, BlockFace facing, Player viewer) {
// 创建地图显示实例
IMapDisplay display = MAP_ENGINE.displayProvider().createBasic(cornerA, cornerB, facing);
display.spawn(viewer); // 为玩家生成地图显示
// 创建输入管道元素
// 此对象也可用于绘制简单的形状和文本
IDrawingSpace input = MAP_ENGINE.pipeline().createDrawingSpace(display);
// 将图像绘制到输入管道元素中
input.image(image,0,0);
// 绘制一个三角形
input.triangle(0, 0, 10, 10, 20, 0, 0xff0000ff);
// 将玩家添加到管道上下文中,
// 使玩家接收地图数据
input.ctx().receivers().add(viewer);
// 启用 Floyd-Steinberg 抖动效果
input.ctx().converter(Converter.FLOYD_STEINBERG);
// 启用按玩家缓冲
input.ctx().buffering(true);
// 刷新管道
// 绘图空间可以被重用
input.flush();
}
}
更详细的示例可以在 MinceraftMC/MapEngineExamples 仓库中找到。
构建
- 克隆项目 (
git clone https://github.com/MinceraftMC/MapEngine.git) - 进入克隆的目录 (
cd MapEngine) - 构建 Jar 文件 (
./gradlew buildon Linux/MacOS,gradlew buildon Windows)
插件 jar 文件位于 build → libs 目录中
MapEngine
Description
MapEngine is a map library plugin for paper servers. It provides a simple API to create maps with custom content. Using lightweight and asynchronous techniques, MapEngine has a very low impact on server performance.
Features
- Pipelined API for custom pipelines
- Asynchronous rendering
- Completely packet based
- Optional dithering (Floyd-Steinberg)
- Groups as z-layer interpretation for saving immense network traffic
- Per player buffering, only the changed pixels are sent to the player
- Optional packet bundling prevents tearing
- Drawing utilities (text, components, lines, triangles, rectangles, circles, ellipses, polygons)
Color Conversion Cache Performance Graph
Live streaming via RTMP on maps
This is an example of a live stream on a map. The stream is played on a 7x4 map array. The Stream source is 1920x1080@20 streamed with OBS.Floyd Sternberg dithering
This is an example of a map with Floyd-Steinberg dithering enabled. The stream is played on a 7x4 map array. The Stream source is 1920x1080@20 streamed with OBS.Javadoc
A hosted version of the javadoc can be found here.
Support
| Server Version | Supported |
|---|---|
| Paper 1.21.11 | ✔️ |
| Paper 1.21.10 | ✔️ |
| Paper 1.21.9 | ✔️ |
| Paper 1.21.8 | ✔️ |
| Paper 1.21.7 | ✔️ |
| Paper 1.21.6 | ✔️ |
| Paper 1.21.5 | ✔️ |
| 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
MapEngine has to be added as a dependency to the plugin.yml regardless of the build system used.
Maven
<repositories>
<repository>
<id>minceraft</id>
<url>https://repo.minceraft.dev/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>de.pianoman911</groupId>
<artifactId>mapengine-api</artifactId>
<version>1.8.11</version>
<scope>provided</scope>
</dependency>
</dependencies>
Gradle (groovy)
repositories {
maven {
url = 'https://repo.minceraft.dev/releases/'
name = 'minceraft'
}
}
dependencies {
compileOnly 'de.pianoman911:mapengine-api:1.8.11'
}
Gradle (kotlin)
repositories {
maven("https://repo.minceraft.dev/releases/") {
name = "minceraft"
}
}
dependencies {
compileOnly("de.pianoman911:mapengine-api:1.8.11")
}
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) {
// 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();
}
}
More detailed examples can be found in the MinceraftMC/MapEngineExamples repository.
Building
- Clone the project (
git clone https://github.com/MinceraftMC/MapEngine.git) - Go to the cloned directory (
cd MapEngine) - Build the Jar (
./gradlew buildon Linux/MacOS,gradlew buildon Windows)
The plugin jar can be found in the build → libs directory
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MapEngine
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
- 通过 @pianoman911 在 #24 中添加了对 26.1 的支持
- 移除了对 1.19.3、1.19.4 的支持
完整更新日志:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧