部分API小幅新增,修复新版本指令的计分板播放器附加包无法播放的问题

This commit is contained in:
2024-08-19 02:28:28 +08:00
parent 932b9a34e0
commit 6f391567ba
9 changed files with 71 additions and 25 deletions

View File

@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""一个简单的我的世界音频转换库
音·创 (Musicreater)
是一款免费开源的针对《我的世界》的midi音乐转换库
是一款免费开源的《我的世界》数字音频支持库。
Musicreater(音·创)
A free open source library used for convert midi file into formats that is suitable for **Minecraft**.
A free open source library used for dealing with **Minecraft** digital musics.
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
@@ -22,8 +22,8 @@ The Licensor of Musicreater("this project") is Eilles Wan, bgArray.
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
__version__ = "2.2.0"
__vername__ = "高精度时间支持"
__version__ = "2.2.1"
__vername__ = "部分API小幅度新增内容"
__author__ = (
("金羿", "Eilles Wan"),
("诸葛亮与八卦阵", "bgArray"),

View File

@@ -3,9 +3,9 @@
"""
音·创 (Musicreater)
一款免费开源的针对《我的世界》音乐的支持库
一款免费开源的《我的世界》数字音频支持库
Musicreater (音·创)
A free open source library used for **Minecraft** musics.
A free open source library used for dealing with **Minecraft** digital musics.
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray

View File

@@ -74,6 +74,10 @@ def to_addon_pack_in_score(
pack_description=f"{midi_cvt.music_name} 音乐播放包MCFUNCTION(MCPACK) 计分播放器 - 由 音·创 生成",
pack_name=midi_cvt.music_name + "播放",
modules_description=f"无 - 由 音·创 生成",
format_version=1 if midi_cvt.enable_old_exe_format else 2,
pack_engine_version=(
None if midi_cvt.enable_old_exe_format else [1, 19, 50]
),
),
fp=f,
indent=4,
@@ -205,9 +209,14 @@ def to_addon_pack_in_delay(
pack_description=f"{midi_cvt.music_name} 音乐播放包MCSTRUCTURE(MCPACK) 延迟播放器 - 由 音·创 生成",
pack_name=midi_cvt.music_name + "播放",
modules_description=f"无 - 由 音·创 生成",
format_version=1 if midi_cvt.enable_old_exe_format else 2,
pack_engine_version=(
None if midi_cvt.enable_old_exe_format else [1, 19, 50]
),
),
fp=f,
indent=4,
ensure_ascii=False,
)
# 写入stop.mcfunction
@@ -354,6 +363,8 @@ def to_addon_pack_in_repeater(
dist_path: str,
progressbar_style: Optional[ProgressBarStyle],
player: str = "@a",
axis_side: Literal["z+", "z-", "Z+", "Z-", "x+", "x-", "X+", "X-"] = "z+",
basement_block: str = "concrete",
max_height: int = 65,
) -> Tuple[int, int]:
"""
@@ -403,6 +414,10 @@ def to_addon_pack_in_repeater(
pack_description=f"{midi_cvt.music_name} 音乐播放包MCSTRUCTURE(MCPACK) 中继器播放器 - 由 音·创 生成",
pack_name=midi_cvt.music_name + "播放",
modules_description=f"无 - 由 音·创 生成",
format_version=1 if midi_cvt.enable_old_exe_format else 2,
pack_engine_version=(
None if midi_cvt.enable_old_exe_format else [1, 19, 50]
),
),
fp=f,
indent=4,
@@ -422,9 +437,11 @@ def to_addon_pack_in_repeater(
)
struct, size, end_pos = commands_to_redstone_delay_structure(
command_list,
max_delay,
max_together,
commands=command_list,
delay_length=max_delay,
max_multicmd_length=max_together,
base_block=basement_block,
axis_=axis_side,
compability_version_=compability_ver,
)
with open(
@@ -554,6 +571,7 @@ def to_addon_pack_in_repeater_divided_by_instrument(
player: str = "@a",
max_height: int = 65,
base_block: str = "concrete",
axis_side: Literal["z+", "z-", "Z+", "Z-", "x+", "x-", "X+", "X-"] = "z+",
) -> Tuple[int, int]:
"""
将midi以中继器播放器形式转换为mcstructure结构文件后打包成附加包并在附加包中生成相应地导入函数
@@ -593,9 +611,13 @@ def to_addon_pack_in_repeater_divided_by_instrument(
with open(f"{dist_path}/temp/manifest.json", "w", encoding="utf-8") as f:
json.dump(
behavior_mcpack_manifest(
pack_description=f"{midi_cvt.music_name} 音乐播放包MCSTRUCTURE(MCPACK) 中继器播放器 - 由 音·创 生成",
pack_description=f"{midi_cvt.music_name} 音乐播放包MCSTRUCTURE(MCPACK) 中继器播放器(拆分) - 由 音·创 生成",
pack_name=midi_cvt.music_name + "播放",
modules_description=f"无 - 由 音·创 生成",
format_version=1 if midi_cvt.enable_old_exe_format else 2,
pack_engine_version=(
None if midi_cvt.enable_old_exe_format else [1, 19, 50]
),
),
fp=f,
indent=4,
@@ -628,7 +650,7 @@ def to_addon_pack_in_repeater_divided_by_instrument(
max_delay,
max_multiple_cmd_count[inst],
base_block,
"z+",
axis_=axis_side,
compability_version_=compability_ver,
)

View File

@@ -46,10 +46,12 @@ def compress_zipfile(sourceDir, outFilename, compression=8, exceptFile=None):
def behavior_mcpack_manifest(
format_version: Union[Literal[1], Literal[2]] = 1,
pack_description: str = "",
pack_version: Union[List[int], Literal[None]] = None,
pack_name: str = "",
pack_uuid: Union[str, Literal[None]] = None,
pack_engine_version: Union[List[int], None] = None,
modules_description: str = "",
modules_version: List[int] = [0, 0, 1],
modules_uuid: Union[str, Literal[None]] = None,
@@ -64,8 +66,8 @@ def behavior_mcpack_manifest(
now_date.month * 100 + now_date.day,
now_date.hour * 100 + now_date.minute,
]
return {
"format_version": 1,
result = {
"format_version": format_version,
"header": {
"description": pack_description,
"version": pack_version,
@@ -81,3 +83,6 @@ def behavior_mcpack_manifest(
}
],
}
if pack_engine_version:
result["header"]["min_engine_version"] = pack_engine_version
return result

View File

@@ -414,8 +414,8 @@ class MineCommand:
"""
转为我的世界函数文件格式(包含注释)
"""
return "#[{cdt}]<{delay}> {ant}\n{cmd}".format(
cdt="CDT" if self.conditional else "",
return "# {cdt}<{delay}> {ant}\n{cmd}".format(
cdt="[CDT]" if self.conditional else "",
delay=self.delay,
ant=self.annotation_text,
cmd=self.command_text,