fix(content): compact datapack world picker
This commit is contained in:
1 parent
7986bab3a7
commit
94b71fdc4e
2 files changed
+16
-1
No files matched your search
@@ -231,6 +231,14 @@ fn datapack_versions_select_a_world_before_dependency_resolution() {
|
||||
|
||||
let world = crate::instance::scan_one_world(&world_path, "world-folder", true);
|
||||
assert!(state.begin_world_selection(vec![world]));
|
||||
assert_eq!(
|
||||
state.version_popup.as_ref().unwrap().worlds.entries[0]
|
||||
.icon_lines
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.len(),
|
||||
3
|
||||
);
|
||||
let mut manifest = crate::instance::ContentManifest::default();
|
||||
manifest.upsert(crate::instance::ContentFileRecord {
|
||||
relative_path: PathBuf::from("saves/world-folder/datapacks/project.zip"),
|
||||
|
||||
@@ -677,7 +677,7 @@ impl DiscoveryState {
|
||||
true
|
||||
}
|
||||
|
||||
pub fn begin_world_selection(&mut self, worlds: Vec<ContentEntry>) -> bool {
|
||||
pub fn begin_world_selection(&mut self, mut worlds: Vec<ContentEntry>) -> bool {
|
||||
let Some(popup) = self.version_popup.as_mut() else {
|
||||
return false;
|
||||
};
|
||||
@@ -689,6 +689,13 @@ impl DiscoveryState {
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for world in &mut worlds {
|
||||
world.icon_lines = world
|
||||
.icon_bytes
|
||||
.as_ref()
|
||||
.and_then(|bytes| crate::instance::content::make_icon_pixels(bytes, 6, 3))
|
||||
.or_else(|| Some(crate::instance::content::fallback_icon()));
|
||||
}
|
||||
popup.worlds = ContentListState::default();
|
||||
popup.worlds.entries = worlds;
|
||||
popup
|
||||
|
||||
Reference in new issue
Block a user