File size: 4,231 Bytes
1642e42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1ac298
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---

title: "Smart MC Building Generator"
emoji: "๐Ÿ—๏ธ"
colorFrom: "blue"
colorTo: "purple"
sdk: "streamlit"  # ๆˆ– gradio ๅ–ๅ†ณไบŽไฝ ็š„ web ็•Œ้ข
app_file: "main.py"
pinned: false
---


# Smart MC Building Generator

## Project Overview  
The Smart MC Building Generator is an AI-powered tool that automatically generates Minecraft structures based on user prompts (e.g., "flat roof", "dark oak walls"). It combines data augmentation, 3D generative models, and Minecraft data format conversion to create 10x10x10 structures from single images or text prompts, exporting them as `.schem` files.

---

[๐Ÿ‡จ๐Ÿ‡ณ ็ฎ€ไฝ“ไธญๆ–‡](Muti_language_Readme/README.zh.md) | [๐Ÿ‡ฌ๐Ÿ‡ง English](Muti_language_Readme/README.en.md)

---

## Key Features  
1. **Data Loading & Parsing**  
   โ€ข Supports loading and parsing Minecraft `.schem` files.  
2. **Data Augmentation**  
   โ€ข Generates diverse building variants via rotation and mirroring.  
3. **3D Visualization**  
   โ€ข Preview structures as point clouds, colored cubes, or slice views.  
4. **Prompt-Driven Generation**  
   โ€ข Generate buildings from text prompts (e.g., "small house with a flat roof").  
5. **Export Functionality**  
   โ€ข Save generated structures as `.schem` files for direct use in Minecraft.  

---

## Dependencies  
โ€ข **Python 3.8+**  
โ€ข **Core Libraries**:  
  โ€ข `numpy`  
  โ€ข `pyvista`  
  โ€ข `nbtlib`  
  โ€ข `torch` (for model training)  
  โ€ข `flask` (for web interface)  

**Installation**:  
```bash

pip install numpy pyvista nbtlib torch flask

```

---

## Usage  

### 1. Load & Parse Data  
Place your `.schem` file in the project directory and run:  
```python

from main import process_block_data  

process_block_data("WoodHouse_3.schem")  

```

### 2. Data Augmentation  
Generate rotated/mirrored variants of existing structures:  
```python

from main import generate_rotated_and_mirrored_data  

generate_rotated_and_mirrored_data()  

```

### 3. Visualization  
Preview structures using:  
```python

from main import preview_point_cloud, preview_cubes_with_colors, preview_slices  

preview_point_cloud(output_data)    # Point cloud view  

preview_cubes_with_colors(output_data)  # Colored cubes  

preview_slices(output_data)        # Slice view  

```

### 4. Prompt-Based Generation  
Generate structures from text prompts:  
```python

from main import generate_from_prompt  

generate_from_prompt("A small house with a flat roof and dark oak walls")  

```

### 5. Export to `.schem`  
Save generated structures:  
```python

from main import save_as_schem  

save_as_schem(house_data, "generated_house.schem")  

```

### 6. Web Interface  
Launch the interactive web server:  
```bash

python main.py  

```  
Visit `http://Not_created_yet` to generate buildings via prompts.  

---

## File Structure  
```

MC_Building_Generator/

โ”œโ”€โ”€ schem/                 # put .schem files

โ”‚   โ””โ”€โ”€ WoodHouse_3.schem

โ”œโ”€โ”€ npy/                   # put .npy files

โ”‚   โ””โ”€โ”€ block_data_0.npy

โ”œโ”€โ”€ main.py                # Main entry point  

โ”œโ”€โ”€ block_data.txt         # Parsed block data  

โ”œโ”€โ”€ metadata.txt           # Metadata (dimensions, block IDs)  

โ””โ”€โ”€ README.md              # This document

```
---

## Examples  
1. **Load a `.schem` file**:  
   ```bash

   python main.py  

   ```  
2. **Generate from a prompt**:  
   โ€ข **Prompt**: `A small house with a flat roof and dark oak walls`  
   โ€ข **Output**: `generated_house.schem`  

---

## Notes  
1. Ensure `.schem` files follow Minecraft's format specifications.  
2. Use clear and specific prompts for optimal results.  
3. Augmented data is saved in `block_data_*.npy` files.  

---

## Roadmap  
1. Support more building types and sizes.  
2. Optimize generation speed and model accuracy.  
3. Develop a real-time preview interface.  

---

## Contact  
For questions or feedback:  
โ€ข **Email**: 3467025700@qq.com  
โ€ข **GitHub**: [https://github.com/fallingstars123/MC-AI-BuildingGenerate](https://github.com/fallingstars123/MC-AI-BuildingGenerate)  
โ€ข **Discord**: thomasw2004

---