我不知道这样有没有用,但是这确实是更新了bdx操作,我不知道bug在哪里

This commit is contained in:
EillesWan 2022-04-08 01:26:35 +08:00
parent 7edf979aee
commit d22b5b0c42
8 changed files with 16 additions and 8 deletions

View File

@ -35,6 +35,7 @@ A free opensource software which is used for creating all kinds of musics in Min
# 下面为正文 # 下面为正文
# 一定会好起来的
from msctspt.bugReporter import version from msctspt.bugReporter import version

View File

@ -36,7 +36,7 @@ print("""
Musicreater PLUGINS Management Musicreater PLUGINS Management
""") """)
# 准备启用中

View File

@ -7,7 +7,7 @@ import brotli
class BdxConverter: class BdxConverter:
__header = "BD@" __header = "BD@"
__bin_header = b"BDX" __bin_header = b"BDX"
__generator_author = b"&Musicreater" __generator_author = b"& Musicreater"
keys = { keys = {
# x--, x++, addSmallX(-128~127), addX(-32768~32767), addBigX(-2147483648~2147483647) # x--, x++, addSmallX(-128~127), addX(-32768~32767), addBigX(-2147483648~2147483647)
@ -16,7 +16,7 @@ class BdxConverter:
"z": [b"\x13", b"\x12", b"\x1e", b"\x18", b"\x19"], "z": [b"\x13", b"\x12", b"\x1e", b"\x18", b"\x19"],
"end": b"\x58", "end": b"\x58",
"isSigned": b"\x5a", "isSigned": b"\x5a",
"placeCommandBlockWithData": b"\x1b", "placeCommandBlockWithData": b"\x1b",#用不上
"placeBlock": b"\x07" "placeBlock": b"\x07"
} }
@ -82,8 +82,6 @@ class BdxConverter:
:return: :return:
""" """
_types = b"" _types = b""
for block in self.blocks: for block in self.blocks:
# print(f"当前方块:{block['block_name']}, 位置: {block['direction']}]") # print(f"当前方块:{block['block_name']}, 位置: {block['direction']}]")
diff = self.move_pointer(self.direction, block["direction"]) diff = self.move_pointer(self.direction, block["direction"])
@ -182,7 +180,7 @@ class BdxConverter:
:return: bytes of command_block :return: bytes of command_block
""" """
block_id = b"\x1b" + self.block_type.index(block["block_name"]).to_bytes(2, byteorder="big", signed=False) block_id = b"\x24"
particular_value = block["particular_value"].to_bytes(2, byteorder="big", signed=False) particular_value = block["particular_value"].to_bytes(2, byteorder="big", signed=False)
block_header = block_id + particular_value block_header = block_id + particular_value
for i in [ for i in [

View File

@ -188,6 +188,14 @@ def formCmdBlock(direction: Iterable, command: str, particularValue: int, implus
"needRedstone": int #是否需要红石 1 bytes "needRedstone": int #是否需要红石 1 bytes
} }
''' '''
# for particularValue, is like this
# :0 下 无条件
# :1 上 无条件
# :2 z轴负方向 无条件
# :3 z轴正方向 无条件
# :4 x轴负方向 无条件
# :5 x轴正方向 无条件
print(f"==[DEBUG]=={direction}: {command} {'' if particularValue == 0 else '' if particularValue ==1 else 'z-' if particularValue ==2 else 'z+' if particularValue==3 else 'x-' if particularValue==4 else 'x+'} {'脉冲' if impluse==0 else '循环' if impluse ==1 else '连锁'} {'有条件' if condition else '无条件'} {'需要红石' if needRedstone else '不需要红石'}")
return {"direction": direction, return {"direction": direction,
"block_name": "command_block", "block_name": "command_block",
"particular_value": particularValue, "particular_value": particularValue,
@ -272,7 +280,7 @@ def music2cmdBlocks(direction: Iterable, music: dict, isProsess: bool = False, h
direction = list(direction) direction = list(direction)
def trackDealing(direction,track): def trackDealing(direction,track):
print('=========DEBUG=========音轨起方块:', direction) # print('=========DEBUG=========音轨起方块:', direction)
blocks = [] blocks = []
cmdList = classList_conversion_SinglePlayer(track['notes'], track['set']['ScoreboardName'], cmdList = classList_conversion_SinglePlayer(track['notes'], track['set']['ScoreboardName'],
music['mainset']['PlayerSelect'], isProsess) music['mainset']['PlayerSelect'], isProsess)
@ -298,7 +306,7 @@ def music2cmdBlocks(direction: Iterable, music: dict, isProsess: bool = False, h
# :4 x轴负方向 无条件 # :4 x轴负方向 无条件
# :5 x轴正方向 无条件 # :5 x轴正方向 无条件
for cmd in cmdList: for cmd in cmdList:
print('=========DEBUG=========方块:', dire) # print('=========DEBUG=========方块:', dire)
blocks.append(formCmdBlock(dire, cmd, 5 if (down is False and dire[1] == height + direction[1]) or ( blocks.append(formCmdBlock(dire, cmd, 5 if (down is False and dire[1] == height + direction[1]) or (
down and dire[1] == direction[1] + 1) else 0 if down else 1, 2, needRedstone=False)) down and dire[1] == direction[1] + 1) else 0 if down else 1, 2, needRedstone=False))
if down: if down:
@ -322,6 +330,7 @@ def music2cmdBlocks(direction: Iterable, music: dict, isProsess: bool = False, h
for th in threads: for th in threads:
allblocks += th.getResult() allblocks += th.getResult()
print(allblocks)
return allblocks return allblocks

Binary file not shown.

Binary file not shown.