Cenerator
A Minecraft data pack creation utility
Features
- Procedurally generate Minecraft data packs with Python
- As this is just a fancy way of writing to files, it is fully customizable, for example with functions
- Some convenient shorthand features
- Outputs everything in a data pack, ready to go
Installation
Installed with pip, something like
pip3 install -U cenerator
Or perhaps on Windows
py -m pip install -U cenerator
Example usage
See examples/ directory for more examples.
Hello, world!
import cenerator
p = cenerator.Pack('hello_world',
default_namespace='hello_world',
description='A hello world datapack made with cenerator',
pack_format=71,
)
@p.func(tags = ['minecraft:load'])
def hello_world(c):
c('say Hello, world!')
This outputs a data pack which executes the command say Hello, world! on load.
Macros
The power of cenerator becomes more evident in more complex programs that need branching logic and complicated /execute chains.
The following example showcases use of functions that take c and use it to output commands (referred to as "macros")
def say_with_all(c, format_str, values):
for v in values:
c(f'say {format_str.format(v)}')
@p.func(tags = ['minecraft:load'])
def macro(c):
values = ['John', 'Joe', 'Jane', 'Jill']
say_with_all(c, 'Hello, {}!', values)
say_with_all(c, 'Goodbye, {}!', values)
This results in a mcfunction file with some otherwise tedious-to-write code:
say Hello, John!
say Hello, Joe!
say Hello, Jane!
say Hello, Jill!
say Goodbye, John!
say Goodbye, Joe!
say Goodbye, Jane!
say Goodbye, Jill!
This is extremely useful for situations where a lot of code must be repeated with different but constant parameters.
Metadata
Release files for cenerator 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cenerator-0.1.4.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cenerator-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.7 kB
Release files / cenerator-0.1.4.tar.gz
| Download URL | cenerator-0.1.4.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa9fee920ef80df0005dacd403a00de87ebc77e23e90a86109ed6a9ad98d3d2f
|
|
BLAKE2b-256 checksum How to use checksums |
fcde82ebe0ff1b2128a10d1768d691cc3b0e1b63a2efdbb6d4b153c17240d87f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / cenerator-0.1.4-py3-none-any.whl
| Download URL | cenerator-0.1.4-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c799b72b39a98fe80c7161992e3d772e9fb96054adbbac1922579e5c936f30ff
|
|
BLAKE2b-256 checksum How to use checksums |
68499d798b48c62630c566360fecd20352e73970d73275cfde526cf3e195268f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|