From 3f46080f4235043cf5febd6fff1a2fbbd5b12886 Mon Sep 17 00:00:00 2001 From: GlFolker <63218676+GlennFolker@users.noreply.github.com> Date: Thu, 14 Mar 2024 23:12:28 +0700 Subject: [PATCH] Allow categorized sprite names to not be prefixed. (#9616) * Delegate more methods into Planet * Allow categorized sprite prefixes --- core/src/mindustry/mod/Mods.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 1eed765d19..391636571e 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -218,7 +218,10 @@ public class Mods implements Loadable{ } //this returns a *runnable* which actually packs the resulting pixmap; this has to be done synchronously outside the method return () -> { - String fullName = (prefix ? mod.name + "-" : "") + baseName; + //don't prefix with mod name if it's already prefixed by a category, e.g. `block-modname-content-full`. + int hyphen = baseName.indexOf('-'); + String fullName = ((prefix && !(hyphen != -1 && baseName.substring(hyphen + 1).startsWith(mod.name + "-"))) ? mod.name + "-" : "") + baseName; + packer.add(getPage(file), fullName, new PixmapRegion(pix)); if(textureScale != 1.0f){ textureResize.put(fullName, textureScale);