https://github.com/ading2210/mcutils
A collection of utilities for interacting with Minecraft servers.
https://github.com/ading2210/mcutils
Last synced: 5 months ago
JSON representation
A collection of utilities for interacting with Minecraft servers.
- Host: GitHub
- URL: https://github.com/ading2210/mcutils
- Owner: ading2210
- License: gpl-2.0
- Created: 2022-03-12T10:15:35.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-13T00:29:51.000Z (almost 4 years ago)
- Last Synced: 2025-01-24T06:28:54.672Z (12 months ago)
- Language: Python
- Size: 43 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mcutils
A collection of utilities for interacting with Minecraft servers.
## Documentation
### extractor.py
A tool to extract the client jar file.
```python
from utils import extractor
#extract the client jar file
print("Downloading and extracting the client...")
extractor_obj = extractor.Extractor("1.16.5")
extracted_path = extractor_obj.extract_jar()
print("Client extracted to:", extracted_path)
#get a list of death messages
death_messages = extractor_obj.get_death_messages()
```
### rcon.py
Interface with the Minecraft RCON protocol.
```python
from utils import rcon
#send a command to the local server
rcon = rcon.RCON("127.0.0.1", 25575, "password")
#returns a string with the command's output
output = rcon.send_cmd("list")
print(output)
rcon.close()
```
### query.py
Interface with the Minecraft query protocol.
```python
from utils import query
#query the local server
query_obj = query.Query(("127.0.0.1", 25565))
#retuns a dict with some stats
full_stat = query_obj.full_stat()
basic_stat = query_obj.basic_stat()
print(full_stat)
```
### ping.py
Ping any Minecraft server above version 1.7.
```python
from utils import ping
#ping the local server
pinger = ping.Pinger(("127.0.0.1", 25565))
#retuns a dict with some stats
stats = pinger.ping()
print(stats)
```
### motd_renderer.py
Generate a nearly pixel-perfect image of what a server would look line in the client's server list.
You need to have Pillow installed for this to work (`pip3 install Pillow`).
```python
from utils import motd_renderer
#renders an image of the server's motd and icon
renderer = motd_renderer.MOTDRenderer()
#returns a PIL image object
image = renderer.get_full_image(title="Hypixel", address=("mc.hypixel.net", 25565))
image.save("/tmp/img.png", "PNG")
```
Generated image:
