#!/usr/bin/env python3 """Write the WorldGen Editor preset for a Poké Ball-shaped island. * Ball: one round island with a smooth coast. * Band: two flat-ended ocean strips across the middle, west and east of the button, so the ball splits into a top and a bottom half. * Button: a ring channel of overlapping small ocean circles around a round centre island (where the world spawn lands). All sizes are in blocks and are placeholders until Adrian approves the island (docs/balance.md). Usage: tools/pokeball_preset.py [--radius 1500] [--band 160] [--button 280] [--ring 120] """ import argparse import json import math from pathlib import Path ROOT = Path(__file__).resolve().parent.parent PRESET = ROOT / "pack/config/worldgen_editor/presets/cobblesurvival_island.json" def ocean(name, x, z, rx, rz, shape_power=2.0): return {"type": "ocean", "name": name, "x": round(x), "z": round(z), "radius_x": round(rx), "radius_z": round(rz), "shape_power": shape_power, "roughness": 0.02, "shore_width": 0.12, "temperature": "standard", "noise": {"seed": name.lower().replace(" ", "_"), "scale": 2.0}} def main(): parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument("--radius", type=int, default=1500, help="radius of the ball") parser.add_argument("--band", type=int, default=160, help="width of the channel across the middle") parser.add_argument("--button", type=int, default=280, help="radius of the centre island") parser.add_argument("--ring", type=int, default=120, help="width of the ring channel around the button") args = parser.parse_args() entries = [{ "type": "island", "name": "Ball", "x": 0, "z": 0, "radius": args.radius, "shape_power": 2.0, "roughness": 0.03, "shore_width": 0.1, "temperature": "standard", "noise": {"seed": "ball", "scale": 2.0, "first_octave": -1, "amplitudes": [1.0, 0.45, 0.18]}, }] ring_mid = args.button + args.ring / 2 # The band runs from the middle of the ring to just past the coast on each side. band_inner, band_outer = ring_mid, args.radius * 1.05 half = (band_outer - band_inner) / 2 for side, sign in (("west", -1), ("east", 1)): entries.append(ocean(f"Band {side}", sign * (band_inner + half), 0, half, args.band / 2, shape_power=6.0)) # Circles overlapping by about half their size, so the ring has no gaps. circle = args.ring / 2 count = math.ceil(2 * math.pi * ring_mid / circle) for i in range(count): angle = 2 * math.pi * i / count entries.append(ocean(f"Ring {i + 1}", ring_mid * math.cos(angle), ring_mid * math.sin(angle), circle, circle)) PRESET.write_text(json.dumps({"outer_ocean": "minecraft:deep_ocean", "entries": entries}, indent=2) + "\n") print(f"wrote {PRESET.relative_to(ROOT)}: ball r{args.radius}, band {args.band}, " f"button r{args.button}, ring {args.ring} ({count} circles)") if __name__ == "__main__": main()