New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mecha-custom-components

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mecha-custom-components

A library to easily extend your Mecha/Bolt code with custom components

  • 0.0.3
  • PyPI
  • Socket score

Maintainers
1

Mecha Custom Components

GitHub Actions PyPI PyPI - Python Version Code style: black

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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc