8. API ReferenceΒΆ

The picraft package consists of several modules which permit access to and modification of a Minecraft world. The package is intended as an alternative Python API to the “official” Minecraft Python API (for reasons explained in the Frequently Asked Questions).

The classes defined in most modules of this package are available directly from the picraft namespace. In other words, the following code is typically all that is required to access classes in this package:

import picraft

For convenience on the command line you may prefer to simply do the following:

from picraft import *

However, this is frowned upon in code as it pulls everything into the global namespace, so you may prefer to do something like this:

from picraft import World, Vector, Block

This is the style used in the Recipes chapter. Sometimes, if you are using the Vector class extensively, you may wish to use the short-cuts for it:

from picraft import World, V, O, X, Y, Z, Block

The following sections document the various modules available within the package: