Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d-sketon/reimu-mc-generator
Generate minecraft player and server information images with reimu-mc-generator.
https://github.com/d-sketon/reimu-mc-generator
canvas minecraft
Last synced: 9 days ago
JSON representation
Generate minecraft player and server information images with reimu-mc-generator.
- Host: GitHub
- URL: https://github.com/d-sketon/reimu-mc-generator
- Owner: D-Sketon
- License: gpl-3.0
- Created: 2024-08-21T13:22:09.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-23T12:58:46.000Z (2 months ago)
- Last Synced: 2024-10-09T19:20:40.621Z (27 days ago)
- Topics: canvas, minecraft
- Language: TypeScript
- Homepage:
- Size: 3.49 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
reimu-mc-generator
Generate minecraft player and server information images with reimu-mc-generator.
## Install
```bash
npm i reimu-mc-generator
```## Usage
```ts
// Use this option to save the image to a file
type WriteFileOptions = {
type: "file";
path: string;
};
// Use this option to get the base64 string of the image
type Base64Options = {
type: "base64";
};
type Options = WriteFileOptions | Base64Options;// Use this function to draw player information
function drawPlayerInfo(
playerName: string,
basicInfo: string[],
options: Options
): Promise;// Use this function to draw server information
function drawServerInfo(
serverName: string,
basicInfo: string[],
ip: string,
port: number,
showUrl: boolean,
options: Options
): Promise;
```## Example
### Player Info
```ts
import { drawPlayerInfo } from "reimu-mc-generator";await drawPlayerInfo(
"D_Sketon",
[
"§aLevel: §f1",
"§aHealth: §f20",
"§aHunger: §f20",
"§aArmor: §f0",
"§aPosition: §f(0, 0, 0)",
],
{ type: "file", path: "player.png" }
);
```![player.png](https://fastly.jsdelivr.net/gh/D-Sketon/reimu-mc-generator/example/player.png)
### Server Info
```ts
import { drawServerInfo } from "reimu-mc-generator";await drawServerInfo(
"D_Sketon's Server",
[
"Current TPS = §a19.93",
"Maximum memory: §c6,144 MB.",
"Allocated memory: §e3,072 MB.",
"Free memory: §a1,381 MB.",
'World "World": 504 chunks, 1,150 entities, 1,516 tiles.',
'Nether "DIM-1": 0 chunks, 0 entities, 0 tiles.',
'The End "DIM1": 0 chunks, 0 entities, 0 tiles.',
],
"localhost",
25565,
false,
{ type: "file", path: "server.png" }
);
```![server.png](https://fastly.jsdelivr.net/gh/D-Sketon/reimu-mc-generator/example/server.png)
## License
The CODE of reimu-mc-generator is under the [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.html) license.
The IMAGE generated by reimu-mc-generator is under the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license.