Skip to main content

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

Metadata

Release files for TrimMCStruct 0.0.5.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TrimMCStruct 0.0.5.9
File Size Uploaded
TrimMCStruct-0.0.5.9.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for TrimMCStruct 0.0.5.9
File Interpreter ABI Platform
TrimMCStruct-0.0.5.9-py3-none-any.whl Python 3 none any Details

Total release size: 31.0 kB

Release files / TrimMCStruct-0.0.5.9.tar.gz

Download URL TrimMCStruct-0.0.5.9.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c502bb3c4f9d7f767f6434b89157992c6d091faeefe40594a3c6ba1e6fdb1df2
BLAKE2b-256 checksum
How to use checksums
4e65092df70fbdce9c4c506bba429a78a6d1d8c885822955730d83c321df8115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / TrimMCStruct-0.0.5.9-py3-none-any.whl

Download URL TrimMCStruct-0.0.5.9-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ace10f71dd0339a53d93f626f1449714b29104ca7108b8da1d11038ed00c2ba
BLAKE2b-256 checksum
How to use checksums
ebb352a101ca09b9c9959a4d093aeaa34818bed3476a61c17947897e896a4410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.5.9 This release

2 release files

0.0.4

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page