Procedurally generates a settlement in an existing Minecraft world using a genetic algorithm for placement and modular builds for construction.
- Minecraft Java Edition
- GDMC HTTP mod — exposes a local HTTP interface that lets Python communicate with the game
- Python 3.9+
Install Python dependencies:
pip install gdpc numpyThe generator works inside a rectangular area you define in-game. To set it, open the Minecraft chat and run:
/setbuildarea x1 y1 z1 x2 y2 z2
For example, to mark a 100×100 area starting at your current position:
/setbuildarea ~ ~ ~ ~100 255 ~100
This command is added by the GDMC HTTP mod. The generator reads this area automatically when it starts — no coordinates need to be set in the Python code.
With Minecraft open and the GDMC HTTP mod loaded, run:
python main.pyThe script will:
- Read the build area you set in-game
- Run the genetic algorithm to find placement spots for 11 houses and a worship place
- Flatten the terrain at each site
- Build all structures and decorate the interiors
- Adapt block materials to the local biome
| File | Role |
|---|---|
main.py |
Entry point — orchestrates the full pipeline |
SearchPlacingXZ.py |
Genetic algorithm that finds optimal (x, z) positions for all buildings |
HouseBuilder.py |
Constructs the houses and their interiors |
ChurchBuilder.py |
Constructs the worship place and its chandelier |
MinecraftStructure.py |
Loads pre-built structures from JSON and places them in-world with biome adaptation |
structures/ |
JSON files for the 9 house modules and the worship place modules |