Skip to content

Python utilities for downloading and processing Minecraft's generated data.

License

Notifications You must be signed in to change notification settings

Arcensoth/mcgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcgen

Python utilities for downloading and processing Minecraft's generated data.

PyPI PyPI - Python Version Code style: black

Requirements

  • Python 3.8+
  • Java 11+ (for invoking the Minecraft server's data generator)

Installation

pip install mcgen

Usage

python -m mcgen --help
mcgen [-h] [--jarpath JARPATH] [--rawpath RAWPATH] [--outpath OUTPATH] [--version VERSION] [--manifest MANIFEST] [--processors [PROCESSORS [PROCESSORS ...]]] [--log LOG]

Download the Minecraft server jar for the specified version, invoke the data generator, and process the output.

optional arguments:
  -h, --help            show this help message and exit
  --jarpath JARPATH     Where to download and store the server jar. Default: temp/jars/minecraft_server.{version}.jar
  --rawpath RAWPATH     Where to store the raw server-generated files. Default: temp/raw/{version}
  --outpath OUTPATH     Where to write the final processed output. Default: temp/out/{version}
  --version VERSION     The server version to download and process. Defaults to latest snapshot.
  --manifest MANIFEST   Where to fetch the version manifest from. Defaults to Mojang's online copy.
  --processors [PROCESSORS [PROCESSORS ...]]
                        Which processors to use in processing the raw server-generated files. Defaults to a set of built-in processors.
  --log LOG             The level of verbosity at which to print log messages.

Processors

Processors are used to process the raw server-generated data and produce output. They are invoked one after the other, in the order they are defined.

To provide a custom set of processors, use the --processors option like so:

python -m mcgen --processors mcgen.processors.split_registries mcgen.processors.summarize_data

Built-in processors

Several built-in processors are provided in mcgen.processors:

Custom processors

Processors are Python modules containing a function with the following signature:

def process(ctx: Context, **options):
    ...
  • ctx contains information about the processing context
  • options is a key-value mapping of arbitrary data

21w39a

Note that in snapshot 21w39a the java command used to invoke the server generator changed:

# Prior to 21w39a:
java -cp {jar_path} net.minecraft.data.Main --server --reports

# From 21w39a onward:
java -DbundlerMainClass=net.minecraft.data.Main -jar {jar_path} --server --reports

If you need to generate data for versions prior to 21w39a, use the --cmd option with the older java command.

About

Python utilities for downloading and processing Minecraft's generated data.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages