Mecha Custom Components
A library to easily extend your Mecha/Bolt code with custom components
Introduction
This package provides an easy way to create your own custom components for mcfunction, using the Beet/Mecha ecosystem.
Features
- Extensible component registry
Example Usage
Extracted from here
Beet Plugin
from beet import Context
from nbtlib import Base, Compound
from mecha_custom_components import CustomComponentRegistry
def simple_component(properties: Base, components: dict[str, Base]):
if not isinstance(properties, Compound):
raise Exception("'example:simple' expects a compound!")
custom_data = components.setdefault("minecraft:custom_data", Compound({}))
if not isinstance(custom_data, Compound):
raise Exception("Existing custom_data was not a compound!")
custom_data.merge({"foo": properties["value"]})
return components
def beet_default(ctx: Context):
registry = ctx.inject(CustomComponentRegistry)
registry.extend("example:foo", simple_component)
Bolt code
give @s stick[example:foo={value: 1}]
When compiled becomes:
give @s stick[minecraft:custom_data={foo: 1}]
More examples can be found in the examples folder.
Installation
The package can be installed with pip.
$ pip install mecha-custom-components
Metadata
Release files for mecha-custom-components 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mecha_custom_components-0.0.3.tar.gz | 2.8 kB | Without provenance | Details for mecha_custom_components-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mecha_custom_components-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for mecha_custom_components-0.0.3-py3-none-any.whl |
Total release size: 6.1 kB
Release files / mecha_custom_components-0.0.3.tar.gz
| Download URL | mecha_custom_components-0.0.3.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb0a7010579348db5e3c08be6d1b775b8e666f91beaff05b7cf57fa7b2b8c3b1
|
|
BLAKE2b-256 checksum How to use checksums |
84ca717778842dbf6d2ad4741e99840ef908b954d343b28c799b01a124d7f772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.12.0 readme-renderer/44.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.3.0 tqdm/4.67.1 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.11
|
Release files / mecha_custom_components-0.0.3-py3-none-any.whl
| Download URL | mecha_custom_components-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36073666759ffecb6c3781ce7304c4a7a79baf8a64e446834affef36ac0d0f6d
|
|
BLAKE2b-256 checksum How to use checksums |
8e6d0b72d35ad9930634d9cfe4a82b285aafab0a385b21306dc58a08bc56cdbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.12.0 readme-renderer/44.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.3.0 tqdm/4.67.1 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.11
|
Security for mecha-custom-components 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.