diff --git a/crates/horizon-port-pack/src/worldgen.rs b/crates/horizon-port-pack/src/worldgen.rs index 51d1a0ce5..7de9f39ce 100644 --- a/crates/horizon-port-pack/src/worldgen.rs +++ b/crates/horizon-port-pack/src/worldgen.rs @@ -32,6 +32,16 @@ const NETHER_JIGSAWS: [&str; 2] = [ "moogs_structures:moogs_structures_generic_nether_jigsaw_structure", "repurposed_structures:generic_nether_jigsaw_structure", ]; +/// Repurposed Structures' generic jigsaws with a start check of their own: the +/// `repurposed` key of `horizon:start_checks` names it. +const REPURPOSED_CHECKED: [(&str, &str); 3] = [ + ("repurposed_structures:city_nether_structure", "city_nether"), + ( + "repurposed_structures:shipwreck_nether_structure", + "shipwreck_nether", + ), + ("repurposed_structures:stronghold_end", "stronghold_end"), +]; /// Layout rules the piece-limited assembler keeps (`horizon:piece_limited`). const PIECE_LIMITED_RULES: [&str; 4] = [ "y_allowance", @@ -408,7 +418,13 @@ fn upgrade_types( yung_structure(v, lost); true } - Some(t) if JIGSAWS.contains(&t) || NETHER_JIGSAWS.contains(&t) => { + Some(t) + if JIGSAWS.contains(&t) + || NETHER_JIGSAWS.contains(&t) + || REPURPOSED_CHECKED.iter().any(|(r, _)| *r == t) => + { + let check = REPURPOSED_CHECKED.iter().find(|(r, _)| *r == t); + let check = check.map(|(_, c)| *c); let library = match t.split_once(':').map(|(ns, _)| ns) { Some("moogs_structures") => Some("moogs"), Some("repurposed_structures") => Some("repurposed"), @@ -421,6 +437,12 @@ fn upgrade_types( }; let limited = library.map(|l| piece_limited(v, l)); start_checks(v, liquid, lost, limited.is_some()); + if let Some(check) = check { + if !v["horizon:start_checks"].is_object() { + v["horizon:start_checks"] = Value::Object(Default::default()); + } + v["horizon:start_checks"]["repurposed"] = check.into(); + } if let Some(limited) = limited { v["horizon:piece_limited"] = limited; } @@ -1084,6 +1106,20 @@ mod tests { "cannot_spawn_in_liquid": true}); assert!(upgrade("structure", &mut rs, &mut report, &NO_TAGS)); assert_eq!(rs["horizon:start_checks"], json!({"liquid": "lowest"})); + // Repurposed's own checks: the Nether city, Nether shipwrecks, the End stronghold. + for (t, check) in [ + ("city_nether_structure", "city_nether"), + ("shipwreck_nether_structure", "shipwreck_nether"), + ("stronghold_end", "stronghold_end"), + ] { + let mut rs = json!({"type": format!("repurposed_structures:{t}"), + "cannot_spawn_in_liquid": false, "size": 7}); + assert!(upgrade("structure", &mut rs, &mut report, &NO_TAGS)); + assert_eq!(rs["type"], "minecraft:jigsaw"); + assert_eq!(rs["horizon:start_checks"], json!({"repurposed": check})); + assert_eq!(rs["horizon:piece_limited"]["library"], "repurposed"); + } + assert!(report.unsupported.is_empty()); // Nothing to check: no key. let mut plain = json!({"type": "lithostitched:jigsaw", "cannot_spawn_in_liquid": false}); assert!(upgrade("structure", &mut plain, &mut report, &NO_TAGS)); diff --git a/docs/modpacks.md b/docs/modpacks.md index cbb63a30f..12e522e24 100644 --- a/docs/modpacks.md +++ b/docs/modpacks.md @@ -500,8 +500,8 @@ Two cases the oracle fills in: - Still lost, written in Java: - Formations' structure and element types (179): their placements read block states in the noise column (solid, water, lava), which the structure context doesn't give yet; - - Repurposed's mineshafts, mansions, monuments, Nether cities and shipwrecks, Better - Mineshafts and two Better Dungeons types: Java structure types; + - Repurposed's mineshafts, mansions and monuments, Better Mineshafts and two Better + Dungeons types: Java structure types; - YUNG's and Moog's enhanced terrain adaptation, YUNG's piece modifiers and dead-end pools, and the block processors written in Java (YUNG's banners, legs and decorations, Repurposed's pillars and fluid fixes, Lithostitched's block swaps); @@ -515,6 +515,14 @@ Two cases the oracle fills in: (vanilla 0), Better Jungle Temples 5, Better Witch Huts 11. Vanilla's own worlds are unchanged: the structure-start oracle still matches 35 of 35. + Repurposed's Nether city, Nether shipwrecks and End stronghold are its generic jigsaw with + one more start check each, carried as `minecraft:jigsaw` with the check named in + `horizon:start_checks.repurposed`: open air from sea level + 20 to + 45 around the city's + chunk, no solid block in a 33×30×33 grid over a shipwreck, and land 45 blocks up at nine + points 35 and 70 blocks apart for the stronghold. Over chunks -320..319 in the Nether there + are 2 cities and 45 shipwrecks (30 and 865 without the checks); the End stronghold keeps + 8,000 blocks from the centre, and chunks 500..1139 × -320..319 hold 2 (43 without). + In a world with the 40 mods, seed 1234, `/locate structure mvs:azelea_house` finds one 27 blocks from spawn and it stands there as the template builds it; When Dungeons Arise's bandit towers and Structory's chapel locate too.