Skip to main content

A Minecraft data pack creation utility

Project description

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.

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

cenerator-0.1.4.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

cenerator-0.1.4-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file cenerator-0.1.4.tar.gz.

File metadata

  • Download URL: cenerator-0.1.4.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cenerator-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fa9fee920ef80df0005dacd403a00de87ebc77e23e90a86109ed6a9ad98d3d2f
MD5 28acea49204c80a1ba89aa75ce458f88
BLAKE2b-256 fcde82ebe0ff1b2128a10d1768d691cc3b0e1b63a2efdbb6d4b153c17240d87f

See more details on using hashes here.

File details

Details for the file cenerator-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: cenerator-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cenerator-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c799b72b39a98fe80c7161992e3d772e9fb96054adbbac1922579e5c936f30ff
MD5 08c75b82e2545f977ade8c95b5296616
BLAKE2b-256 68499d798b48c62630c566360fecd20352e73970d73275cfde526cf3e195268f

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