From a07f723d7c6f4e8cc125d75dd634228f102741f8 Mon Sep 17 00:00:00 2001 From: EillesWan Date: Sun, 12 Mar 2023 14:35:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=99=E6=94=B9=E4=BA=86=E4=B8=8D=E5=95=A6?= =?UTF-8?q?=EF=BC=8C=E4=B8=80=E4=BB=A3=E4=B8=80=E4=BB=A3=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=9C=89=E4=B8=AA=E9=AC=BC=E7=94=A8=EF=BC=8C=E4=BB=80=E4=B9=88?= =?UTF-8?q?=E9=83=BD=E6=B2=A1=E5=8F=98=E5=98=9B=EF=BC=9B=E6=88=91=E5=B8=A6?= =?UTF-8?q?=E7=9A=84=E6=98=AF=E4=BB=80=E4=B9=88=E9=98=9F=E5=95=8A=EF=BC=8C?= =?UTF-8?q?=E6=88=91=E5=B8=A6=E7=9A=84=E6=98=AF=E7=9D=BF=E7=A9=86=E5=95=8A?= =?UTF-8?q?=EF=BC=8C=E5=85=88=E6=8A=8A=E8=BF=99=E4=B8=AA=E7=90=86=E5=BF=B5?= =?UTF-8?q?=E6=90=9E=E6=87=82=E5=98=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Musicreater/main.py | 2 ++ Musicreater/utils.py | 63 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 22 +++++++++++++--- requirements.txt | 1 - 4 files changed, 84 insertions(+), 4 deletions(-) diff --git a/Musicreater/main.py b/Musicreater/main.py index d1d3bd7..c2ae62e 100644 --- a/Musicreater/main.py +++ b/Musicreater/main.py @@ -1479,6 +1479,8 @@ class midiConvert: if not os.path.exists(self.outputPath): os.makedirs(self.outputPath) + + diff --git a/Musicreater/utils.py b/Musicreater/utils.py index 434eeea..a3ddaa1 100644 --- a/Musicreater/utils.py +++ b/Musicreater/utils.py @@ -221,6 +221,69 @@ def to_BDX_bytes( [now_x, now_y, now_z], ) + +def form_command_block_in_NBT_struct( + command: str, + particularValue: int, + impluse: int = 0, + condition: bool = False, + needRedstone: bool = True, + tickDelay: int = 0, + customName: str = "", + executeOnFirstTick: bool = False, + trackOutput: bool = True, +): + """ + 使用指定项目返回指定的指令方块结构 + :param command: `str` + 指令 + :param particularValue: + 方块特殊值,即朝向 + :0 下 无条件 + :1 上 无条件 + :2 z轴负方向 无条件 + :3 z轴正方向 无条件 + :4 x轴负方向 无条件 + :5 x轴正方向 无条件 + :6 下 无条件 + :7 下 无条件 + + :8 下 有条件 + :9 上 有条件 + :10 z轴负方向 有条件 + :11 z轴正方向 有条件 + :12 x轴负方向 有条件 + :13 x轴正方向 有条件 + :14 下 有条件 + :14 下 有条件 + 注意!此处特殊值中的条件会被下面condition参数覆写 + :param impluse: `int 0|1|2` + 方块类型 + 0脉冲 1循环 2连锁 + :param condition: `bool` + 是否有条件 + :param needRedstone: `bool` + 是否需要红石 + :param tickDelay: `int` + 执行延时 + :param customName: `str` + 悬浮字 + lastOutput: `str` + 上次输出字符串,注意此处需要留空 + :param executeOnFirstTick: `bool` + 执行第一个已选项(循环指令方块是否激活后立即执行,若为False,则从激活时起延迟后第一次执行) + :param trackOutput: `bool` + 是否输出 + + :return:str + """ + from mcstructure import Block + block = Block("minecraft:command_block") + + return block + + + def to_structure( commands: list, max_height: int = 64, diff --git a/README.md b/README.md index 6dc83a5..9378849 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,27 @@ -

音·创 Musicreater

+ +

+ 音·创 Musicreater +

- + +

一款免费开源的 《我的世界》 MIDI音乐转换库。

- + + + Fork me on Gitee + +

+ + + [![][Bilibili: 金羿ELS]](https://space.bilibili.com/397369002/) [![][Bilibili: 诸葛亮与八卦阵]](https://space.bilibili.com/604072474) [![CodeStyle: black]](https://github.com/psf/black) @@ -18,6 +29,11 @@ [![][license]](LICENSE) [![][release]](../../releases) +[![GiteeStar](https://gitee.com/TriM-Organization/Musicreater/badge/star.svg?theme=gray)](https://gitee.com/TriM-Organization/Musicreater/stargazers) +[![GiteeFork](https://gitee.com/TriM-Organization/Musicreater/badge/fork.svg?theme=gray)](https://gitee.com/TriM-Organization/Musicreater/members) +[![GitHub Repo stars](https://img.shields.io/github/stars/TriM-Organization/Musicreater?color=white&logo=GitHub&style=plastic)](https://github.com/TriM-Organization/Musicreater/stargazers) +[![GitHub Repo Forks](https://img.shields.io/github/forks/TriM-Organization/Musicreater?color=white&logo=GitHub&style=plastic)](https://github.com/TriM-Organization/Musicreater/forks) + 简体中文🇨🇳 | [English🇬🇧](README_EN.md) diff --git a/requirements.txt b/requirements.txt index 68153c0..11e2979 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ Brotli>=1.0.9 mido>=1.2.10 -mcstructure \ No newline at end of file