mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-09-06 12:26:23 +00:00
update 2023/1/28 formatting and blacking codes
This commit is contained in:
@ -16,7 +16,7 @@ z = "z"
|
||||
|
||||
def move(axis: str, value: int):
|
||||
if value == 0:
|
||||
return b''
|
||||
return b""
|
||||
if abs(value) == 1:
|
||||
return key[axis][0 if value == -1 else 1]
|
||||
|
||||
@ -32,8 +32,7 @@ def move(axis: str, value: int):
|
||||
]
|
||||
)
|
||||
|
||||
return key[axis][pointer] + \
|
||||
value.to_bytes(2 ** (pointer - 2), 'big', signed=True)
|
||||
return key[axis][pointer] + value.to_bytes(2 ** (pointer - 2), "big", signed=True)
|
||||
|
||||
|
||||
def makeZip(sourceDir, outFilename, compression=8, exceptFile=None):
|
||||
@ -59,15 +58,15 @@ def makeZip(sourceDir, outFilename, compression=8, exceptFile=None):
|
||||
|
||||
|
||||
def formCMD_blk(
|
||||
command: str,
|
||||
particularValue: int,
|
||||
impluse: int = 0,
|
||||
condition: bool = False,
|
||||
needRedstone: bool = True,
|
||||
tickDelay: int = 0,
|
||||
customName: str = "",
|
||||
executeOnFirstTick: bool = False,
|
||||
trackOutput: bool = True,
|
||||
command: str,
|
||||
particularValue: int,
|
||||
impluse: int = 0,
|
||||
condition: bool = False,
|
||||
needRedstone: bool = True,
|
||||
tickDelay: int = 0,
|
||||
customName: str = "",
|
||||
executeOnFirstTick: bool = False,
|
||||
trackOutput: bool = True,
|
||||
):
|
||||
"""
|
||||
使用指定项目返回指定的指令方块放置指令项
|
||||
@ -113,8 +112,7 @@ def formCMD_blk(
|
||||
|
||||
:return:str
|
||||
"""
|
||||
block = b"\x24" + \
|
||||
particularValue.to_bytes(2, byteorder="big", signed=False)
|
||||
block = b"\x24" + particularValue.to_bytes(2, byteorder="big", signed=False)
|
||||
|
||||
for i in [
|
||||
impluse.to_bytes(4, byteorder="big", signed=False),
|
||||
@ -140,8 +138,8 @@ def __fillSquareSideLength(total: int, maxHeight: int):
|
||||
|
||||
|
||||
def toBDX_bytes(
|
||||
commands: list,
|
||||
max_height: int = 64,
|
||||
commands: list,
|
||||
max_height: int = 64,
|
||||
):
|
||||
"""
|
||||
:param commands: 指令列表(指令, 延迟)
|
||||
@ -150,7 +148,7 @@ def toBDX_bytes(
|
||||
"""
|
||||
|
||||
_sideLength = __fillSquareSideLength(len(commands), max_height)
|
||||
_bytes = b''
|
||||
_bytes = b""
|
||||
|
||||
y_forward = True
|
||||
z_forward = True
|
||||
@ -191,8 +189,7 @@ def toBDX_bytes(
|
||||
|
||||
now_y += 1 if y_forward else -1
|
||||
|
||||
if ((now_y >= max_height) and y_forward) or (
|
||||
(now_y < 0) and (not y_forward)):
|
||||
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
|
||||
@ -200,7 +197,8 @@ def toBDX_bytes(
|
||||
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 < 0) and (not z_forward)
|
||||
):
|
||||
now_z -= 1 if z_forward else -1
|
||||
z_forward = not z_forward
|
||||
_bytes += key[x][1]
|
||||
@ -215,6 +213,10 @@ def toBDX_bytes(
|
||||
|
||||
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 + 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],
|
||||
)
|
||||
|
Reference in New Issue
Block a user