Code Monkey home page Code Monkey logo

mccq's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.