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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file TrimMCStruct-0.0.5.9.tar.gz.

File metadata

  • Download URL: TrimMCStruct-0.0.5.9.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for TrimMCStruct-0.0.5.9.tar.gz
Algorithm Hash digest
SHA256 c502bb3c4f9d7f767f6434b89157992c6d091faeefe40594a3c6ba1e6fdb1df2
MD5 c15b127411d4212d5ce62799dc783765
BLAKE2b-256 4e65092df70fbdce9c4c506bba429a78a6d1d8c885822955730d83c321df8115

See more details on using hashes here.

File details

Details for the file TrimMCStruct-0.0.5.9-py3-none-any.whl.

File metadata

File hashes

Hashes for TrimMCStruct-0.0.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9ace10f71dd0339a53d93f626f1449714b29104ca7108b8da1d11038ed00c2ba
MD5 a0417b329e73ca2349bd75213e92ca52
BLAKE2b-256 ebb352a101ca09b9c9959a4d093aeaa34818bed3476a61c17947897e896a4410

See more details on using hashes here.

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