GDPC itself is still compatible with 1.16.5, but its only HTTP backend - the
GDMC-HTTP mod - is not.)
New and renamed modules
All of GDPC's modules have changed substantially, but many have held the same
general purpose. Most of these have been renamed, however:
- `direct_interface` -> `interface`
- `interface` -> `editor`\
(The `Interface` class is now the `Editor` class.)
- `toolbox` -> `minecraft_tools` and `editor_tools`\
The latter contains tools that require an `Editor`, while the former contains
tools that don't.
- `bitarray` and `worldLoader` -> `world_slice`
Lots of new modules have been added:
- `block`: Provides the `Block` class, more on this later.
- `block_state_tools`: Provides tools to work with orientation-related
[block states](https://minecraft.wiki/Block_states).
This is mainly for internal use.
- `exceptions`: Contains exception classes for GDPC.
- `model.py`: Provides the `Model` class, which can be used to store a structure
in memory. Future versions will add features like scanning in models from
Minecraft.
- `nbt_tools`: Provides some low-level tools for the
[NBT format](https://minecraft.wiki/NBT_format). This is mainly for
internal use.
- `transform`: Provides the `Transform` class and related utilities, more on
this later.
- `utils`: Provides various generic utilities that GDPC uses internally, but
may also be useful to others.
- `vector_tools`: Provides lots of vector math utilities, including the helpful
classes `Rect` and `Box`. Vectors are described further below.
Tutorials
The `examples` directory now contains various small tutorial-like scripts that
demonstrate and explain one particular feature of GDPC.
Editor class
The class that was previously called `Interface` is now called `Editor`, and
has received many new features. Most of these are described below. An important
change, however, is that there is no longer a "global" editor: there is no
more free `placeBlock()` function. You have to create an `Editor` instance and
then use `Editor.placeBlock()`.
Block class
This version introduces the `Block` class, which represents a Minecraft block.
The API for placing and retrieving blocks now uses this class instead of
strings: you place and get `Block("stone")` instead of `"stone"`.
Blocks consist of three components:
- A (namespaced) id (e.g. `minecraft:chest`).
- Optional [block states](https://minecraft.wiki/Block_states)
(e.g. `facing=north`).
- Optional [block entity](https://minecraft.wiki/Block_entity)
(S)NBT data (e.g. `{Items: [{Slot: 13b, id: "apple", Count: 1b}]}`).
The `Block` class supports all three of these. In other words, GDPC now fully
supports both placing and retrieving blocks with block states and NBT data!
No longer do you need to send separate commands to modify a block's NBT data
after placing it!
See `Block.py` and the advanced block tutorial for more details.
The `Block` class also plays an important role in enabling GDPC's new
transformation system - more on that further below.
Vectors
All GDPC functions that take position paramaters (i.e. nearly all of them) now
work with *vectors*, rather than separate x, y and z coordinates. GDPC is
however quite flexible in the types of vectors it accepts: any sequence of
numbers will do. That includes things like lists, tuples, numpy arrays and more.
Internally, GDPC now uses vector objects from the `pyGLM` package. Whenever a
GDPC function returns a vector, it will also be from this module. The `pyGLM`
vectors support various vector math operators that make lots of common
operations much easier and faster. They are also the basis of many of the more
advanced additions listed below.
See the the vector tutorial for more details about vectors.
Transformations
The most important addition is probably the transformation system. It allows you
to "transform" your frame of reference for placing and retrieving blocks, so
that you can always build using local coordinates instead of global ones. The
idea is based on the use of transformation matrices in typical 3D graphics
applications.
If you're programming, say, a house function, you could just always build the
house at (0,0,0) with its door pointing north, and then later call the function
with different transformations to place the house at any position and under any
rotation!