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.

Filename, size & hash SHA256 hash help File type Python version Upload date
mccq-1.0.1-py3-none-any.whl (17.4 kB) Copy SHA256 hash SHA256 Wheel py3
mccq-1.0.1.tar.gz (12.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page