mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2026-07-31 15:34:57 +00:00
Update 0.0.4
This commit is contained in:
+55
-1
@@ -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'
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user