From 8aa503710d284bdab9369f679e60b02c331cff19 Mon Sep 17 00:00:00 2001 From: EillesWan Date: Sun, 30 Apr 2023 21:57:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A7=E6=80=A5=E6=9B=B4=E6=96=B0=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E5=8D=93=E6=97=A0=E6=B3=95=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E5=B0=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Musicreater/__init__.py | 2 +- Musicreater/main.py | 2 ++ Musicreater/utils.py | 10 +++++++++- docs/库的生成与功能文档.md | 6 ++++++ requirements.txt | 3 +-- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Musicreater/__init__.py b/Musicreater/__init__.py index aef2682..9855a42 100644 --- a/Musicreater/__init__.py +++ b/Musicreater/__init__.py @@ -19,6 +19,6 @@ Terms & Conditions: ../License.md from .main import * -__version__ = "0.5.0.1" +__version__ = "0.5.0.2" __all__ = [] __author__ = (("金羿", "Eilles Wan"), ("诸葛亮与八卦阵", "bgArray"), ("鸣凤鸽子", "MingFengPigeon")) diff --git a/Musicreater/main.py b/Musicreater/main.py index 6773f6a..b646f29 100644 --- a/Musicreater/main.py +++ b/Musicreater/main.py @@ -1592,6 +1592,8 @@ class midiConvert: :param player: 玩家选择器,默认为`@a` :return 成功与否,成功返回(True,未经过压缩的源,结构占用大小),失败返回(False,str失败原因) """ + + from TrimMCStruct import Structure if self.enable_old_exe_format: raise CommandFormatError("使用mcstructure结构文件导出时不支持旧版本的指令格式。") diff --git a/Musicreater/utils.py b/Musicreater/utils.py index c8fb67b..517573f 100644 --- a/Musicreater/utils.py +++ b/Musicreater/utils.py @@ -1,7 +1,6 @@ import math import os -from TrimMCStruct import Structure, Block, TAG_Long, TAG_Byte bdx_key = { "x": [b"\x0f", b"\x0e", b"\x1c", b"\x14", b"\x15"], @@ -241,6 +240,7 @@ def form_note_block_in_NBT_struct( :return Block """ + from TrimMCStruct import Block, TAG_Byte return Block( "minecraft", "noteblock", @@ -270,6 +270,8 @@ def form_repeater_in_NBT_struct( :param facing: :param delay: 1~4 :return Block()""" + + from TrimMCStruct import Block return Block( "minecraft", @@ -338,6 +340,9 @@ def form_command_block_in_NBT_struct( :return:str """ + + from TrimMCStruct import Block, TAG_Long + return Block( "minecraft", "command_block" @@ -384,6 +389,9 @@ def commands_to_structure( :return 成功与否,成功返回(结构类,结构占用大小),失败返回(False,str失败原因) """ + + from TrimMCStruct import Structure + _sideLength = bottem_side_length_of_smallest_square_bottom_box( len(commands), max_height ) diff --git a/docs/库的生成与功能文档.md b/docs/库的生成与功能文档.md index 266b53f..2180945 100644 --- a/docs/库的生成与功能文档.md +++ b/docs/库的生成与功能文档.md @@ -38,6 +38,12 @@ method_id = 3 # 指定使用的转换算法 # 使用计分板播放器,转换为附加包文件 convertion_result = conversion.to_mcpack(method_id,*prompts) +# 使用延迟播放器,转换为附加包文件 +# 注意,在执行这个功能之前,你需要使用指令 +# pip install TrimMCStruct +# 安装最新版的TrimMCStruct库 +convertion_result = conversion.to_mcpack_with_delay(method_id,*prompts) + # 使用计分板播放器,转换为BDX结构文件 convertion_result = conversion.to_BDX_file(method_id,*prompts) diff --git a/requirements.txt b/requirements.txt index 916b870..70abd76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ Brotli>=1.0.9 -mido>=1.2.10 -TrimMCStruct>=0.0.5.7 \ No newline at end of file +mido>=1.2.10 \ No newline at end of file