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

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

13
MANIFEST.in Normal file
View File

@ -0,0 +1,13 @@
recursive-include *.md
include LICENSE.md
exclude fcwslib/*
exclude bgArrayLib/*
exclude Packer/*
exclude ./*.mid
exclude ./*.MSQ
exclude ./MSCT_Packer.py
exclude resources/poem.md
exclude resources/*
include requirements.txt
include README_EN.md
include README.md

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,

View File

@ -90,6 +90,7 @@
- 感谢 **雷霆**\<QQ3555268519\> 用他那令所有开发者都大为光火的操作方法为我们的程序找出错误并提醒修复 bug
- 感谢 **小埋**\<QQ2039310975\> 反馈附加包生成时缺少描述和标题的问题
- <table><tr><td>感谢 **油炸**\<QQ2836146704\> 激励我们不断开发新的内容</td><td><img height="50" src="https://foruda.gitee.com/images/1695478907647543027/08ea9909_9911226.jpeg"></td></tr></table>
- 感谢 ****\<QQ237667809\> 反馈在新版本的指令格式下计分板播放器的附加包无法播放的问题
> 感谢广大群友为此库提供的测试和建议等
>

2
pyproject.toml Normal file
View File

@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel", "mido"]

View File

@ -1,22 +1,25 @@
# -*- coding: utf-8 -*-
import setuptools
import Musicreater
import os
from Musicreater import __version__
with open("requirements.txt", "r", encoding="utf-8") as fh:
os.chdir(os.path.dirname(os.path.abspath(__file__)))
with open("./requirements.txt", "r", encoding="utf-8") as fh:
dependences = fh.read().strip().split("\n")
with open("README_EN.md", "r", encoding="utf-8") as fh:
with open("./README_EN.md", "r", encoding="utf-8") as fh:
long_description = fh.read().replace(
"./docs/", "https://github.com/TriM-Organization/Musicreater/blob/master/docs/"
)
setuptools.setup(
name="Musicreater",
version=Musicreater.__version__,
version=__version__,
author="金羿Eilles, bgArray, 鱼旧梦ElapsingDreams",
author_email="TriM-Organization@hotmail.com",
description="一款免费开源的针对《我的世界》音乐的支持库\n"
"A free open-source python library used to convert midi into Minecraft.",
description="一款开源《我的世界》数字音频支持库。\n"
"A free open source library used for dealing with **Minecraft** digital musics.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/TriM-Organization/Musicreater",
@ -24,15 +27,15 @@ setuptools.setup(
classifiers=[
"Intended Audience :: Developers",
"Natural Language :: Chinese (Simplified)",
"License :: OSI Approved :: Apache Software License",
# "License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Multimedia",
"Topic :: Multimedia :: Sound/Audio :: MIDI",
],
# 需要安装的依赖
install_requires=dependences,
python_requires=">=3.8",
)