Skip to main content

Minecraft command query program. Inspired by the in-game help command, with added features like multiple version support and expandable regex search.

Project description

Minecraft Command Query

Minecraft command query program. Inspired by the in-game help command, with added features like multiple version support and expandable regex search.

package-badge version-badge

Installation

Requires Python 3.6+, recommended with virtualenv or the like. Just install with pip:

pip install mccq

Database setup

MCCQ requires access to generated server files (namely commands.json), and so is compatible with Minecraft snapshot 18w01a and up.

Each version directory must remain as generated by the server, and all version directories should be in the same root database directory:

database_root/
  18w01a/
    generated/
      reports/
        commands.json
  18w02a/
    generated/
      reports/
        commands.json

These files can be loaded either from the local filesystem or the internet.

Basic usage

Enter the CLI (command line interface) by providing it a default version -s to query and a database location -d where version directories are located:

python -m mccq -s 18w01a -d "https://raw.githubusercontent.com/Arcensoth/mcdata"

Start with a basic command:

> say

This produces some output:

# 18w01a
say <message>

Which will generally outline all possible variations of the command for the specified version(s).

Try something a little more involved:

> effect
# 18w01a
effect clear|give ...

The command is rolled out until a choice can be made, which saves on vertical space and is often more readable than assigning a separate line to each possibility.

Program options

Various flags and options can be written before the command query to augment behaviour.

Normally several subcommands/arguments are condensed to one line, but -e can be used to forcibly expand the command:

> -e effect
# 18w01a
effect clear <targets>
effect clear <targets> <effect>
effect give <targets> <effect>
effect give <targets> <effect> <seconds>
effect give <targets> <effect> <seconds> <amplifier>
effect give <targets> <effect> <seconds> <amplifier> <hideParticles>

Be warned that this can cause a large amount of output for commands with many subcommands/arguments.

Search for specific subcommands/arguments:

> tag targets add
# 18w01a
tag <targets> add <name>

Notice how arguments are shown between <> but can be searched by name just like subcommands.

Speaking of arguments, use -t to render their types:

> -t tag targets add
# 18w01a
tag <targets: entity> add <name: string>

Use -v VERSION to query a particular version:

> -v 18w02a execute
# 18w02a
execute align|anchored|as|at|facing|if|in|positioned|rotated|run|store|unless ...

Repeat -v VERSION to query several versions at once:

> -v 18w01a -v 18w02a execute
# 18w01a
execute align|as|at|if|offset|run|store|unless ...
# 18w02a
execute align|anchored|as|at|facing|if|in|positioned|rotated|run|store|unless ...

For more precise control than -e can offer, provide -c CAPACITY to define a threshold for expansion:

> -c 5 time set
# 18w01a
time set day
time set midnight
time set night
time set noon
time set <time>
> -c 4 time set
# 18w01a
time set day|midnight|night|noon|<time>

This allows a command to expand so long as the total number of subcommands/arguments it contains does not exceed the given threshold.

Dynamic search

Each whitespace-separated search term of the provided query is treated as a regex pattern:

> execute a.*
# 18w01a
execute align <axes> -> execute
execute as <targets> -> execute
execute at <targets> -> execute

And so any combination of subcommands/arguments can be flexibly queried:

> t.* targets
# 18w01a
tag <targets> add <name>
tag <targets> list
tag <targets> remove <name>
teleport <targets> <destination>|<location> ...
tellraw <targets> <message>
title <targets> actionbar|clear|reset|subtitle|times|title ...

Search terms are case-insensitive:

> gamerule .*mob.*
# 18w01a
gamerule doMobLoot
gamerule doMobLoot <value>
gamerule doMobSpawning
gamerule doMobSpawning <value>
gamerule mobGriefing
gamerule mobGriefing <value>

Special case: a single . is treated as a wildcard and will match any term:

> clone . . . masked
# 18w01a
clone <begin> <end> <destination> masked
clone <begin> <end> <destination> masked force|move|normal

Which is a convenient way of quickly diving into the command.

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

mccq-1.0.2.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

mccq-1.0.2-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file mccq-1.0.2.tar.gz.

File metadata

  • Download URL: mccq-1.0.2.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for mccq-1.0.2.tar.gz
Algorithm Hash digest
SHA256 13c29a494f0c467fe6cbd0d3be02e2dfdc9bcf9d1edeb5c1bb259cb742c44db3
MD5 1ba658800cf9990b51adf5ef48cdd0df
BLAKE2b-256 67f5bc206c34e413a6359643cee0a54668ef29bcd12e61b4cace0c3d97802258

See more details on using hashes here.

File details

Details for the file mccq-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: mccq-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for mccq-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 abfad271f10b3a77149276024de35f82b56732df280f206335a15a539f3f5c54
MD5 071147cf1ef12e21c62989c03064db33
BLAKE2b-256 f96bf517a39126424af1e9fea52536b063268afcac07e2d00ff487b4adc8d537

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page