Second commit
This commit is contained in:
parent
d064b83831
commit
ca7e6c2d79
18 changed files with 799 additions and 682 deletions
121
CHANGELOG.md
Normal file
121
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to **active-cubiomes** are documented here.
|
||||
|
||||
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
---
|
||||
|
||||
## [0.2.0] — 2026-10-12
|
||||
|
||||
### Added
|
||||
|
||||
**Advanced search conditions** — `SearchCriteria.conditions` now accepts any
|
||||
mix of the following new types in addition to the existing `BiomeCondition`
|
||||
and `StructureCondition`:
|
||||
|
||||
| Class | CLI flag | Description |
|
||||
|-------|----------|-------------|
|
||||
| `SpawnCondition` | `--spawn-biome` / `--spawn-max-dist` | Constrain spawn biome and/or distance from origin |
|
||||
| `StrongholdCondition` | `--stronghold-radius` / `--stronghold-count` | First N strongholds within a block radius |
|
||||
| `ProximityCondition` | `--proximity A B DIST` | Two structure types within DIST blocks of each other |
|
||||
| `QuadStructureCondition` | `--quad STRUCT` / `--quad-dist` | Classic quad-farm base: 4 viable instances in a 2×2 region grid |
|
||||
| `BiomeDensityCondition` | `--biome-density BIOME FRAC` | Minimum biome coverage fraction in an area |
|
||||
| `SlimeDensityCondition` | `--min-slime-chunks N` | Minimum slime-chunk count in a configurable chunk area |
|
||||
| `AnyOfBiomes` | `--any-biome NAME...` | OR semantics — at least one of a list of biomes must be present |
|
||||
| `CustomCondition` | — (Python API only) | Arbitrary `(seed, mc) → bool \| dict` function as a post-filter |
|
||||
|
||||
**`SeedResult` extended:**
|
||||
- `quad` — quad-structure result dict (`center`, `positions`, `max_r`, `name`)
|
||||
- `extra` — free-form dict populated by `BiomeDensityCondition`,
|
||||
`SlimeDensityCondition`, and `CustomCondition`
|
||||
|
||||
**Documentation** added under `docs/`:
|
||||
- `docs/guide.md` — user guide with code examples
|
||||
- `docs/api.md` — full API reference
|
||||
- `docs/search.md` — CLI and Python search API reference
|
||||
|
||||
**`cubiomes/__main__.py`** — enables `python -m cubiomes` as an alias for
|
||||
`python -m cubiomes.search`.
|
||||
|
||||
**`cubiomes-search` entry point** registered via `pyproject.toml` so the CLI
|
||||
is available after `pip install active-cubiomes`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- `OverflowError: can't convert negative value to uint64_t` when passing
|
||||
negative world seeds (e.g. from `--random-seeds`). All public Cython
|
||||
wrapper functions that accept a seed now use `long long` (int64) as the
|
||||
parameter type and cast to `uint64_t` internally, matching Minecraft's
|
||||
`long` seed semantics. Affected functions: `apply_seed`, `check_for_biomes`,
|
||||
`StrongholdIterator.__cinit__`, `get_structure_pos`, `get_variant`,
|
||||
`iter_strongholds`, `init_first_stronghold`, `get_mineshafts`,
|
||||
`is_slime_chunk`, `get_shadow`, `move_structure`, `chunk_generate_rnd`,
|
||||
`get_population_seed`.
|
||||
|
||||
- `_find_biome` in `search.py` replaced stochastic `locate_biome` (random
|
||||
walk, ~37 % miss-rate on common biomes at small radii) with deterministic
|
||||
`get_biome_centers` scan, eliminating false-negative search results.
|
||||
|
||||
- Nether/End structures (`Fortress`, `Bastion`, `End_City`, …) no longer
|
||||
trigger spurious `isViableStructurePos: bad structure type N or dimension 0`
|
||||
warnings when an Overworld generator is active — they are skipped based on
|
||||
the `dim` field of their `StructureConfig`.
|
||||
|
||||
### Changed
|
||||
|
||||
- `setup.py` C source glob now produces **relative** paths (via
|
||||
`os.path.relpath`) to satisfy setuptools' requirement when building a wheel
|
||||
from an sdist.
|
||||
- `pyproject.toml` build-backend corrected to `setuptools.build_meta`
|
||||
(was `setuptools.backends.legacy:build` which does not exist in
|
||||
setuptools 84).
|
||||
- License classifier removed from `classifiers` list (superseded by the
|
||||
`license = "MIT"` SPDX expression per PEP 639).
|
||||
|
||||
---
|
||||
|
||||
## [0.1.1] — 2026-10-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- `OverflowError` on negative seeds passed to `apply_seed` and related
|
||||
functions (initial partial fix; superseded by the comprehensive fix in
|
||||
0.2.0).
|
||||
|
||||
---
|
||||
|
||||
## [0.1.0] — 2026-10-12
|
||||
|
||||
### Added
|
||||
|
||||
- **Cython bindings** for [cubiomes](https://github.com/xpple/cubiomes) C
|
||||
library, compiled into a single shared object (`cubiomes._wrapper`).
|
||||
- **`Generator`** class — `apply_seed`, `get_biome_at`, `gen_biomes`,
|
||||
`get_spawn`, `estimate_spawn`, `locate_biome`, `get_biome_centers`,
|
||||
`check_for_biomes`.
|
||||
- **`BiomeFilter`** / `setup_biome_filter` — multi-scale biome requirement
|
||||
filter compatible with `check_for_biomes`.
|
||||
- **`StrongholdIterator`** — yields accurate stronghold positions with biome
|
||||
verification via `iter_strongholds`.
|
||||
- **`StructureVariant`** — structure rotation, bounding box, and flags via
|
||||
`get_variant`.
|
||||
- **Structure functions** — `get_structure_config`, `get_structure_pos`,
|
||||
`is_viable_structure_pos`, `is_viable_feature_biome`, `get_mineshafts`.
|
||||
- **Biome helpers** — `biome_exists`, `is_overworld_biome`, `get_dimension`,
|
||||
`get_mutated`, `get_category`, `are_similar`, `is_mesa`, `is_shallow_ocean`,
|
||||
`is_deep_ocean`, `is_oceanic`, `is_snowy`.
|
||||
- **Seed utilities** — `is_slime_chunk`, `get_shadow`, `move_structure`,
|
||||
`chunk_generate_rnd`, `get_population_seed`.
|
||||
- **`cubiomes.search`** module with `SearchCriteria`, `BiomeCondition`,
|
||||
`StructureCondition`, `SeedSearch`, `SeedResult` and the
|
||||
`cubiomes-search` CLI.
|
||||
- **`MCVersion`**, **`Dimension`**, **`BiomeID`**, **`StructureType`**
|
||||
`IntEnum` classes covering all versions up to MC 26.3.
|
||||
- 107 pytest tests covering bindings and search module.
|
||||
- `pyproject.toml`, `MANIFEST.in`, `README.md`, `LICENSE`.
|
||||
|
||||
[0.2.0]: https://github.com/xpple/cubiomes/compare/v0.1.1...v0.2.0
|
||||
[0.1.1]: https://github.com/xpple/cubiomes/compare/v0.1.0...v0.1.1
|
||||
[0.1.0]: https://github.com/xpple/cubiomes/releases/tag/v0.1.0
|
||||
|
|
@ -10,6 +10,7 @@ recursive-include _cubiomes_src *.c *.h
|
|||
|
||||
# Project files
|
||||
include README.md
|
||||
include CHANGELOG.md
|
||||
include LICENSE
|
||||
include pyproject.toml
|
||||
|
||||
|
|
|
|||
|
|
@ -1,166 +0,0 @@
|
|||
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.
|
||||
|
|
@ -1,212 +0,0 @@
|
|||
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
|
||||
|
|
@ -1 +0,0 @@
|
|||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
[console_scripts]
|
||||
cubiomes-search = cubiomes.search:main
|
||||
|
|
@ -1 +0,0 @@
|
|||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
[dev]
|
||||
pytest>=7
|
||||
numpy>=1.20
|
||||
cython>=3.0
|
||||
|
||||
[numpy]
|
||||
numpy>=1.20
|
||||
|
|
@ -1 +0,0 @@
|
|||
cubiomes
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -13,7 +13,7 @@ cimport _cubiomes as cb
|
|||
|
||||
from libc.stdlib cimport malloc, free
|
||||
from libc.string cimport memcpy
|
||||
from libc.stdint cimport uint64_t, uint32_t, int16_t, uint8_t
|
||||
from libc.stdint cimport uint64_t, int64_t, uint32_t, int16_t, uint8_t
|
||||
from cpython.array cimport array, clone
|
||||
import array as _array_module
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ cdef class Generator:
|
|||
|
||||
# ── core methods ──────────────────────────────────────────────────────────
|
||||
|
||||
def apply_seed(self, int dim, uint64_t seed):
|
||||
def apply_seed(self, int dim, long long seed):
|
||||
"""Bind a world seed and dimension to the generator.
|
||||
|
||||
Must be called before any biome generation.
|
||||
|
|
@ -100,7 +100,7 @@ cdef class Generator:
|
|||
* ``DIM_END = +1``
|
||||
seed (int): 64-bit world seed.
|
||||
"""
|
||||
cb.applySeed(self._g, dim, seed)
|
||||
cb.applySeed(self._g, dim, <uint64_t>seed)
|
||||
|
||||
def get_biome_at(self, int x, int y, int z, int scale=4) -> int:
|
||||
"""Get the biome ID at a single position.
|
||||
|
|
@ -274,7 +274,7 @@ cdef class Generator:
|
|||
return result
|
||||
|
||||
def check_for_biomes(self, int x, int z, int sx, int sz,
|
||||
int scale, int dim, uint64_t seed,
|
||||
int scale, int dim, long long seed,
|
||||
BiomeFilter biome_filter,
|
||||
int y=0, int sy=1):
|
||||
"""Test whether a region satisfies a biome filter.
|
||||
|
|
@ -304,7 +304,7 @@ cdef class Generator:
|
|||
r.y = y
|
||||
r.sy = sy
|
||||
return cb.checkForBiomes(
|
||||
self._g, NULL, r, dim, seed, &biome_filter._bf, NULL)
|
||||
self._g, NULL, r, dim, <uint64_t>seed, &biome_filter._bf, NULL)
|
||||
|
||||
|
||||
# ─── BiomeFilter ─────────────────────────────────────────────────────────────
|
||||
|
|
@ -384,9 +384,9 @@ cdef class StrongholdIterator:
|
|||
cdef bint _has_current
|
||||
cdef bint _has_more
|
||||
|
||||
def __cinit__(self, Generator gen, uint64_t seed48):
|
||||
def __cinit__(self, Generator gen, long long seed48):
|
||||
self._gen = gen
|
||||
cb.initFirstStronghold(&self._sh, gen.mc, seed48)
|
||||
cb.initFirstStronghold(&self._sh, gen.mc, <uint64_t>seed48)
|
||||
cdef int remaining = cb.nextStronghold(
|
||||
&self._sh, gen._g if gen is not None else NULL)
|
||||
self._has_current = True
|
||||
|
|
@ -512,7 +512,7 @@ def get_structure_config(int struct_type, int mc):
|
|||
}
|
||||
|
||||
|
||||
def get_structure_pos(int struct_type, int mc, uint64_t seed,
|
||||
def get_structure_pos(int struct_type, int mc, long long seed,
|
||||
int reg_x, int reg_z):
|
||||
"""Find the block position of a structure attempt in a region.
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ def get_structure_pos(int struct_type, int mc, uint64_t seed,
|
|||
if no valid attempt exists in this region.
|
||||
"""
|
||||
cdef cb.Pos pos
|
||||
if not cb.getStructurePos(struct_type, mc, seed, reg_x, reg_z, &pos):
|
||||
if not cb.getStructurePos(struct_type, mc, <uint64_t>seed, reg_x, reg_z, &pos):
|
||||
return None
|
||||
return (pos.x, pos.z)
|
||||
|
||||
|
|
@ -573,7 +573,7 @@ def is_viable_feature_biome(int mc, int struct_type, int biome_id) -> bool:
|
|||
return bool(cb.isViableFeatureBiome(mc, struct_type, biome_id))
|
||||
|
||||
|
||||
def get_variant(int struct_type, int mc, uint64_t seed,
|
||||
def get_variant(int struct_type, int mc, long long seed,
|
||||
int block_x, int block_z, int biome_id=-1):
|
||||
"""Retrieve variant information (rotation, size, flags) for a structure.
|
||||
|
||||
|
|
@ -590,13 +590,13 @@ def get_variant(int struct_type, int mc, uint64_t seed,
|
|||
StructureVariant | None
|
||||
"""
|
||||
cdef StructureVariant sv = StructureVariant.__new__(StructureVariant)
|
||||
if not cb.getVariant(&sv._sv, struct_type, mc, seed,
|
||||
if not cb.getVariant(&sv._sv, struct_type, mc, <uint64_t>seed,
|
||||
block_x, block_z, biome_id):
|
||||
return None
|
||||
return sv
|
||||
|
||||
|
||||
def iter_strongholds(Generator gen, uint64_t seed48):
|
||||
def iter_strongholds(Generator gen, long long seed48):
|
||||
"""Return an iterator that yields stronghold positions in order.
|
||||
|
||||
Each value is an accurate ``(x, z)`` block coordinate pair obtained
|
||||
|
|
@ -620,7 +620,7 @@ def iter_strongholds(Generator gen, uint64_t seed48):
|
|||
return StrongholdIterator(gen, seed48)
|
||||
|
||||
|
||||
def init_first_stronghold(int mc, uint64_t seed48):
|
||||
def init_first_stronghold(int mc, long long seed48):
|
||||
"""Return the approximate position of the first stronghold (no biome check).
|
||||
|
||||
This is faster than :func:`iter_strongholds` but accurate only to ±112
|
||||
|
|
@ -634,11 +634,11 @@ def init_first_stronghold(int mc, uint64_t seed48):
|
|||
tuple[int, int]: Approximate ``(x, z)`` block coordinates.
|
||||
"""
|
||||
cdef cb.StrongholdIter sh
|
||||
cdef cb.Pos pos = cb.initFirstStronghold(&sh, mc, seed48)
|
||||
cdef cb.Pos pos = cb.initFirstStronghold(&sh, mc, <uint64_t>seed48)
|
||||
return (pos.x, pos.z)
|
||||
|
||||
|
||||
def get_mineshafts(int mc, uint64_t seed,
|
||||
def get_mineshafts(int mc, long long seed,
|
||||
int chunk_x, int chunk_z,
|
||||
int chunk_w, int chunk_h,
|
||||
int max_count=1024):
|
||||
|
|
@ -658,7 +658,7 @@ def get_mineshafts(int mc, uint64_t seed,
|
|||
if out is NULL:
|
||||
raise MemoryError()
|
||||
cdef int n = cb.getMineshafts(
|
||||
mc, seed, chunk_x, chunk_z, chunk_w, chunk_h, out, max_count)
|
||||
mc, <uint64_t>seed, chunk_x, chunk_z, chunk_w, chunk_h, out, max_count)
|
||||
result = [(out[i].x, out[i].z) for i in range(n)]
|
||||
free(out)
|
||||
return result
|
||||
|
|
@ -686,7 +686,7 @@ def setup_biome_filter(int mc,
|
|||
return BiomeFilter(mc, required, excluded, match_any, flags)
|
||||
|
||||
|
||||
def is_slime_chunk(uint64_t seed, int chunk_x, int chunk_z) -> bool:
|
||||
def is_slime_chunk(long long seed, int chunk_x, int chunk_z) -> bool:
|
||||
"""Return True if the given chunk spawns slimes at any light level.
|
||||
|
||||
Args:
|
||||
|
|
@ -696,10 +696,10 @@ def is_slime_chunk(uint64_t seed, int chunk_x, int chunk_z) -> bool:
|
|||
Returns:
|
||||
bool
|
||||
"""
|
||||
return bool(cb.isSlimeChunk(seed, chunk_x, chunk_z))
|
||||
return bool(cb.isSlimeChunk(<uint64_t>seed, chunk_x, chunk_z))
|
||||
|
||||
|
||||
def get_shadow(uint64_t seed) -> int:
|
||||
def get_shadow(long long seed) -> int:
|
||||
"""Compute the shadow seed for a given world seed.
|
||||
|
||||
The shadow seed produces mirrored structure positions.
|
||||
|
|
@ -710,10 +710,10 @@ def get_shadow(uint64_t seed) -> int:
|
|||
Returns:
|
||||
int: Shadow seed.
|
||||
"""
|
||||
return cb.getShadow(seed)
|
||||
return cb.getShadow(<uint64_t>seed)
|
||||
|
||||
|
||||
def move_structure(uint64_t base_seed, int reg_x, int reg_z) -> int:
|
||||
def move_structure(long long base_seed, int reg_x, int reg_z) -> int:
|
||||
"""Translate a base seed so that structures shift by ``(reg_x, reg_z)`` regions.
|
||||
|
||||
Useful for finding quad-witch-hut or quad-monument base seeds.
|
||||
|
|
@ -725,10 +725,10 @@ def move_structure(uint64_t base_seed, int reg_x, int reg_z) -> int:
|
|||
Returns:
|
||||
int: Translated seed (lower 48 bits).
|
||||
"""
|
||||
return cb.moveStructure(base_seed, reg_x, reg_z)
|
||||
return cb.moveStructure(<uint64_t>base_seed, reg_x, reg_z)
|
||||
|
||||
|
||||
def chunk_generate_rnd(uint64_t world_seed,
|
||||
def chunk_generate_rnd(long long world_seed,
|
||||
int chunk_x, int chunk_z) -> int:
|
||||
"""Compute the chunk-generation random seed used for caves/structures.
|
||||
|
||||
|
|
@ -739,10 +739,10 @@ def chunk_generate_rnd(uint64_t world_seed,
|
|||
Returns:
|
||||
int: 64-bit random seed.
|
||||
"""
|
||||
return cb.chunkGenerateRnd(world_seed, chunk_x, chunk_z)
|
||||
return cb.chunkGenerateRnd(<uint64_t>world_seed, chunk_x, chunk_z)
|
||||
|
||||
|
||||
def get_population_seed(int mc, uint64_t world_seed,
|
||||
def get_population_seed(int mc, long long world_seed,
|
||||
int x, int z) -> int:
|
||||
"""Return the population seed for a given chunk (block) position.
|
||||
|
||||
|
|
@ -754,7 +754,7 @@ def get_population_seed(int mc, uint64_t world_seed,
|
|||
Returns:
|
||||
int: 64-bit population seed.
|
||||
"""
|
||||
return cb.getPopulationSeed(mc, world_seed, x, z)
|
||||
return cb.getPopulationSeed(mc, <uint64_t>world_seed, x, z)
|
||||
|
||||
|
||||
# ─── Biome property helpers ───────────────────────────────────────────────────
|
||||
|
|
|
|||
Binary file not shown.
BIN
dist/active_cubiomes-0.1.0.tar.gz
vendored
BIN
dist/active_cubiomes-0.1.0.tar.gz
vendored
Binary file not shown.
|
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||
|
||||
[project]
|
||||
name = "active_cubiomes"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
description = "Python/Cython bindings for cubiomes — fast Minecraft biome and structure generator"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -65,7 +65,7 @@ ext = Extension(
|
|||
|
||||
setup(
|
||||
name="active_cubiomes",
|
||||
version="0.1.0",
|
||||
version="0.2.0",
|
||||
description=(
|
||||
"Python/Cython bindings for cubiomes — "
|
||||
"fast Minecraft biome and structure generator"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue