From ea59e391598a1c874f291acac5b948b1806f6f82 Mon Sep 17 00:00:00 2001 From: objz Date: Mon, 20 Apr 2026 19:25:05 +0200 Subject: [PATCH] added fallback icons for resource packs and worlds resource packs and worlds without icons now show a placeholder "?" pattern like mods already do. worlds use a larger 12x6 variant. --- src/instance/content/mods.rs | 40 ++++++++++++++++++++++++-- src/instance/content/resource_packs.rs | 3 +- src/instance/content/worlds.rs | 3 +- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/instance/content/mods.rs b/src/instance/content/mods.rs index a1a1f8c..bfea1b8 100644 --- a/src/instance/content/mods.rs +++ b/src/instance/content/mods.rs @@ -226,8 +226,8 @@ pub(crate) fn make_icon_pixels( Some(rows) } -/// 6x3 fallback icon showing a "?" pattern for mods without icons. -fn fallback_icon() -> Vec> { +// 6x3 fallback icon showing a "?" pattern for mods without icons. +pub(super) fn fallback_icon() -> Vec> { let b = IconCell { bg_r: 50, bg_g: 50, @@ -259,6 +259,42 @@ fn fallback_icon() -> Vec> { ] } +// 12x6 fallback icon showing a "?" pattern for worlds without icons. +pub(super) fn fallback_icon_large() -> Vec> { + let b = IconCell { + bg_r: 50, + bg_g: 50, + bg_b: 50, + fg_r: 50, + fg_g: 50, + fg_b: 50, + }; + let tb = IconCell { + bg_r: 50, + bg_g: 50, + bg_b: 50, + fg_r: 130, + fg_g: 130, + fg_b: 130, + }; + let bt = IconCell { + bg_r: 130, + bg_g: 130, + bg_b: 130, + fg_r: 50, + fg_g: 50, + fg_b: 50, + }; + vec![ + vec![b, b, tb, tb, tb, tb, tb, tb, tb, tb, b, b], + vec![b, b, tb, tb, tb, tb, tb, tb, tb, tb, b, b], + vec![b, b, b, b, b, b, bt, bt, bt, bt, b, b], + vec![b, b, b, b, b, b, bt, bt, bt, bt, b, b], + vec![b, b, b, b, bt, bt, bt, bt, b, b, b, b], + vec![b, b, b, b, bt, bt, bt, bt, b, b, b, b], + ] +} + // enable/disable by renaming the file with/without ".disabled" suffix. // the minecraft way, apparently. pub fn toggle_entry(entry: &ContentEntry) -> Result<(), std::io::Error> { diff --git a/src/instance/content/resource_packs.rs b/src/instance/content/resource_packs.rs index 0fb17bf..22be392 100644 --- a/src/instance/content/resource_packs.rs +++ b/src/instance/content/resource_packs.rs @@ -80,7 +80,8 @@ pub fn scan_resource_packs(instances_dir: &Path, instance_name: &str) -> Vec Vec