Second commit

This commit is contained in:
Arigadam 2026-10-12 12:28:11 +00:00
parent d064b83831
commit ca7e6c2d79
18 changed files with 799 additions and 682 deletions

121
CHANGELOG.md Normal file
View 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