Created by activivan
The Minetest SkinAPI allows you to personalize your Minetest Web Projects! You can easily get the head, a bust or a body preview of a Minetest skin from just the player name! You can even set the size of the result! It supports the most common skin mods as well as MineClone 2. Using Python Pillow and Flask it's fast and lightweight. Just drop it into your world folder and get started!
- Python 3 (
python3
) required - Supported Minetest Games:
minetest_game
andmineclone2
- Supported Minetest Skin Mods:
skinsdb
andsimple_skins
(only required ifminetest_game
is used) - Minetest SkinAPI currently only supports SQLite3 (
sqlite3
) as Minetest Database Backend (Minetest default Database). However, if you are usingminetest_game
and as skin modskinsdb
, you can use any Database.
Minetest SkinAPI needs to be put into the world folder of the world it should use the data of. You can use git to clone this repository into your desired world folder. For example:
cd minetest/worlds/myworld
git clone https://github.com/activivan/mtskinapi.git
After downloading Minetest SkinAPI, let's install the required python modules. Navigate into the mtskinapi
folder you just downloaded into your world folder. Then type into the command prompt:
pip3 install -r requirements.txt
Minetest SkinAPI can be configured via the config.ini
file. Some configurations are mandatory to be defined. We will now go through these. All possible configurations can be seen in the configuration.md
file.
To work, Minetest SkinAPI needs to know what game and what skin mod you are using. Currently, two games are being supported:
minetest_game
: https://content.minetest.net/packages/Minetest/minetest_game/mineclone2
: https://content.minetest.net/packages/Wuzzy/mineclone2/
You can set the game with:
game = minetest_game
As skin mods for the minetest_game
are currently supported:
- TenPlus1's
simple_skins
mod: https://content.minetest.net/packages/TenPlus1/simple_skins/ - bell07's
skinsdb
mod: https://content.minetest.net/packages/bell07/skinsdb/
You can set the skin mod with:
skin_mod = simple_skins
Note: If you are using mineclone2
you do not need to define a skin mod as one is already in the game - if you define a skin mod nevertheless it will just be ignored
To run your Minetest SkinAPI installation, we recommend using the bjoern WSGI Server (what to consider to run Minetest SkinAPI on another WSGI Server (e.g. Gunicorn) can be found below). Unfortunately, it only works with Linux systems, but as most of Minetest Servers are running on Linux this should be fine. The following steps are how you would do that on Ubuntu - if you are on another Linux Distribution, the steps may be similar.
To install bjoern, you first need to install libev
:
sudo apt-get install libev-dev
Now install bjoern itself with pip:
pip3 install bjoern
Note: If you use another Linux Distribution, this might help you: https://github.com/jonashaag/bjoern/wiki/Installation
To run Minetest SkinAPI in the background (what you want - otherwise it would block your terminal) it's recommended to use screen. Screen allows you to multiplex your terminal into virtual terminals, so you can run Minetest SkinAPI in a virtual terminal.
To install screen, type this into the command prompt:
sudo apt-get install screen
Now lets create a screen for Minetest SkinAPI. To do that type:
screen -S mtskinapi
You should be automatically attached to this new screen. Now, make sure that you are in the directory of the Minetest SkinAPI and start it by typing:
python3 app.py
You should be done! Your Minetest SkinAPI is running on the Host and Port you set in the configuration. Default is: 0.0.0.0:3008
-
If you want to stop the server, simply do
CTRL+C
-
To start it again, just type
python3 app.py
-
To leave the screen, so you can continue using your normal terminal, press
CTRL+A
and thenD
-
To enter the screen again, type
screen -r mtskinapi
Note: After you restarted your system, you will have to create a new screen!
It may be helpful to take a look at the screen documentation: https://www.gnu.org/software/screen/manual/screen.html
To use another WSGI Server like Gunicorn, you will first have to set this in the config.ini
file, as the default Minetest SkinAPI WSGI Server is bjoern. The entry must be in the server
category and has the key wsgi_server
. You can set it to anything but not bjoern
if you don't want to use bjoern. For example, if you want to use Gunicorn, you can type following to start Minetest SkinAPI (Gunicorn must be installed):
gunicorn -w 4 -b 0.0.0.0:3008 app:skinapi
(WSGI Application (Flask) has the name of skinapi
)
You can see an API documentation on the base url of your running app.
You can get the Head of a Player using following API structure:
http://example.com:3008/head/playername
You can also simply set the size of the result. Just add the width in pixels:
http://example.com:3008/head/playername/width
To get a Bust of a Player, use following API structure:
http://example.com:3008/bust/playername
Busts can also be resized. Add this time the height in pixels:
http://example.com:3008/bust/playername/height
You can also get a full body preview using following API structure:
http://example.com:3008/body/playername
Here it's also possible to set the size of the result. As with the bust you simply need to add the height in pixels:
http://example.com:3008/body/playername/height
Using following API structure you can get the full skin of a player:
http://example.com:3008/skin/playername
Minetest SkinAPI © 2021 by activivan is licensed under CC BY-SA 4.0
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material for any purpose, even commercially.
-
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
-
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
-
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
- You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
- No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
For more details: