Skip to content

Claude/minecraft heightmap generator dhk a4#14

Merged
stephenkall merged 3 commits intomainfrom
claude/minecraft-heightmap-generator-DhkA4
May 8, 2026
Merged

Claude/minecraft heightmap generator dhk a4#14
stephenkall merged 3 commits intomainfrom
claude/minecraft-heightmap-generator-DhkA4

Conversation

@stephenkall
Copy link
Copy Markdown
Owner

Fixing water_map issues

stephenkall and others added 3 commits May 8, 2026 01:21
When crop_poly is set, _crop_to_polygon slices the heightmap to the
bounding box and zeroes pixels outside the polygon. The water_map was
not being sliced, causing a shape mismatch in build_ocean_mask.

- _crop_to_polygon: add extra_bool_maps parameter; applies the same
  row/col slice and outside-mask to each array in the list
- load_save: pass [water_map] as extra_bool_maps so it is cropped together
  with the heightmap in a single call
- stage_load cache-resume: if cached water_map has wrong shape (saved
  before this fix), discard it rather than crashing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ir above

Minecraft heightmap convention: heightmap[z,x] = Y+1 of the topmost solid
block (i.e. the first air block from above), not the block itself.

The old code used heightmap[z,x] directly, which pointed one above the
surface block into air. _is_water(air) is always False, so water_map was
all-False everywhere, and candidate & water_map killed all ocean detection.

Fix: use heightmap[z,x] - 1 as the block Y to query.

Also move y_min/y_max out of the inner loop (micro-optimization).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
If the STL dimensions (max_x_mm, max_y_mm) are both <= tile dimensions
(tile_x_mm, tile_y_mm), there is no point generating a mosaic — the
entire model fits on a single print bed.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@stephenkall stephenkall merged commit bbfacce into main May 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant