Phase 4: regenerating ore veins, each tier in one zone

Regenerating Ore Veins 1.4.0 (CurseForge only, MIT). tools/zone_ores.py
writes its config from world/zones.json: surface zones as boxes from the
zone grid, cave tiers by cave biome, 21 tiers including Cobblemon's
evolution stones (their natural ores are off). The world report now
allows ore only in tracked veins inside their tier's zone. Self-tests:
a mined vein regrows after its chunk unloads and after a restart (new
after_restart pass in selftest.py and quick_check.py). make_world places
showcase veins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-10-30 02:30:34 +01:00
1 parent 82f540aa51
commit 5d275e4e14
19 files changed
+10843 -37

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
"""The zone grid as the companion mod sees it (datapacks/core/data/cobblesurvival/zones/island.json).
zone_at() answers like zone/Zones.kt: a cave biome is its cave zone; otherwise the grid cell's zone.
"""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
ISLAND = ROOT / "datapacks/core/data/cobblesurvival/zones/island.json"
class Grid:
def __init__(self, data):
self.radius, self.step, self.size = data["radius"], data["step"], data["size"]
self.ids = [z["id"] for z in data["zones"]]
self.caves = {c["biome"]: c["id"] for c in data["caves"]}
self.cells = [value for value, count in data["grid_rle"] for _ in range(count)]
if len(self.cells) != self.size * self.size:
raise ValueError(f"zone grid has {len(self.cells)} cells, expected {self.size ** 2}")
def zone_at(self, x, z, biome=None):
if biome in self.caves:
return self.caves[biome]
col = (x + self.radius + self.step // 2) // self.step
row = (z + self.radius + self.step // 2) // self.step
if not (0 <= col < self.size and 0 <= row < self.size):
return None
index = self.cells[row * self.size + col]
return self.ids[index] if 0 <= index < len(self.ids) else None
def load(path=ISLAND):
return Grid(json.loads(Path(path).read_text()))