From 7ba58e6a5b170f7c4109f473c2872e07e8fcb964 Mon Sep 17 00:00:00 2001 From: bmathews Date: Sat, 15 Nov 2025 01:29:56 -0800 Subject: [PATCH] Fix meshes with number suffixes --- src/manifest.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/manifest.ts b/src/manifest.ts index a70fbbb7..d3e7a631 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -15,12 +15,30 @@ export function getActualResourcePath(resourcePath: string) { } const resourcePaths = getResourceList(); const lowerCased = resourcePath.toLowerCase(); + + // First, try exact case-insensitive match const foundLowerCase = resourcePaths.find( (s) => s.toLowerCase() === lowerCased ); if (foundLowerCase) { return foundLowerCase; } + + // For paths with numeric suffixes (e.g., "generator0.png"), strip the number and try again + // e.g., "generator0.png" -> "generator.png" + const pathWithoutNumber = resourcePath.replace(/\d+(\.(png))$/i, "$1"); + const lowerCasedWithoutNumber = pathWithoutNumber.toLowerCase(); + + if (pathWithoutNumber !== resourcePath) { + // If we stripped a number, try to find the version without it + const foundWithoutNumber = resourcePaths.find( + (s) => s.toLowerCase() === lowerCasedWithoutNumber + ); + if (foundWithoutNumber) { + return foundWithoutNumber; + } + } + const isTexture = resourcePath.startsWith("textures/"); if (isTexture) { const foundNested = resourcePaths.find(