First commit

This commit is contained in:
Arigadam 2026-10-12 10:23:10 +00:00
commit 9b0fe9b1b7
126 changed files with 31043 additions and 0 deletions

View file

@ -0,0 +1,166 @@
Metadata-Version: 2.4
Name: active_cubiomes
Version: 0.1.0
Summary: Python/Cython bindings for cubiomes — fast Minecraft biome and structure generator
License-Expression: MIT
Project-URL: Homepage, https://github.com/xpple/cubiomes
Project-URL: Source, https://github.com/xpple/cubiomes
Project-URL: Tracker, https://github.com/xpple/cubiomes/issues
Keywords: minecraft,cubiomes,biomes,seed,worldgen,speedrun
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Cython
Classifier: Topic :: Games/Entertainment
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: numpy
Requires-Dist: numpy>=1.20; extra == "numpy"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: numpy>=1.20; extra == "dev"
Requires-Dist: cython>=3.0; extra == "dev"
Dynamic: license-file
Dynamic: requires-python
# active-cubiomes
Python/Cython bindings for [cubiomes](https://github.com/xpple/cubiomes) —
a fast C library that replicates Minecraft's world-generation algorithms
without running the game.
```
pip install active-cubiomes
```
> **Import name:** `import cubiomes` (the distribution is `active-cubiomes`)
---
## Quick start
```python
from cubiomes import Generator, MCVersion, Dimension, BiomeID
g = Generator(MCVersion.MC_1_21)
g.apply_seed(Dimension.DIM_OVERWORLD, 123456789)
biome = g.get_biome_at(0, 63, 0) # block coords
print(BiomeID(biome).name) # "river"
# 256×256 biome map at 1:4 scale
ids = g.gen_biomes(-128, -128, 256, 256) # array.array('i')
import numpy as np
grid = np.array(ids, dtype=np.int32).reshape(256, 256)
```
## Structure finding
```python
from cubiomes import StructureType, get_structure_pos, is_viable_structure_pos
seed = 123456789
mc = MCVersion.MC_1_21
for reg_x in range(-3, 4):
for reg_z in range(-3, 4):
pos = get_structure_pos(StructureType.Village, mc, seed, reg_x, reg_z)
if pos and is_viable_structure_pos(StructureType.Village, g, *pos):
print(f"Village at {pos}")
```
## Strongholds
```python
from cubiomes import iter_strongholds
for i, (x, z) in enumerate(iter_strongholds(g, seed=123456789)):
print(f"Stronghold {i}: ({x}, {z})")
if i >= 4:
break
```
## Seed search CLI
```bash
# Seeds with mushroom fields AND badlands within 4 km
cubiomes-search --mc 1.21 --biome mushroom_fields badlands --biome-radius 4000 --count 5
# Quad witch-hut base
cubiomes-search --mc 1.21 --quad Swamp_Hut --quad-dist 128 --count 3
# Inspect one seed
cubiomes-search --seed 123456789 --info
# Village and Monument within 400 blocks of each other, JSON output
cubiomes-search --mc 1.21 --proximity Village Monument 400 --count 10 --format json
```
## Seed search Python API
```python
from cubiomes.search import (
SearchCriteria, BiomeCondition, StructureCondition,
SpawnCondition, StrongholdCondition, ProximityCondition,
QuadStructureCondition, BiomeDensityCondition,
SlimeDensityCondition, AnyOfBiomes, CustomCondition,
SeedSearch,
)
from cubiomes import MCVersion, BiomeID, StructureType
criteria = SearchCriteria(
mc=MCVersion.MC_1_21,
biomes=[BiomeCondition(BiomeID.mushroom_fields, radius=2000)],
conditions=[
SpawnCondition(max_distance=500),
StrongholdCondition(count=1, max_distance=2000),
QuadStructureCondition(StructureType.Swamp_Hut, max_dist=128),
],
)
for result in SeedSearch(criteria).run(
seed_range=(0, 100_000_000),
count=5,
workers=4,
):
print(result)
```
## All condition types
| Class | CLI flag | Description |
|-------|----------|-------------|
| `BiomeCondition` | `--biome NAME...` | Biome must exist near origin (AND) |
| `AnyOfBiomes` | `--any-biome NAME...` | At least one biome (OR) |
| `StructureCondition` | `--structure NAME...` | Structure viable near origin |
| `SpawnCondition` | `--spawn-biome / --spawn-max-dist` | Spawn location/biome |
| `StrongholdCondition` | `--stronghold-radius` | First N strongholds in radius |
| `ProximityCondition` | `--proximity A B DIST` | Two structures near each other |
| `QuadStructureCondition` | `--quad STRUCT` | Quad-farm base (2×2 regions) |
| `BiomeDensityCondition` | `--biome-density BIOME FRAC` | Biome coverage fraction |
| `SlimeDensityCondition` | `--min-slime-chunks N` | Minimum slime chunks |
| `CustomCondition` | — (Python only) | Arbitrary `(seed, mc) → bool` function |
## Building from source
Requires GCC and Python ≥ 3.8:
```bash
git clone https://github.com/your-fork/active-cubiomes
cd active-cubiomes
pip install -e ".[dev]"
```
## License
The Python bindings are MIT licensed.
The bundled [cubiomes](https://github.com/xpple/cubiomes) C library
is also MIT licensed.

View file

@ -0,0 +1,212 @@
LICENSE
MANIFEST.in
README.md
pyproject.toml
setup.py
_cubiomes_src/biomenoise.c
_cubiomes_src/biomenoise.h
_cubiomes_src/biomes.c
_cubiomes_src/biomes.h
_cubiomes_src/carver.c
_cubiomes_src/carver.h
_cubiomes_src/finders.c
_cubiomes_src/finders.h
_cubiomes_src/generator.c
_cubiomes_src/generator.h
_cubiomes_src/layers.c
_cubiomes_src/layers.h
_cubiomes_src/noise.c
_cubiomes_src/noise.h
_cubiomes_src/quadbase.c
_cubiomes_src/quadbase.h
_cubiomes_src/rng.h
_cubiomes_src/terrainnoise.c
_cubiomes_src/terrainnoise.h
_cubiomes_src/tests.c
_cubiomes_src/util.c
_cubiomes_src/util.h
_cubiomes_src/xradv.c
_cubiomes_src/xrms.h
_cubiomes_src/features/abandoned_camp.c
_cubiomes_src/features/abandoned_camp.h
_cubiomes_src/features/end_city.c
_cubiomes_src/features/end_city.h
_cubiomes_src/features/fortress.c
_cubiomes_src/features/fortress.h
_cubiomes_src/features/ore.c
_cubiomes_src/features/ore.h
_cubiomes_src/features/stronghold.c
_cubiomes_src/features/stronghold.h
_cubiomes_src/loot/items.c
_cubiomes_src/loot/items.h
_cubiomes_src/loot/logging.h
_cubiomes_src/loot/loot_functions.c
_cubiomes_src/loot/loot_functions.h
_cubiomes_src/loot/loot_table_context.c
_cubiomes_src/loot/loot_table_context.h
_cubiomes_src/loot/loot_table_parser.c
_cubiomes_src/loot/loot_table_parser.h
_cubiomes_src/loot/loot_tables.c
_cubiomes_src/loot/loot_tables.h
_cubiomes_src/loot/mc_loot.h
_cubiomes_src/loot/cjson/cJSON.c
_cubiomes_src/loot/cjson/cJSON.h
_cubiomes_src/loot/loot_tables/barrels/abandoned_camp_barrel_26_3.c
_cubiomes_src/loot/loot_tables/barrels/abandoned_camp_barrel_26_3.h
_cubiomes_src/loot/loot_tables/chests/abandoned_camp_common_chest_26_3.c
_cubiomes_src/loot/loot_tables/chests/abandoned_camp_common_chest_26_3.h
_cubiomes_src/loot/loot_tables/chests/abandoned_camp_secret_chest_26_3.c
_cubiomes_src/loot/loot_tables/chests/abandoned_camp_secret_chest_26_3.h
_cubiomes_src/loot/loot_tables/chests/bastion_bridge_1_16_1.c
_cubiomes_src/loot/loot_tables/chests/bastion_bridge_1_16_1.h
_cubiomes_src/loot/loot_tables/chests/bastion_bridge_1_16_5.c
_cubiomes_src/loot/loot_tables/chests/bastion_bridge_1_16_5.h
_cubiomes_src/loot/loot_tables/chests/bastion_bridge_1_20.c
_cubiomes_src/loot/loot_tables/chests/bastion_bridge_1_20.h
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_16_1.c
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_16_1.h
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_16_5.c
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_16_5.h
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_20.c
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_20.h
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_21_9.c
_cubiomes_src/loot/loot_tables/chests/bastion_other_1_21_9.h
_cubiomes_src/loot/loot_tables/chests/buried_treasure_1_13.c
_cubiomes_src/loot/loot_tables/chests/buried_treasure_1_13.h
_cubiomes_src/loot/loot_tables/chests/buried_treasure_1_18.c
_cubiomes_src/loot/loot_tables/chests/buried_treasure_1_18.h
_cubiomes_src/loot/loot_tables/chests/buried_treasure_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/buried_treasure_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_13.c
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_13.h
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_20.c
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_20.h
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_21_6.c
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_21_6.h
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_21_9.c
_cubiomes_src/loot/loot_tables/chests/desert_pyramid_1_21_9.h
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_13.c
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_13.h
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_20.c
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_20.h
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_21_9.c
_cubiomes_src/loot/loot_tables/chests/end_city_treasure_1_21_9.h
_cubiomes_src/loot/loot_tables/chests/igloo_chest_1_13.c
_cubiomes_src/loot/loot_tables/chests/igloo_chest_1_13.h
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_13.c
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_13.h
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_14.c
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_14.h
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_20.c
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_20.h
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_21_6.c
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_21_6.h
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_21_9.c
_cubiomes_src/loot/loot_tables/chests/jungle_temple_1_21_9.h
_cubiomes_src/loot/loot_tables/chests/jungle_temple_dispenser_1_13.c
_cubiomes_src/loot/loot_tables/chests/jungle_temple_dispenser_1_13.h
_cubiomes_src/loot/loot_tables/chests/nether_bridge_1_13.c
_cubiomes_src/loot/loot_tables/chests/nether_bridge_1_13.h
_cubiomes_src/loot/loot_tables/chests/nether_bridge_1_20.c
_cubiomes_src/loot/loot_tables/chests/nether_bridge_1_20.h
_cubiomes_src/loot/loot_tables/chests/nether_bridge_1_21_9.c
_cubiomes_src/loot/loot_tables/chests/nether_bridge_1_21_9.h
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_14.c
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_14.h
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_19_2.c
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_19_2.h
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_20.c
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_20.h
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/pillager_outpost_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/ruined_portal_1_16_1.c
_cubiomes_src/loot/loot_tables/chests/ruined_portal_1_16_1.h
_cubiomes_src/loot/loot_tables/chests/ruined_portal_1_21_5.c
_cubiomes_src/loot/loot_tables/chests/ruined_portal_1_21_5.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_13.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_13.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_18.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_18.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_20.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_20.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_map_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_13.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_13.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_14.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_14.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_17.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_17.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_20.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_20.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_supply_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_treasure_1_13.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_treasure_1_13.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_treasure_1_20.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_treasure_1_20.h
_cubiomes_src/loot/loot_tables/chests/shipwreck_treasure_1_21_11.c
_cubiomes_src/loot/loot_tables/chests/shipwreck_treasure_1_21_11.h
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_13.c
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_13.h
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_18.c
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_18.h
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_20.c
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_20.h
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_21_6.c
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_21_6.h
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_21_9.c
_cubiomes_src/loot/loot_tables/chests/stronghold_corridor_1_21_9.h
_cubiomes_src/loot/loot_tables/chests/stronghold_crossing_1_13.c
_cubiomes_src/loot/loot_tables/chests/stronghold_crossing_1_13.h
_cubiomes_src/loot/loot_tables/chests/stronghold_library_1_13.c
_cubiomes_src/loot/loot_tables/chests/stronghold_library_1_13.h
_cubiomes_src/loot/loot_tables/chests/stronghold_library_1_20.c
_cubiomes_src/loot/loot_tables/chests/stronghold_library_1_20.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_common_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_common_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_common_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_common_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_rare_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_rare_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_unique_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_ominous_unique_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_rare_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_rare_1_21_1.h
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_unique_1_21_1.c
_cubiomes_src/loot/loot_tables/chests/trial_chambers/reward_unique_1_21_1.h
_cubiomes_src/tables/btree18.h
_cubiomes_src/tables/btree19.h
_cubiomes_src/tables/btree192.h
_cubiomes_src/tables/btree20.h
_cubiomes_src/tables/btree215.h
_cubiomes_src/tables/btree21wd.h
_cubiomes_src/tables/btree262.h
_cubiomes_src/tables/btree263.h
_cubiomes_src/tests/test_biomes.c
_cubiomes_src/tests/test_carvers.c
_cubiomes_src/tests/test_loot.c
_cubiomes_src/tests/test_pieces.c
_cubiomes_src/tests/test_structures.c
_cubiomes_src/tests/testing.h
cubiomes/__init__.py
cubiomes/__main__.py
cubiomes/_cubiomes.pxd
cubiomes/_wrapper.c
cubiomes/_wrapper.pyx
cubiomes/enums.py
cubiomes/search.py
tests/test_cubiomes.py
tests/test_search.py

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,2 @@
[console_scripts]
cubiomes-search = cubiomes.search:main

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,8 @@
[dev]
pytest>=7
numpy>=1.20
cython>=3.0
[numpy]
numpy>=1.20

View file

@ -0,0 +1 @@
cubiomes