Free NeoForge 1.21.1 modpack on Cobblemon 1.8.4 built with packwiz, plus the Kotlin companion mod (cobblesurvival) and its built-in data pack. - Phase 0: packwiz pack with Modrinth/CurseForge cross-links, build and export tooling, Prism instance sync, test server with smoke checks. - Phase 1: Poke Ball shaped island (WorldGen Editor preset, seed isle-26), Adrian's biome list, no natural ore, structures without ore or vanilla mobs, no Nether portals, world template builder and world report. - Phase 2: permadeath (CobbleHardcoreMon plus the companion mod's gap fixes), Revival Charm, expensive Healing Machine, Lootr refreshing loot, in-game self-tests on Minecraft's GameTest framework. - Phase 3 so far: 14 zones with their own spawn pools and level bands (tools/zone_layout.py, tools/zone_spawns.py, "zone" spawn condition), Cold Sweat heat and cold as gates with boss-drop insulation recipes, spawn survey and hazard self-tests in tools/quick_check.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
97 lines
3.8 KiB
Python
97 lines
3.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Create or update a Prism Launcher instance from build/stage/full.
|
|
|
|
Writes instance.cfg and mmc-pack.json (Minecraft + NeoForge from pack.toml),
|
|
then syncs the client-side files with packwiz-installer. Run tools/build.py
|
|
first. Run it again after changing the pack; options and saves in the
|
|
instance are left alone. Close the instance in Prism before syncing.
|
|
|
|
When build/world-template exists (tools/make_world.py), it is copied into the
|
|
instance as the save "Cobblemon Survival Island" unless that save already
|
|
exists; --replace-world overwrites it.
|
|
|
|
Usage: tools/prism_instance.py [--name NAME] [--prism-dir DIR] [--memory MB] [--replace-world]
|
|
"""
|
|
import argparse
|
|
import json
|
|
import shutil
|
|
import sys
|
|
import tomllib
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
from packwiz_sync import sync # noqa: E402
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
PRISM_DIRS = (Path.home() / ".var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher",
|
|
Path.home() / ".local/share/PrismLauncher")
|
|
|
|
|
|
def write_cfg(path, name, memory):
|
|
settings = {}
|
|
if path.exists():
|
|
for line in path.read_text().splitlines():
|
|
if "=" in line:
|
|
key, value = line.split("=", 1)
|
|
settings[key] = value
|
|
settings.update({
|
|
"InstanceType": "OneSix",
|
|
"name": name,
|
|
"iconKey": settings.get("iconKey", "default"),
|
|
"notes": "Dev instance of the Cobblemon Survival Pack, synced by tools/prism_instance.py",
|
|
"OverrideMemory": "true",
|
|
"MinMemAlloc": "1024",
|
|
"MaxMemAlloc": str(memory),
|
|
"AutomaticJava": "true",
|
|
})
|
|
body = "[General]\n" + "".join(f"{k}={v}\n" for k, v in sorted(settings.items()) if k != "[General]")
|
|
path.write_text(body)
|
|
|
|
|
|
def write_components(path, versions):
|
|
path.write_text(json.dumps({
|
|
"components": [
|
|
{"uid": "net.minecraft", "version": versions["minecraft"], "important": True},
|
|
{"uid": "net.neoforged", "version": versions["neoforge"]},
|
|
],
|
|
"formatVersion": 1,
|
|
}, indent=4) + "\n")
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
parser.add_argument("--name", default="Cobblemon Survival Pack (dev)")
|
|
parser.add_argument("--prism-dir", type=Path, help="Prism data folder (auto-detected)")
|
|
parser.add_argument("--memory", type=int, default=6144, help="max heap in MB")
|
|
parser.add_argument("--replace-world", action="store_true", help="overwrite the island save in the instance")
|
|
args = parser.parse_args()
|
|
|
|
prism = args.prism_dir or next((d for d in PRISM_DIRS if (d / "instances").is_dir()), None)
|
|
if not prism:
|
|
sys.exit("Prism Launcher data folder not found; pass --prism-dir")
|
|
stage = ROOT / "build/stage/full"
|
|
if not (stage / "pack.toml").exists():
|
|
sys.exit("build/stage/full is missing; run tools/build.py first")
|
|
|
|
instance = prism / "instances" / args.name
|
|
game = instance / "minecraft"
|
|
game.mkdir(parents=True, exist_ok=True)
|
|
pack = tomllib.loads((stage / "pack.toml").read_text())
|
|
write_cfg(instance / "instance.cfg", args.name, args.memory)
|
|
write_components(instance / "mmc-pack.json", pack["versions"])
|
|
sync("client", game, stage)
|
|
|
|
template, save = ROOT / "build/world-template", game / "saves" / "Cobblemon Survival Island"
|
|
if (template / "level.dat").exists():
|
|
if save.exists() and not args.replace_world:
|
|
print(f"kept existing save {save.name} (use --replace-world to overwrite it)")
|
|
else:
|
|
shutil.rmtree(save, ignore_errors=True)
|
|
shutil.copytree(template, save)
|
|
print(f"installed world template as save {save.name}")
|
|
print(f"Prism instance ready: {instance}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|