Block Wrangler
A Python library to help Minecraft shader developers deal with block IDs.
It allows shader developers to define "flags" that block states can have, and the script will generate both a block.properties file and corresponding GLSL functions to allow those flags to be used directly in shaders.
It includes all Vanilla blocks and tags, as well as a few custom categories that are commonly used in shaders, and automatically enforces that numerical block IDs are both complete and mutually exclusive.
Installation
pip install block-wrangler
Usage
Below is a simple example of how to use the library. More complete documentation is coming soon.
from block_wrangler import *
from pathlib import Path
shaderpack_root = Path(__file__).parent
def main():
tags = load_tags()
mapping = BlockMapping.solve({
'sway': EnumFlag({
'upper': tags['sway/upper'],
'lower': tags['sway/lower'],
'hanging': tags['sway/hanging'],
'floating': tags['sway/floating'],
'full': tags['sway/full']
}),
'sway_slow': Flag(tags['sway/slow']),
'crops': Flag(tags['minecraft:crops']), # Vanilla tags are included
'water': Flag(blocks('minecraft:water')) # Individual blocks can also be referenced by name
})
with shaderpack_root.joinpath('shaders/block.properties').open('w') as f:
f.write(mapping.render_encoder())
with shaderpack_root.joinpath('shaders/util/block_properties.glsl').open('w') as f:
f.write(mapping.render_decoder())
print('Done!')
if __name__ == '__main__':
main()
Core Concepts
The block_wrangler library uses a few main concepts:
Block Types
These represent the different types of blocks that can be found in Minecraft, and all of their properties.
Tags
Tags generate a semantically meaningful group of block states that can be used to define flags.
The library comes with all Vanilla tags, and a few more that are commonly used in shaders.
They can use other tags in their definitions, and their actual contents are calculated on demand.
Block Collections
These are a more concrete representation of a group of block states. Tags can create them, or you can define them manually.
Mappings
Mappings store the actual numeric IDs that go into your block.properties file.
Metadata
Release files for block-wrangler 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| block_wrangler-0.0.8.tar.gz | 107.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| block_wrangler-0.0.8-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 264.9 kB
Release files / block_wrangler-0.0.8.tar.gz
| Download URL | block_wrangler-0.0.8.tar.gz |
|---|---|
| Size | 107.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29936b3688f3f54d8f4ef8421d85e1517a862599401293bf01be1b8bd4cbfc60
|
|
BLAKE2b-256 checksum How to use checksums |
afc01a7b029c01f54ed7d81d14a7e1709182592ec863dd418ce3c36b41366a2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / block_wrangler-0.0.8-py2.py3-none-any.whl
| Download URL | block_wrangler-0.0.8-py2.py3-none-any.whl |
|---|---|
| Size | 157.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ce1147fcf2c5ff9d228e103072c806bf2444d2d5c2081e64f1b5427f0efb270b
|
|
BLAKE2b-256 checksum How to use checksums |
d58984fdeb60171a380a66b040e74ccbdac8946597b9e97b5eb45a588ac28f30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|