Amulet-Team / Amulet-Core

A Python library for reading and writing the Minecraft save formats. See Amulet for the actual editor.
https://www.amuletmc.com/
215 stars 33 forks source link

About the export .mcstructure file #284

Closed jojojo805 closed 3 months ago

jojojo805 commented 3 months ago
def main():
    world = amulet.load_level("C:/Users/jo1/AppData/Roaming/MinecraftPE_Netease/minecraftWorlds/java2")
    world_dimesion = "minecraft:overworld"
    version = (1, 18, 30)
    path = "C:/Users/jo1/AppData/Roaming/MinecraftPE_Netease/exported_structures/test.mcstructure"
    selection = SelectionGroup(SelectionBox((0, 50, 0), (500, 100, 500)))
    wrapper = MCStructureFormatWrapper(path)
    wrapper.create_and_open("bedrock", version, selection, True)

    wrapper.translation_manager = world.translation_manager
    wrapper_dimension = wrapper.dimensions[0]

    for (cx, cz) in selection.chunk_locations():
        try:
            chunk = world.level_wrapper.load_chunk(cx, cz, world_dimesion)
            wrapper.commit_chunk(chunk, wrapper_dimension)
        except ChunkLoadError:
            print("ChunkLoadError")

    wrapper.save()
    wrapper.close()

if __name__ == '__main__':
    main()

When I run this code, I get the.mcstructure file in the wrong format, When you open it with NBT Studio, you find "minecraft:andesite" in the block_palette, but the palette should actually be "name:minecraft:stone state:stone_type:andesite" Similar to this sentence, so I lost andesite when I converted, is there something wrong with the code I wrote? I want to change the code so that the exported file looks like it was saved in a structure block. Can someone help me?

5446BCC8-2555-479b-9CB9-59DDFE0C6229 44241B63-3FB3-4865-894A-06B2DBB2DB80

gentlegiantJGC commented 3 months ago

I will handle this in Amulet-Team/Amulet-Map-Editor#1033