Update 0.0.4

This commit is contained in:
2021-11-21 17:44:35 +08:00
parent 0b1a876b14
commit 8cc1aa708f
8 changed files with 137 additions and 62 deletions

View File

@ -30,6 +30,14 @@ Copyright © W-YI 2021
新更新日志
Beta 0.0.4
2021 11 20 ~ 2021 11 21
1.完全支持Linux系统
2.支持以.RyStruct导出结构
3.修复大量bug
Beta 0.0.3.1~0.0.3.5
2021 11 1~2021 11 2

View File

@ -101,7 +101,7 @@ class version:
libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','briefcase','toga','pyinstaller','kivy','py7zr')
'''当前所需库,有一些是开发用的,用户不需要安装'''
version = ('0.0.3.5','Beta',)
version = ('0.0.4','Beta',)
'''当前版本'''
def __init__(self) -> None:

View File

@ -224,4 +224,58 @@ def note2RSworld(world:str,startpos:list,notes:list,instrument:str,speed:float =
log("无法放置方块了,可能是因为区块未加载叭")
level.save()
level.close()
class ryStruct:
def __init__(self) -> None:
self.RyStruct = dict()
def World2Rys(self,world:str,startp:list,endp:list,includeAir:bool=False):
import amulet
import amulet_nbt
from amulet.api.block import Block
from amulet.utils.world_utils import block_coords_to_chunk_coords
level = amulet.load_level(world)
for x in range(startp[0],endp[0]):
for y in range(startp[1],endp[1]):
for z in range(startp[2],endp[2]):
RyStructBlock = dict()
cx, cz = block_coords_to_chunk_coords(x, z)
chunk = level.get_chunk(cx, cz, "minecraft:overworld")
universal_block = chunk.block_palette[chunk.blocks[x - 16 * cx, y, z - 16 * cz]]
if universal_block == Block("universal_minecraft","air") and includeAir:
continue
universal_block_entity = chunk.block_entities.get((x, y, z), None)
RyStructBlock["block"] = str(universal_block)
RyStructBlock["blockEntity"] = str(universal_block_entity)
self.RyStruct[(x,y,z)] = RyStructBlock
return self.RyStruct
'''
RyStruct = {
(0,0,0) = {
"block": str 完整的方块结构
"blockEntity": str | 'None'
}
}
'''