Registry

Quarry can be told to encode/decode block, item and other information by setting the registry attribute on the in-use buffer. This can be set directly or by deriving a subclass and customizing get_buff_type(). The registry affects the following methods:

All registry objects have the following methods:

Registry.encode(kind, obj)[source]

Encodes a thing to an integer ID.

Registry.decode(kind, val)[source]

Decodes a thing from an integer ID.

Registry.encode_block(obj)[source]

Encodes a block to an integer ID.

Registry.decode_block(val)[source]

Decodes a block from an integer ID.

Registry.is_air_block(obj)[source]

Returns true if the given object is considered air for lighting purposes.

Quarry supports the following registry types:

class quarry.types.registry.OpaqueRegistry(max_bits)[source]

Registry that passes IDs through unchanged. This is the default.

class quarry.types.registry.BitShiftRegistry(max_bits)[source]

Registry implementing the Minecraft 1.7 - 1.12 bit-shift format for blocks.

Blocks decode to a (block_id, metadata) pair. Items pass through unchanged.

class quarry.types.registry.LookupRegistry(blocks, registries)[source]

Registry implementing a dictionary lookup, recommended for 1.13+.

Blocks decode to a dict where the only guaranteed key is u'name'. Items decode to a str name.

Use the from_jar() or from_json() class methods to load data from the official server.

classmethod from_jar(jar_path)[source]

Create a LookupRegistry from a Minecraft server jar file. This method generates JSON files by running the Minecraft server like so:

java -cp minecraft_server.jar net.minecraft.data.Main --reports

It then feeds the generated JSON files to from_json().

classmethod from_json(reports_path)[source]

Create a LookupRegistry from JSON files generated by the official server.