Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alvin-pm-pl/simplemaprenderer
A PocketMine-MP Plugin that implements FilledMap
https://github.com/alvin-pm-pl/simplemaprenderer
pmmp-plugin pocketmine-plugin
Last synced: 3 months ago
JSON representation
A PocketMine-MP Plugin that implements FilledMap
- Host: GitHub
- URL: https://github.com/alvin-pm-pl/simplemaprenderer
- Owner: alvin-pm-pl
- License: mit
- Archived: true
- Created: 2020-11-15T01:05:56.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-19T11:00:45.000Z (over 2 years ago)
- Last Synced: 2024-09-26T10:20:35.197Z (3 months ago)
- Topics: pmmp-plugin, pocketmine-plugin
- Language: PHP
- Homepage:
- Size: 381 KB
- Stars: 23
- Watchers: 4
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SimpleMapRenderer
Simple Map Plugin for PocketMine-MP# How to use
Just put the plugin on plugins folder and enjoy it!![](https://raw.githubusercontent.com/alvin0319/SimpleMapRenderer/master/map_info.png)
# API
##### Get MapFactory instance
```php
$factory = \alvin0319\SimpleMapRenderer\MapFactory::getInstance();
```##### Get `MapData` object
```php
$mapId = your_map_id;
$mapData = $factory->getMapData($mapId);
```##### Register Map info
```php
$mapId = your_custom_map_id;
$colors = [];
$center = new Vector3(0, 0, 0);
for($y = 0; $y < 128; $y++){
for($x = 0; $x < 128; $x++){
$colors[] = new \pocketmine\utils\Color(mt_rand(0, 128), mt_rand(0, 128), mt_rand(0, 128));
}
}
$mapData = new \alvin0319\SimpleMapRenderer\data\MapData($mapId, $colors, false, $center);$factory->registerData($mapData);
```
##### Get block color
```php
$block = Level->getBlock($x, $y, $z);
$color = \alvin0319\SimpleMapRenderer\util\MapUtil::getMapColorByBlock($block);
```##### Save image file
```php
$filePath = path_to_your_png_file;
$colors = [];
for($y = 0; $y < 128; $y++){
for($x = 0; $x < 128; $x++){
$colors[] = new \pocketmine\utils\Color(mt_rand(0, 128), mt_rand(0, 128), mt_rand(0, 128));
}
}
\alvin0319\SimpleMapRenderer\util\ImageUtil::toPNG($filePath, $colors);
```#### Note
* `$mapId` cannot overlap with an existing ID.
* The `$color` must be a two-dimensional array from 0 to 128. (ex: `[y][x] = Color`)
# To-Do
* Implement MapDecoration (tracking player, mob, etc...)