Skip to main content

读写操作《我的世界》.MCSTRUCTURE文件

Project description

mcstructure logo

TrimMCStruct

对于《我的世界》.mcstructure 文件的读写操作库

CodeStyle: black

GiteeStar GiteeFork GitHub Repo stars GitHub Repo Forks

在此项目中(且更官方地是在“大一统更新”("Better Together Update")之后)专有名词《我的世界》("Minecraft")所指代的均为基岩版("Bedrock Edition")。

此项目中的所有特性也是仅仅针对基岩版的。

请注意 此项目目前仍属于 BETA 版本,因此很多的特性可能无法实现。

此库可以让您以代码实现对 《我的世界》 结构文件的创建(create)与编辑(edit)。 您能够凭此而将您自己的结构存储为 .mcstructure 文件,因而可以使之用于行为包中,或者发展出更优秀的用途。

当然,通过此库您也可以通过此库来读取(read)这些结构文件。 以获取(identify)其中存储之方块与实体之类。

译注:虽然上面看似废话,但实际上也是一个介绍好吧……QwQ

下载安装

pip install TrimMCStruct

基础用法

  1. 写入结构文件

    # 导入库
    from TrimMCStruct import Block, Structure
    
    # 实例化对象 Structure
    struct = Structure(
    	(7, 7, 7),  # 声明结构大小
    	Block("minecraft:wool", color = "red")	# 预填充方块
    )
    
    # 设定方块
    (struct
    	.set_block((1, 1, 1), Block("minecraft","grass"))
    	.set_block((2, 2, 2), Block("minecraft","grass"))
    	.set_block((3, 3, 3), Block("minecraft","grass"))
    	.set_block((4, 4, 4), Block("minecraft","grass"))
    	.set_block((5, 5, 5), Block("minecraft","grass"))
    	.set_block((6, 6, 6), Block("minecraft","grass"))
    )
    
    # 写入文件
    with open("something.mcstructure", "wb") as f:
    	struct.dump(f)
    
  2. 读取结构文件

    with open("something.mcstructure", "rb") as f:
    	struct = Structure.load(f)
    

NOT AN OFFICIAL MINECRAFT PRODUCT. NOT APPROVED BY OR ASSOCIATED WITH MOJANG.

此项目并非一个官方 《我的世界》(Minecraft)项目

此项目不隶属或关联于 Mojang Studios

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TrimMCStruct-0.0.5.9.tar.gz (16.2 kB view hashes)

Uploaded Source

Built Distribution

TrimMCStruct-0.0.5.9-py3-none-any.whl (14.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page