mcpy-compiler
A niche little compiler made in python that will go through all your addon files and compile them to an output (such as com_mojang folder) and watch for any changes to compile them instantly!
Features
-
Automatic manifest generation. It will check what you have, such as scripts, and add it to the manifest automatically!
-
Optimized outputs. Removes blank lines, and ignores comments in files. (excluding scripts)
-
Pretty fast. I tested the compiler on a personal project that has about 2000~ varying files, and compiled them all in about 3 seconds!
-
Convert jpeg and webp to png. The compiler will automatically convert jpeg and webp images to png!
-
Automatic texture defining. The compiler can go through all your textures and place them in
item_texture.jsonautomatically with no need to do it manually. (the texture definition will be the filename, works also for blocks, and texture list) -
Build projects into addons easily! Can compile all your files and then neatly place them into an mcaddon file!
-
Search & Replace words/characters. Use
searcher.jsonand insert a keyword to find in each file and replace. -
Each file compiler flag. Each file can have it's own compiler flags, which is simply the first line of any file with a comment saying it's flag.
Getting started
Create a config.json file at the root directory of your project and set it up:
You can use this example config
Please note that the actual config cannot have comments, and the compiler will fail if you try run it with a commented config
{
"output": "@com_mojang", // Where to compile output, use '@com_mojang' to go directly to com_mojang folder.
"auto_manifest": true, // Whether to use the automatic manifest generation tool.
"project_name": "test", // Project display name
"project_description": "test", // Project description
"target_version": "1.20.80", // Target minecraft version
"script_entry": "scripts/Main.js", // If using scripts, where the entry point is
"packs": [ // What packs you will be using `bp` and/or `rp`
"bp",
"rp"
],
"show_compiled": false, // Whether to display succesfully compiled files
"compile_confusing_files": false // Whether to compile unknown or confusing files, if true, the compiler will compile them as a bytes file.
"auto_texture_defining": true, // Whether to use the auto texture defining feature.
"auto_textures_do": [ // Which textures to define if `auto_texture_defining` is `true`
"items",
"blocks",
"list"
],
"show_dates": true, // Whether to show the date and time when a file compiles (`show_compiled` must be true)
"use_searcher": true // Whether to compile with the searcher.json keys.
}
Next create a python script at the root directory of your project, and imort mcpy_compiler, you may tinker with it, but if you want to just get to it call mcpy_compiler.run() and it will do everything you need it to do!
from mcpy_compiler import mcpy_compiler
mcpy_compiler.run()
To build a project:
from mcpy_compiler import mcpy_compiler
mcpy_compiler.build(True, True)
If you run into any problems please create a github issue!
Key notes
- This might work on mac and linux although I can't make any promises, as long as you have the
outputset to something else other than@com_mojang. - Sometimes a file might compile twice in one go.
- Only webp and jpg/jpeg images will be converted to png.
- The output is erased before new files are compiled into it.
Metadata
Release files for mcpy-compiler 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcpy_compiler-0.5.0.tar.gz | 11.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcpy_compiler-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / mcpy_compiler-0.5.0.tar.gz
| Download URL | mcpy_compiler-0.5.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93a18af4679350a25a2386525fced9baba0da407f224c217a35e0a8935f93098
|
|
BLAKE2b-256 checksum How to use checksums |
ea4befc8d3c465fc79cf4443e88ee5075c381e6809e9ed1965f73fe8c5ac44df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / mcpy_compiler-0.5.0-py3-none-any.whl
| Download URL | mcpy_compiler-0.5.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ad2479dcf084b9ecf2f6e7263860059d9228940e1f6007eb3f0e207b184742d
|
|
BLAKE2b-256 checksum How to use checksums |
af8113e59b45e7e1d72bc9beaee4b8c5024dc5287243e8b77c525ee79794accb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for mcpy-compiler 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.