Quickstart

Welcome in the sandbox!

Blockgames like Luanti or Minecraft give you the ideal playground for creative playing and building just like a real sandbox. But other than real sandboxes, you can work on very large worlds together with your friends over the internet. And you can use (very simplified) physics, save the progress and more.

But what about learning programming while expressing your creativity? Why not automate things? Or build even greater things?

Installation

Miney consists of two parts: the Luanti mod and the Python library. The Luanti mod is required to connect to the game, while the Python library provides the API for interacting with the game.

Windows

>>> pip install miney

Linux

  • Download the latest Luanti by following instruction on https://www.luanti.org/downloads/

  • You should have Python 3 installed, if not, install it with your package manager.

  • Install miney by opening a terminal and typing:

>>> pip3 install miney

MacOS

>>> pip install miney

For all Plattforms

  • Luanti:
    • Install the Miney mod by starting Luanti and clicking to “Content”, “Browse online content” and searching for miney.

  • Python:
    • You can install Miney systemwide by typing this in a command prompt: “pip install miney”

    • Suggestion: Make yourself familiar with venv’s, so you can isolate different development environments. A good starting point is https://docs.python.org/3/tutorial/venv.html

How to start a game

  • Start Luanti and create a new world.

  • Press the “Select Mods” Button, then select “miney” and enable it. Close this screen by pressing “Save”.

  • Activate the “Host Server” option, so that the miney client (and others) can connect to your game.

  • Press “Host Game” to start.

  • Run your favorite Python IDE or editor and start coding!

Verify your setup

After installing Miney and the Luanti mod, it’s a good idea to verify that everything is working together. The check_setup.py script is designed for this purpose. It connects to your Luanti server, performs a few basic actions, and reports whether the connection was successful.

View Code (check_setup.py)
 1"""
 2Miney Setup Checker
 3===================
 4
 5This script connects to a Luanti server to verify that both the server and
 6the Miney library are correctly configured. It gathers and displays key
 7information, such as the server version, online players, and the number of
 8registered nodes and tools.
 9
10This is the recommended first script to run after installing Miney to ensure
11your environment is ready.
12
13How to Run:
141. Make sure the `miney` mod is installed and enabled on your Luanti server.
152. Run this script from your terminal, providing connection details if needed:
16   python examples/check_setup.py [server] [port] [playername] [password]
17"""
18import logging
19import sys
20
21from miney import Luanti, LuantiConnectionError
22
23# --- Logger Setup ---
24# Configure a simple logger for clean and informative output
25logging.basicConfig(
26    level=logging.INFO,
27    format="%(asctime)s | %(levelname)-8s | %(message)s",
28    datefmt="%Y-%m-%d %H:%M:%S",
29)
30logger = logging.getLogger(__name__)
31
32
33if __name__ == "__main__":
34    # --- Connection Details ---
35    server = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1"
36    port = int(sys.argv[2]) if len(sys.argv) > 2 else 30000
37    username = sys.argv[3] if len(sys.argv) > 3 else "miney"
38    password = sys.argv[4] if len(sys.argv) > 4 else "ChangeThePassword!"
39
40    logger.info(f"Attempting to connect to {server}:{port} as '{username}'...")
41
42    try:
43        # Use a 'with' statement for automatic connection management
44        with Luanti(server=server, playername=username, password=password, port=port) as lt:
45            logger.info("Connection successful!")
46            print("-" * 40)
47            logger.info("--- Luanti & Miney Setup Check ---")
48
49            # 1. Get Server Information
50            server_version = lt.version
51            logger.info(f"Luanti Server Version: {server_version}")
52
53            # 2. Get Player Information
54            players = list(lt.players)
55            player_count = len(players)
56            player_names = ", ".join([p.name for p in players]) if players else "None"
57            logger.info(f"Players Online ({player_count}): {player_names}")
58
59            # 3. Get World Content Information
60            # This confirms that Miney can access the game's content database
61            node_count = len(list(lt.nodes.names))
62            tool_count = len(list(lt.tool))
63            logger.info(f"Registered Node Types: {node_count}")
64            logger.info(f"Registered Tool Types: {tool_count}")
65
66            print("-" * 40)
67
68            # 4. Final Verification
69            if node_count > 10 and tool_count > 0:
70                logger.info("✅ Verification successful. Miney appears to be correctly set up!")
71            else:
72                logger.warning("⚠️ Verification complete, but with warnings.")
73                logger.warning("Low node/tool count may indicate an issue with the server or mod.")
74
75    except LuantiConnectionError as e:
76        logger.critical(f"❌ Connection Failed: {e}")
77        logger.critical("Please check the following:")
78        logger.critical("  - Is the Luanti server running?")
79        logger.critical("  - Are the server address and port correct?")
80        logger.critical("  - Is the 'miney' mod installed and enabled on the server?")
81        logger.critical("  - Is the password correct?")
82    except KeyboardInterrupt:
83        logger.info("\nScript interrupted by user.")
84    except Exception as e:
85        logger.critical(f"An unexpected error occurred: {e}", exc_info=True)
86    finally:
87        logger.info("Script finished.")

Just copy the code in a file named check_setup.py and open a terminal in the same folder and type this into it:

>>> python check_setup.py
...
2025-08-11 01:03:43 | INFO     | ✅ Verification successful. Miney appears to be correctly set up!
2025-08-11 01:03:44 | INFO     | Disconnecting from server
2025-08-11 01:03:44 | INFO     | Script finished.

This is the best way to confirm your setup before diving into more complex projects. You can find this and other examples in the Code Examples section.

First lines of code

The first lines of code with Miney should be the import statement and the creation of the Miney object “lt” (short for Luanti). This will connect Miney to your already running Luanti.

import miney

lt = miney.Luanti()

Important

Whenever you see a object “lt” in the documentation, it was created with this line!

Interactive Exploration with the Python Shell

Miney is designed to be highly interactive, making it perfect for use in a Python REPL (Read-Eval-Print Loop) or an IDE like IDLE. This allows you to explore the game world and the Miney API without needing to write and run a full script—an excellent way for beginners to learn and experiment.

Note

IDLE is Python’s Integrated Development and Learning Environment and is included with every Python installation. You can start it from your command line by typing python -m idlelib.idle.

A key feature is dynamic auto-completion. Miney fetches information like node types and online player names from the server and makes them available for tab-completion in modern Python shells.

Example: Interacting with Players

You can easily see and interact with online players. Type lt.players. in your Python shell and press the Tab key. You will see a list of all online players. You can then access a player object directly by their name to get their properties.

Example of player completion in a Python REPL
>>> lt.players.  # Press Tab
lt.players.miney          lt.players.HumanPlayer          lt.players.Player3
>>>
>>> lt.players.HumanPlayer
<miney.player.PlayerIterable object at 0x000001AD4F56F4D0>
>>> lt.players.HumanPlayer.position
<Luanti Point(x=-145.0, y=6.0, z=-243.0)>

Example: Discovering Node Types

Similarly, you can discover all available node types. Type lt.nodes.names. and press Tab. You’ll see a list of all registered node names (e.g., default:stone, flowers:rose). You can then use these names as strings in functions that manipulate the world.

Discovering and using a node name
>>> from miney import Point
>>> lt.nodes.names.  # Press Tab
>>> lt.nodes.names.default.  # Press Tab
>>> lt.nodes.names.default.apple  # Press Enter
'default:apple'
>>> lt.nodes.set(Point(10, 20, 30), lt.nodes.names.default.apple)

This powerful interactive discovery feature significantly lowers the barrier to entry, especially in educational settings, as you can learn and explore what’s possible directly within the Python shell.