mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2024-11-11 01:27:35 +08:00
这不是最终版本,请不要提交更新
This commit is contained in:
parent
5ffb654ec9
commit
bd329082c2
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""一个简单的我的世界音频转换库
|
"""一个简单的我的世界音频转换库
|
||||||
音·创 库版 (Musicreater)
|
音·创 (Musicreater)
|
||||||
是一款免费开源的针对《我的世界》的midi音乐转换库
|
是一款免费开源的针对《我的世界》的midi音乐转换库
|
||||||
Musicreater(音·创)
|
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 convert midi file into formats that is suitable for **Minecraft**.
|
||||||
@ -12,14 +12,14 @@ Copyright © 2023 all the developers of Musicreater
|
|||||||
Terms & Conditions: ../License.md
|
Terms & Conditions: ../License.md
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# 音·创 开发交流群 861684859
|
# 睿穆组织 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email TriM-Organization@hotmail.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
||||||
|
|
||||||
from .main import *
|
from .main import *
|
||||||
|
|
||||||
__version__ = "0.3.2"
|
__version__ = "0.3.3"
|
||||||
__all__ = []
|
__all__ = []
|
||||||
__author__ = (("金羿", "Eilles Wan"), ("诸葛亮与八卦阵", "bgArray"))
|
__author__ = (("金羿", "Eilles Wan"), ("诸葛亮与八卦阵", "bgArray"))
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
# 音·创 开发交流群 861684859
|
# 睿穆组织 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email TriM-Organization@hotmail.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""一个简单的我的世界音频转换库
|
||||||
音·创 库版 (Musicreater Package Version)
|
音·创 (Musicreater)
|
||||||
是一款免费开源的针对《我的世界:基岩版》的midi音乐转换库
|
是一款免费开源的针对《我的世界》的midi音乐转换库
|
||||||
Musicreater pkgver (Package Version 音·创 库版)
|
Musicreater(音·创)
|
||||||
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
|
A free open source library used for convert midi file into formats that is suitable for **Minecraft**.
|
||||||
|
|
||||||
版权所有 © 2023 音·创 开发者
|
版权所有 © 2023 音·创 开发者
|
||||||
Copyright © 2023 all the developers of Musicreater
|
Copyright © 2023 all the developers of Musicreater
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# 音·创 开发交流群 861684859
|
# 音·创 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email TriM-Organization@hotmail.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
||||||
|
|
||||||
@ -1471,7 +1471,17 @@ class midiConvert:
|
|||||||
:param player: 玩家选择器,默认为`@a`
|
:param player: 玩家选择器,默认为`@a`
|
||||||
:return 成功与否,成功返回(True,未经过压缩的源,结构占用大小),失败返回(False,str失败原因)
|
:return 成功与否,成功返回(True,未经过压缩的源,结构占用大小),失败返回(False,str失败原因)
|
||||||
"""
|
"""
|
||||||
pass
|
cmdlist, max_delay = self.methods_byDelay[method - 1](
|
||||||
|
volume,
|
||||||
|
speed,
|
||||||
|
player,
|
||||||
|
)
|
||||||
|
|
||||||
|
if not os.path.exists(self.outputPath):
|
||||||
|
os.makedirs(self.outputPath)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def to_BDX_file(
|
def to_BDX_file(
|
||||||
self,
|
self,
|
||||||
@ -1552,9 +1562,9 @@ class midiConvert:
|
|||||||
max_height - 1,
|
max_height - 1,
|
||||||
)
|
)
|
||||||
_bytes += pgbBytes
|
_bytes += pgbBytes
|
||||||
_bytes += move(y, -pgbNowPos[1])
|
_bytes += bdx_move(y, -pgbNowPos[1])
|
||||||
_bytes += move(z, -pgbNowPos[2])
|
_bytes += bdx_move(z, -pgbNowPos[2])
|
||||||
_bytes += move(x, 2)
|
_bytes += bdx_move(x, 2)
|
||||||
|
|
||||||
size[0] += 2 + pgbSize[0]
|
size[0] += 2 + pgbSize[0]
|
||||||
size[1] = max(size[1], pgbSize[1])
|
size[1] = max(size[1], pgbSize[1])
|
||||||
@ -1632,14 +1642,14 @@ class midiConvert:
|
|||||||
1,
|
1,
|
||||||
customName="初始化进度条",
|
customName="初始化进度条",
|
||||||
)
|
)
|
||||||
_bytes += move(z, 2)
|
_bytes += bdx_move(z, 2)
|
||||||
_bytes += form_command_block_in_BDX_bytes(
|
_bytes += form_command_block_in_BDX_bytes(
|
||||||
r"scoreboard players add {} {} 1".format(player, scb_name),
|
r"scoreboard players add {} {} 1".format(player, scb_name),
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
customName="显示进度条并加分",
|
customName="显示进度条并加分",
|
||||||
)
|
)
|
||||||
_bytes += move(y, 1)
|
_bytes += bdx_move(y, 1)
|
||||||
pgbBytes, pgbSize, pgbNowPos = to_BDX_bytes(
|
pgbBytes, pgbSize, pgbNowPos = to_BDX_bytes(
|
||||||
[
|
[
|
||||||
(i, 0)
|
(i, 0)
|
||||||
@ -1648,15 +1658,15 @@ class midiConvert:
|
|||||||
max_height - 1,
|
max_height - 1,
|
||||||
)
|
)
|
||||||
_bytes += pgbBytes
|
_bytes += pgbBytes
|
||||||
_bytes += move(y, -1 - pgbNowPos[1])
|
_bytes += bdx_move(y, -1 - pgbNowPos[1])
|
||||||
_bytes += move(z, -2 - pgbNowPos[2])
|
_bytes += bdx_move(z, -2 - pgbNowPos[2])
|
||||||
_bytes += move(x, 2)
|
_bytes += bdx_move(x, 2)
|
||||||
_bytes += form_command_block_in_BDX_bytes(
|
_bytes += form_command_block_in_BDX_bytes(
|
||||||
r"scoreboard players reset {} {}".format(player, scb_name),
|
r"scoreboard players reset {} {}".format(player, scb_name),
|
||||||
1,
|
1,
|
||||||
customName="置零进度条",
|
customName="置零进度条",
|
||||||
)
|
)
|
||||||
_bytes += move(y, 1)
|
_bytes += bdx_move(y, 1)
|
||||||
size[0] += 2 + pgbSize[0]
|
size[0] += 2 + pgbSize[0]
|
||||||
size[1] = max(size[1], pgbSize[1])
|
size[1] = max(size[1], pgbSize[1])
|
||||||
size[2] = max(size[2], pgbSize[2])
|
size[2] = max(size[2], pgbSize[2])
|
||||||
|
@ -14,7 +14,7 @@ y = "y"
|
|||||||
z = "z"
|
z = "z"
|
||||||
|
|
||||||
|
|
||||||
def move(axis: str, value: int):
|
def bdx_move(axis: str, value: int):
|
||||||
if value == 0:
|
if value == 0:
|
||||||
return b""
|
return b""
|
||||||
if abs(value) == 1:
|
if abs(value) == 1:
|
||||||
@ -220,3 +220,92 @@ def to_BDX_bytes(
|
|||||||
],
|
],
|
||||||
[now_x, now_y, now_z],
|
[now_x, now_y, now_z],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def to_structure(
|
||||||
|
commands: list,
|
||||||
|
max_height: int = 64,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
:param commands: 指令列表(指令, 延迟)
|
||||||
|
:param max_height: 生成结构最大高度
|
||||||
|
:return 成功与否,成功返回(True,未经过压缩的源,结构占用大小),失败返回(False,str失败原因)
|
||||||
|
"""
|
||||||
|
# 导入库
|
||||||
|
from mcstructure import Block, Structure
|
||||||
|
|
||||||
|
_sideLength = bottem_side_length_of_smallest_square_bottom_box(len(commands), max_height)
|
||||||
|
|
||||||
|
struct = Structure(
|
||||||
|
(_sideLength, max_height, _sideLength), # 声明结构大小
|
||||||
|
)
|
||||||
|
|
||||||
|
y_forward = True
|
||||||
|
z_forward = True
|
||||||
|
|
||||||
|
now_y = 0
|
||||||
|
now_z = 0
|
||||||
|
now_x = 0
|
||||||
|
|
||||||
|
for cmd, delay in commands:
|
||||||
|
impluse = 2
|
||||||
|
condition = False
|
||||||
|
needRedstone = False
|
||||||
|
tickDelay = delay
|
||||||
|
customName = ""
|
||||||
|
executeOnFirstTick = False
|
||||||
|
trackOutput = True
|
||||||
|
_bytes += form_command_block_in_BDX_bytes(
|
||||||
|
cmd,
|
||||||
|
(1 if y_forward else 0)
|
||||||
|
if (
|
||||||
|
((now_y != 0) and (not y_forward))
|
||||||
|
or (y_forward and (now_y != (max_height - 1)))
|
||||||
|
)
|
||||||
|
else (3 if z_forward else 2)
|
||||||
|
if (
|
||||||
|
((now_z != 0) and (not z_forward))
|
||||||
|
or (z_forward and (now_z != _sideLength))
|
||||||
|
)
|
||||||
|
else 5,
|
||||||
|
impluse=impluse,
|
||||||
|
condition=condition,
|
||||||
|
needRedstone=needRedstone,
|
||||||
|
tickDelay=tickDelay,
|
||||||
|
customName=customName,
|
||||||
|
executeOnFirstTick=executeOnFirstTick,
|
||||||
|
trackOutput=trackOutput,
|
||||||
|
)
|
||||||
|
|
||||||
|
now_y += 1 if y_forward else -1
|
||||||
|
|
||||||
|
if ((now_y >= max_height) and y_forward) or ((now_y < 0) and (not y_forward)):
|
||||||
|
now_y -= 1 if y_forward else -1
|
||||||
|
|
||||||
|
y_forward = not y_forward
|
||||||
|
|
||||||
|
now_z += 1 if z_forward else -1
|
||||||
|
|
||||||
|
if ((now_z > _sideLength) and z_forward) or (
|
||||||
|
(now_z < 0) and (not z_forward)
|
||||||
|
):
|
||||||
|
now_z -= 1 if z_forward else -1
|
||||||
|
z_forward = not z_forward
|
||||||
|
_bytes += key[x][1]
|
||||||
|
now_x += 1
|
||||||
|
else:
|
||||||
|
|
||||||
|
_bytes += key[z][int(z_forward)]
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
_bytes += key[y][int(y_forward)]
|
||||||
|
|
||||||
|
return (
|
||||||
|
_bytes,
|
||||||
|
[
|
||||||
|
now_x + 1,
|
||||||
|
max_height if now_x or now_z else now_y,
|
||||||
|
_sideLength if now_x else now_z,
|
||||||
|
],
|
||||||
|
[now_x, now_y, now_z],
|
||||||
|
)
|
@ -11,7 +11,7 @@
|
|||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
|
||||||
[![][Bilibili: 凌云金羿]](https://space.bilibili.com/397369002/)
|
[![][Bilibili: 金羿ELS]](https://space.bilibili.com/397369002/)
|
||||||
[![][Bilibili: 诸葛亮与八卦阵]](https://space.bilibili.com/604072474)
|
[![][Bilibili: 诸葛亮与八卦阵]](https://space.bilibili.com/604072474)
|
||||||
[![CodeStyle: black]](https://github.com/psf/black)
|
[![CodeStyle: black]](https://github.com/psf/black)
|
||||||
[![][python]](https://www.python.org/)
|
[![][python]](https://www.python.org/)
|
||||||
@ -103,7 +103,7 @@ NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Bilibili: 凌云金羿]: https://img.shields.io/badge/Bilibili-%E5%87%8C%E4%BA%91%E9%87%91%E7%BE%BF-00A1E7?style=for-the-badge
|
[Bilibili: 金羿ELS]: https://img.shields.io/badge/Bilibili-%E5%87%8C%E4%BA%91%E9%87%91%E7%BE%BF-00A1E7?style=for-the-badge
|
||||||
[Bilibili: 诸葛亮与八卦阵]: https://img.shields.io/badge/Bilibili-%E8%AF%B8%E8%91%9B%E4%BA%AE%E4%B8%8E%E5%85%AB%E5%8D%A6%E9%98%B5-00A1E7?style=for-the-badge
|
[Bilibili: 诸葛亮与八卦阵]: https://img.shields.io/badge/Bilibili-%E8%AF%B8%E8%91%9B%E4%BA%AE%E4%B8%8E%E5%85%AB%E5%8D%A6%E9%98%B5-00A1E7?style=for-the-badge
|
||||||
[CodeStyle: black]: https://img.shields.io/badge/code%20style-black-121110.svg?style=for-the-badge
|
[CodeStyle: black]: https://img.shields.io/badge/code%20style-black-121110.svg?style=for-the-badge
|
||||||
[python]: https://img.shields.io/badge/python-3.6-AB70FF?style=for-the-badge
|
[python]: https://img.shields.io/badge/python-3.6-AB70FF?style=for-the-badge
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
Brotli>=1.0.9
|
Brotli>=1.0.9
|
||||||
mido>=1.2.10
|
mido>=1.2.10
|
||||||
|
mcstructure
|
Loading…
Reference in New Issue
Block a user