A python library to create minecraft datapacks
Project description
Installation
The package can be installed with pip
:
pip install onyx-mclib
Getting Started
First, you'll need to define your datapack object. This can be done with pack = pack(file_path)
. Now you can get started defining functions.
A basic function should look something like this:
from onyx import *
pack = pack(file_path)
main = pack.function("function/path", "function_name")
with main:
say("Hello, World!")
You can make a function run every tick by using pack.function("function_path", "function_name", loop=True)
.
Selectors
Selectors are defined very similar to the normal game, and are done like so:
alive_players_in_arena = selector(at.all_players, tag="alive", y=0, dy=63)
Onyx will automatically convert types, so if you don't want to define a selector for something simple, you can just pass in "@a"
instead of selector(at.all_players)
.
JSON Strings
JSON strings (also known as text-components) have a builder design. They can be chained too, to seperate components with differing elements.
text = json_string().component("Hello, ").component(text="World!", color=color.gold, bold=True, italic=True)
tellraw("@a", text)
See also
Discord: https://discord.gg/NcztW9T
PyPi: https://pypi.org/project/onyx-mclib
GitHub: https://github.com/Double-Felix/Onyx
Credits
Language Design:
- Arcensoth (Design Ideas and Feedback, Implementation Ideas)
- fizzy (Creator of nbtlib, which was used to implement SNBT, and mudkip, which was used to generate the docs)
- Lue (Design Feedback, Implementation Ideas)
- Not A2 (Design Feedback)
- nphhpn (Feature Suggestions, Design Feedback, Implementation Ideas)
- PeerHeer (Feature Suggestions, Design Ideas and Feedback, Implemetation Assistance)
- Princess (Design Feedback)
- Ravbug (Design Feedback, Implementation Ideas)
- rx (Feature Suggestions, Design Feedback and Ideas)
- SirBenet (Design Ideas and Feedback, Implementation Ideas)
- the der discohund (Design Ideas, Implementation Ideas)
- TheMrZZ (Design Ideas)
- vdvman1 (Design Feedback, Implementation Assistance, Creator of Phi, which was almost completely copied for use in the
bitwise
andrng
libraries)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for onyx_mclib-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b11615190e9118cb48a92bd7c21ed0fd6d4ced71600e351aec9ff495a6bbe07 |
|
MD5 | 3315e000a0e20dc1091d6740156befde |
|
BLAKE2b-256 | 24c978b375e40dc9a08f4a17ac93bc41954ae8b3de3d11878b7946fa7ad55911 |