cac89a9995
The creative-tabs.json export failed to build the functional blocks tab (no data-pack registries: banner patterns), and its fallback read decompiled sources from a path that no longer exists, so the tab was empty and anvils, crafting and smithing tables were missing from the tabs and the search. The search also matched only an approximate display name. VanillaCreativeTabsExporter now builds every tab with vanilla's own CreativeModeTabs.tryRebuildTabContents over the vanilla data pack's registries and writes creative-inventory.json: stacks with components, and the search tab's creative tooltip lines and tags. The client searches them as SessionSearchTrees does (FullTextSearchTree, IdSearchTree after '#'). Changing tab empties the search box, as in selectTab. The scrollbar only jumped to the pressed point; holding it now scrolls as the mouse moves, anywhere, until release (mouseClicked/mouseDragged), and the wheel and the scroller follow ItemPickerMenu. tools/test_creative_parity.py compares every tab and 6,793 searches with the vanilla client's own search trees. horizon-ctl `type` also fills the creative search box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.0 KiB
Rust
54 lines
2.0 KiB
Rust
//! The creative inventory, for tools/test_creative_parity.py: loads an
|
|
//! exported `creative-inventory.json` into `horizon_client::creative::Creative`
|
|
//! and prints the tabs it shows (canonical stacks) and the search tab's
|
|
//! results for every query of the vanilla oracle's output.
|
|
//!
|
|
//! usage: creative_search_fixture RESOURCES CREATIVE_JSON VANILLA_JSON OUTPUT
|
|
use horizon_client::{
|
|
creative::{Creative, Names},
|
|
item_data::canon_stack,
|
|
};
|
|
use serde_json::{Value, json};
|
|
use std::{fs, path::Path};
|
|
|
|
fn main() -> horizon_client::Result<()> {
|
|
let args: Vec<String> = std::env::args().collect();
|
|
let usage = "usage: creative_search_fixture RESOURCES CREATIVE_JSON VANILLA_JSON OUTPUT";
|
|
let names = Names::load(Path::new(args.get(1).ok_or(usage)?));
|
|
let creative = Creative::from_json(&serde_json::from_slice(&fs::read(
|
|
args.get(2).ok_or(usage)?,
|
|
)?)?)?;
|
|
let vanilla: Value = serde_json::from_slice(&fs::read(args.get(3).ok_or(usage)?)?)?;
|
|
let tabs: Vec<Value> = creative
|
|
.tabs
|
|
.iter()
|
|
.map(|t| {
|
|
json!({
|
|
"id": t.id,
|
|
"title": t.title,
|
|
"icon": t.icon,
|
|
"row": if t.top { "TOP" } else { "BOTTOM" },
|
|
"column": t.column,
|
|
"items": t.items.iter().map(|s| canon_stack(Some(s))).collect::<Vec<_>>(),
|
|
})
|
|
})
|
|
.collect();
|
|
let searches: Vec<Value> = vanilla["searches"]
|
|
.as_array()
|
|
.ok_or("searches")?
|
|
.iter()
|
|
.map(|s| {
|
|
let query = s["query"].as_str().unwrap_or_default();
|
|
json!({"query": query, "results": creative.search_results(query, &names)})
|
|
})
|
|
.collect();
|
|
let search: Vec<String> = creative
|
|
.search_items()
|
|
.iter()
|
|
.map(|s| canon_stack(Some(s)))
|
|
.collect();
|
|
let out = json!({"tabs": tabs, "search": search, "searches": searches});
|
|
fs::write(args.get(4).ok_or(usage)?, out.to_string())?;
|
|
Ok(())
|
|
}
|