Skip to main content

Minecraft command emulator library

Project description

mcemu

A lightweight, programmatic, and interactive Minecraft Command Emulator designed as a standalone Python library and REPL environment. It simulates a virtual Minecraft environment, allowing you to test, debug, and execute complex command sequences and .mcfunction files without needing to launch the game!

🚀 Features

  • Interactive REPL Environment: Start the engine right from your terminal and type commands in real time. Features colored syntax feedback, auto-suggestions, and deep typo detection.
  • .mcfunction Support: Load and execute function files, complete with support for scheduling and ticking.
  • Robust Entity Management: Create and manage players and entities dynamically within a simulated world, complete with inventory and active effects tracking.
  • Scoreboard Simulation: A fully-featured programmatic scoreboard that replicates the in-game behavior for mathematical operations and player tracking.
  • Command Dispatcher: An exact replica of the Minecraft command-tree parsing structure, enabling you to chain execute contexts.

📦 Installation

To install mcemu directly from PyPI (once published):

pip install mcemu

If you are developing locally, clone the repository and install it in editable mode with development dependencies:

git clone https://github.com/OguzhanUmutlu/mcemu.git
cd mcemu
pip install -e .[dev]

🎮 Usage

Once installed, mcemu exposes a powerful command-line interface. Simply open your terminal and type:

mcemu

This will launch the interactive engine:

Minecraft Command Engine v3.0 (Programmatic API)
Type 'exit' to quit, 'scores' to list scoreboards, 'entities' to list entities.
mcemu> 

Supported Commands

The emulator currently supports the following base commands:

  • clear
  • data
  • effect
  • enchant
  • execute
  • function
  • give
  • item
  • kill
  • return
  • schedule
  • scoreboard
  • summon
  • tag
  • teleport (and tp)
  • tick

Example Interaction

mcemu> scoreboard objectives add kills dummy
data returned 1

mcemu> give @p minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:5}]} 1
data returned 1

mcemu> effect give @p minecraft:speed 100 2 true
data returned 1

mcemu> entities
- Dev (minecraft:player) at (0.0, 0.0, 0.0) tags: set()
  inventory: {'inventory.0': {'id': 'minecraft:diamond_sword', 'count': 1, 'nbt': '{Enchantments:[{id:"minecraft:sharpness",lvl:5}]}'}}
  effects: {'minecraft:speed': {'duration': 2000, 'amplifier': 2, 'hideParticles': True}}

🧪 Testing

To run the built-in test suite locally, use the provided script:

./run_tests.sh

This automatically sets up a virtual environment and runs pytest across the package.

📄 License

This project is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcemu-0.1.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcemu-0.1.2-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file mcemu-0.1.2.tar.gz.

File metadata

  • Download URL: mcemu-0.1.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mcemu-0.1.2.tar.gz
Algorithm Hash digest
SHA256 44f7c4e9237847b9064e6f55121ee2ed773c452a10d6ee5aa2db5f5adfac9581
MD5 877761abcce6e75cbb416bafa125ff7e
BLAKE2b-256 2a512c7b26d62fa1cc2a79ee72b8d73474c7decfed2115650db11fe650869ac1

See more details on using hashes here.

File details

Details for the file mcemu-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mcemu-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mcemu-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 470fd8dd6086dd4edbe0beb65eff1a11a4e28a13f3b136cd9cfc706d7075a451
MD5 22f58371eeb5173419103b95a466331c
BLAKE2b-256 ba029883ef67d81e6159c63c5279963c01138cc6ea49cd9c79bdec4a345e6e74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page