A Python-based Minecraft NBT editor supporting Bedrock editions
Project description
Minecraft NBT Editor (Python)
A Python-based Minecraft NBT editor supporting Bedrock editions. This project is a complete rewrite of the original VSCode plugin, designed to work on Linux and other platforms.
Features
- Full NBT Support: All NBT tag types (Byte, Short, Int, Long, Float, Double, String, ByteArray, IntArray, LongArray, List, Compound)
- Multi-Format Support: .dat, .nbt, .mca, .mcstructure files
- Complete Editing Operations: Create, Read, Update, Delete, Move, Composite edits
- Bedrock Minecraft Support: Little-endian format with optional 8-byte headers
- Command Line Interface: Easy to use in automation scripts
- Comprehensive Error Handling: Robust data validation and error reporting
- Cross-Platform: Works on Linux, Windows, and macOS
Installation
From PyPI (Recommended)
pip install minecraft-nbt-editor
From Source
git clone https://github.com/geniusshiun/minecraft-nbt-editor.git
cd minecraft-nbt-editor
pip install -e .
Quick Start
After installation, you can use the minecraft-nbt or nbt-editor command:
# View NBT file content
minecraft-nbt view level.dat
# Get a specific value
minecraft-nbt get level.dat --path "Data.Player.GameType"
# Set a value
minecraft-nbt set level.dat --path "Data.Player.GameType" --value "1"
# Add a new tag
minecraft-nbt add level.dat --path "Data.CustomTag" --value "Hello World" --type string
# Remove a tag
minecraft-nbt remove level.dat --path "Data.CustomTag"
Usage Examples
Basic Commands
# View file info (shows format, compression, endianness)
minecraft-nbt info level.dat
# View NBT file structure with limited depth
minecraft-nbt view level.dat --max-depth 3
# View as JSON format
minecraft-nbt view level.dat --format json
# View as table format
minecraft-nbt view level.dat --format table
# Get specific value
minecraft-nbt get level.dat --path "GameType"
# Set specific value
minecraft-nbt set level.dat --path "GameType" --value 1
# Enable features (Bedrock specific)
minecraft-nbt enable level.dat --exp --backup
Common Minecraft Operations
Game Settings
# Get current game type (0=Survival, 1=Creative, 2=Adventure, 3=Spectator)
minecraft-nbt get level.dat --path GameType
# Change to Creative mode
minecraft-nbt set level.dat --path GameType --value 1
# Get current difficulty (0=Peaceful, 1=Easy, 2=Normal, 3=Hard)
minecraft-nbt get level.dat --path Difficulty
# Set difficulty to Hard
minecraft-nbt set level.dat --path Difficulty --value 3
# Get world name
minecraft-nbt get level.dat --path LevelName
# Change world name
minecraft-nbt set level.dat --path LevelName --value "My Awesome World"
Player Spawn Location
# Get spawn coordinates
minecraft-nbt get level.dat --path SpawnX
minecraft-nbt get level.dat --path SpawnY
minecraft-nbt get level.dat --path SpawnZ
# Set new spawn location
minecraft-nbt set level.dat --path SpawnX --value 100
minecraft-nbt set level.dat --path SpawnY --value 64
minecraft-nbt set level.dat --path SpawnZ --value 200
Game Rules and Features
# Check if cheats are enabled
minecraft-nbt get level.dat --path cheatsEnabled
# Enable cheats
minecraft-nbt set level.dat --path cheatsEnabled --value 1
# Get keep inventory setting
minecraft-nbt get level.dat --path keepinventory
# Enable keep inventory
minecraft-nbt set level.dat --path keepinventory --value 1
# Check daylight cycle
minecraft-nbt get level.dat --path daylightCycle
# Stop daylight cycle
minecraft-nbt set level.dat --path daylightCycle --value 0
Bedrock Edition Specific
# Get experimental features
minecraft-nbt get level.dat --path experiments
# Enable all experimental features at once (with backup)
minecraft-nbt enable level.dat --exp --backup
# Enable all experimental features without backup
minecraft-nbt enable level.dat --exp
# Get player abilities
minecraft-nbt get level.dat --path abilities.flying
minecraft-nbt get level.dat --path abilities.mayfly
# Enable flight for player
minecraft-nbt set level.dat --path abilities.mayfly --value 1
minecraft-nbt set level.dat --path abilities.flying --value 1
# Get world version info
minecraft-nbt get level.dat --path MinimumCompatibleClientVersion
minecraft-nbt get level.dat --path lastOpenedWithVersion
Enable Command (Bedrock Edition)
The enable command provides quick access to commonly needed Minecraft Bedrock features:
# Enable all experimental features at once
minecraft-nbt enable level.dat --exp --backup
# Available experimental features that will be enabled:
# - data_driven_biomes: Data-driven biomes
# - experimental_creator_cameras: Experimental creator cameras
# - experiments_ever_used: Experiments usage tracking
# - gametest: GameTest framework
# - jigsaw_structures: Jigsaw structure support
# - saved_with_toggled_experiments: Experiment toggle tracking
# - upcoming_creator_features: Upcoming creator features
# - villager_trades_rebalance: Villager trade rebalancing
# - y_2025_drop_3: 2025 Q3 features
Advanced Search Operations
# Search for specific values
minecraft-nbt search level.dat --value "survival"
# Search by tag type
minecraft-nbt search level.dat --type string
# Search by tag name pattern
minecraft-nbt search level.dat --name "GameType"
# Search in specific path
minecraft-nbt search level.dat --path abilities --type byte
Batch Operations
# Convert NBT to JSON for external processing
minecraft-nbt convert level.dat --output level.json --format json
# Create backup before editing
cp level.dat level.dat.backup
# Batch modify multiple settings
minecraft-nbt set level.dat --path GameType --value 1
minecraft-nbt set level.dat --path cheatsEnabled --value 1
minecraft-nbt set level.dat --path keepinventory --value 1
Development
Setup Development Environment
git clone https://github.com/geniusshiun/minecraft-nbt-editor.git
cd minecraft-nbt-editor
pip install -r requirements-dev.txt
pip install -e .
Run Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=src
# Run specific test file
pytest test_basic.py
Code Quality
# Format code
black src/
# Lint code
flake8 src/
# Type checking
mypy src/
Project Structure
src/
├── core/
│ ├── __init__.py
│ ├── nbt_types.py # NBT tag type definitions
│ ├── nbt_path.py # NBT path operations
│ ├── nbt_file.py # NBT file I/O
│ └── operations.py # Editing operations
├── cli/
│ ├── __init__.py
│ └── main.py # Command line interface
└── utils/
├── __init__.py
└── binary.py # Binary operations
Supported File Types
- Java Edition: Big-endian NBT files (typically gzipped)
- Bedrock Edition: Little-endian NBT files with optional 8-byte headers
- Compression: Gzip, Zlib, or uncompressed
- Formats: .dat, .nbt, .mca, .mcstructure
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Original VSCode plugin reference project
- Minecraft community for NBT format documentation
- Python community for excellent libraries and tools
Changelog
See CHANGELOG.md for a list of changes and version history.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minecraft_nbt_editor-0.3.0.tar.gz.
File metadata
- Download URL: minecraft_nbt_editor-0.3.0.tar.gz
- Upload date:
- Size: 135.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
082c5a65ec8beeba21aa691e1b1aa3f4133b222a0a4ff2a56668c5d018c621e2
|
|
| MD5 |
aedc16e545d3e800e8e2f5a873b4be33
|
|
| BLAKE2b-256 |
50dd497b38b44899c0ce3f701f7ff6219f62b8ae22378aee5b470369bfa00ecc
|
File details
Details for the file minecraft_nbt_editor-0.3.0-py3-none-any.whl.
File metadata
- Download URL: minecraft_nbt_editor-0.3.0-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00060b79d70d3e595202269ff86e0c7d4412eafd4f5eb354312a118381153351
|
|
| MD5 |
fbcb1c63a8b1f80237407822c2223d55
|
|
| BLAKE2b-256 |
ce62a26f8ca559e5ee450dec3d683712d649b865202d4c1882f987b1193206f5
|