Merge pull request #982 from ludovic111/feat/carry-pillar-processors

🤖 Agent: merged after verify and CI parity passed (modpacks-10, reviewed with local harness proof in the agent's report). Carries the mods' pillar and fluid-fix processors in ported packs.
This commit is contained in:
Ludovic Marie
2026-10-19 13:20:14 +02:00
committed by GitHub
3 changed files with 152 additions and 5 deletions
+128 -1
View File
@@ -157,6 +157,16 @@ fn carry_all(
list: Vec<Value>,
data: &ProcessorData,
carried: &mut BTreeMap<String, usize>,
) -> (Vec<Value>, bool) {
carry_at(list, data, carried, 0)
}
/// [`carry_all`] for a list `depth` pillars deep (see [`pillar`]).
fn carry_at(
list: Vec<Value>,
data: &ProcessorData,
carried: &mut BTreeMap<String, usize>,
depth: usize,
) -> (Vec<Value>, bool) {
let (expanded, mut changed) = references(list, data, carried, 0);
let mut out = Vec::with_capacity(expanded.len());
@@ -165,7 +175,10 @@ fn carry_all(
let replacement = match kind.as_str() {
"lithostitched:apply_random" => apply_random(&p, data, carried).map(|p| vec![p]),
"lithostitched:condition" => condition(&p, data, carried).map(|p| vec![p]),
_ => as_data(&kind, &p, data),
_ => match pillar_type(&kind) {
Some(to) => Some(vec![pillar(&p, to, data, carried, depth)]),
None => as_data(&kind, &p, data),
},
};
match replacement {
Some(replacement) => {
@@ -179,6 +192,63 @@ fn carry_all(
(out, changed)
}
/// The game's type for the mods' processors that place blocks past their
/// template, which keep their fields (`horizon-world`'s `pillars.rs`).
fn pillar_type(kind: &str) -> Option<&'static str> {
Some(match kind {
"repurposed_structures:pillar_processor" | "moogs_structures:pillar_processor" => {
"horizon:pillar"
}
"repurposed_structures:bottom_pillar_processor" => "horizon:bottom_pillar",
"repurposed_structures:close_off_fluid_sources_processor"
| "moogs_structures:close_off_fluid_sources_processor" => "horizon:close_off_fluid_sources",
"betterfortresses:pillar_processor" | "betterjungletemples:pillar_processor" => {
"horizon:yung_pillar"
}
"betterfortresses:stair_pillar_processor" => "horizon:stair_pillar",
_ => return None,
})
}
/// A pillar processor as the game's `to`. Its `pillar_processor_list`
/// (which runs on each block of the column; Repurposed's often names the
/// list it is in) is written in, carried; the pillars inside that copy lose
/// theirs, as a column's blocks are never the mods' triggers. Better
/// Fortresses' stair supports get the blocks its Java code names.
fn pillar(
p: &Value,
to: &str,
data: &ProcessorData,
carried: &mut BTreeMap<String, usize>,
depth: usize,
) -> Value {
if to == "horizon:stair_pillar" {
return json!({"processor_type": to,
"blocks": {"minecraft:stone_brick_stairs": "minecraft:red_nether_brick_stairs",
"minecraft:purpur_stairs": "minecraft:red_nether_bricks"},
"front": "minecraft:red_nether_brick_stairs",
"pillar": "minecraft:red_nether_bricks"});
}
let mut out = p.clone();
out["processor_type"] = to.into();
let Some(o) = out.as_object_mut() else {
return out;
};
let Some(list) = o.remove("pillar_processor_list") else {
return out;
};
let inner = match &list {
Value::String(id) if id == "minecraft:empty" => None,
_ if depth > 0 => None,
other => referenced(other, data),
};
if let Some(inner) = inner {
let (inner, _) = carry_at(inner, data, carried, depth + 1);
o.insert("pillar_processor_list".into(), json!({"processors": inner}));
}
out
}
/// A processor list inside a carried processor: an id stays (the game reads
/// that file, carried on its own); an inline one is carried here.
fn nested(list: &Value, data: &ProcessorData, carried: &mut BTreeMap<String, usize>) -> Value {
@@ -1306,4 +1376,61 @@ mod tests {
&mut carried
));
}
#[test]
fn pillars_become_the_games() {
let mut d = ProcessorData::default();
// Repurposed's city list names itself as its pillar's list.
let city = json!({"processors": [
{"processor_type": "repurposed_structures:pillar_processor", "direction": "down",
"pillar_length": 15, "pillar_processor_list": "repurposed_structures:cities/x",
"pillar_trigger_and_replacements": [{"trigger": {"Name": "minecraft:red_stained_glass"},
"replacement": {"Name": "minecraft:cobblestone"}}]},
{"processor_type": "minecraft:block_rot", "integrity": 0.5}]});
d.lists
.insert("repurposed_structures:cities/x".into(), city.clone());
let mut list = city;
list["processors"].as_array_mut().unwrap().extend([
json!({"processor_type": "repurposed_structures:bottom_pillar_processor",
"pillar_processor_list": "minecraft:empty"}),
json!({"processor_type": "moogs_structures:close_off_fluid_sources_processor",
"weighted_list_of_replacement_blocks": [{"block": "minecraft:stone", "weight": 1}]}),
json!({"processor_type": "betterfortresses:pillar_processor",
"target_block": {"Name": "minecraft:orange_terracotta"},
"target_block_output": {"defaultBlockState": {"Name": "minecraft:red_nether_bricks"}, "entries": []},
"pillar_states": {"defaultBlockState": {"Name": "minecraft:nether_bricks"}, "entries": []}}),
json!({"processor_type": "betterfortresses:stair_pillar_processor"}),
]);
let mut carried = BTreeMap::new();
assert!(carry("processor_list", &mut list, &d, &mut carried));
let p = list["processors"].as_array().unwrap();
let types: Vec<&str> = p
.iter()
.map(|p| p["processor_type"].as_str().unwrap())
.collect();
assert_eq!(
types,
[
"horizon:pillar",
"minecraft:block_rot",
"horizon:bottom_pillar",
"horizon:close_off_fluid_sources",
"horizon:yung_pillar",
"horizon:stair_pillar"
]
);
// The named list is written in once; its own pillar loses its list.
let inner = &p[0]["pillar_processor_list"]["processors"];
assert_eq!(inner[0]["processor_type"], "horizon:pillar");
assert!(inner[0].get("pillar_processor_list").is_none());
assert_eq!(
inner[0]["pillar_trigger_and_replacements"],
p[0]["pillar_trigger_and_replacements"]
);
assert_eq!(inner[1]["processor_type"], "minecraft:block_rot");
assert!(p[2].get("pillar_processor_list").is_none());
assert_eq!(p[5]["pillar"], "minecraft:red_nether_bricks");
assert_eq!(carried["repurposed_structures:pillar_processor"], 2);
assert_eq!(carried["betterfortresses:stair_pillar_processor"], 1);
}
}
+3
View File
@@ -401,6 +401,9 @@ fn drop_java_processors(list: &mut Value, dropped: &mut BTreeMap<String, usize>)
.map(|(_, v)| v)
.collect()
}
Some("horizon:pillar" | "horizon:bottom_pillar") => {
p.get_mut("pillar_processor_list").into_iter().collect()
}
_ => Vec::new(),
};
for list in inner {
+21 -4
View File
@@ -472,8 +472,26 @@ Two cases the oracle fills in:
1234 the farms now grow carrots, potatoes and beetroot besides wheat, and 1,655
cobblestone blocks become paths, grass, mossy cobblestone and planks. No Lithostitched processor is
dropped now (130 before), only CTOV's compat hooks for other mods inside them (142 copies).
Still taken out: Formations' biome replacements, Repurposed's pillars and fluid fixes,
blocks aged or propped up.
The processors that build outside their template are carried too: Repurposed's and
Moog's pillar processors become the game's `horizon:pillar` (a column from a placeholder
block down to the ground, with the processor list they run on each of its blocks written
in), Repurposed's bottom pillars `horizon:bottom_pillar`, their fluid fix (a wall of the
structure's block over water and lava sources next to its open blocks)
`horizon:close_off_fluid_sources`, and YUNG's pillars (Better Fortresses, Better Jungle
Temples) and Better Fortresses' stair supports `horizon:yung_pillar` and
`horizon:stair_pillar`. They write only in the chunk being generated, as the mods do.
Dropped processors went from 570 to 456 in Repurposed Structures (its pillars, bottom
pillars and fluid fixes: 242 lists), 14 to 1 in Moog's, 10 to 5 in Better Fortresses and
52 to 50 in Better Jungle Temples; the structure starts are the same (382 starts, 37,451
pieces in chunks -64..63, seed 1234). Around spawn at seed 1234, 1,515 blocks change: the
382 red glass placeholders under Repurposed's ocean outpost and pyramids become prismarine
columns, and their gravel and prismarine pillars reach the sea floor. In the Nether, the
Better Fortresses fortress at chunk (-23, 9) stands on its pillars: its terracotta
placeholders become nether bricks and 41,487 blocks of air (and 2,163 of lava) under it
become brick and magma columns down to the netherrack, 64,568 blocks changed in its 180
chunks (the huge fungi there grow around the columns).
Still taken out: Formations' biome replacements, Repurposed's air fix
(`close_off_air_sources`), blocks aged or propped up.
In the 128×128-chunk square (seed 1234), every spawner of a mod structure now has its mob:
in the Overworld 83 Better Dungeons spawners held the template's placeholder pig and 17 of
Moog's were empty (763 spawners with a mob, up from 628); in the Nether the 52 empty ones
@@ -553,8 +571,7 @@ Two cases the oracle fills in:
- Repurposed's mineshafts, mansions and monuments, Better Mineshafts and two Better
Dungeons types: Java structure types;
- the block processors written in Java
(YUNG's banners, legs and decorations, Repurposed's pillars and fluid fixes,
Lithostitched's block swaps);
(YUNG's banners, legs and decorations, Lithostitched's block swaps);
- MO Structures (38; its library is only on CurseForge).
With every structure PR above, the same square (seed 1234, chunks -64..63) holds 362