Skip to content

Commit 3670a1a

Browse files
committed
Warn about non-conforming optifine identifiers.
1 parent 0b0bad1 commit 3670a1a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/io/github/kvverti/colormatic/resource/CustomBiomeColormapsResource.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
package io.github.kvverti.colormatic.resource;
2323

2424
import java.util.Collection;
25+
import java.util.regex.Pattern;
2526

2627
import io.github.kvverti.colormatic.colormap.BiomeColormap;
2728
import io.github.kvverti.colormatic.colormap.BiomeColormaps;
@@ -42,7 +43,8 @@
4243
*/
4344
public class CustomBiomeColormapsResource implements SimpleSynchronousResourceReloadListener {
4445

45-
private static final Logger log = LogManager.getLogger();
46+
private static final Logger log = LogManager.getLogger("Colormatic");
47+
private static final Pattern ID_PATTERN = Pattern.compile("[a-z0-9_/.-]+");
4648

4749
private final Identifier id;
4850
private final Identifier optifineId;
@@ -82,12 +84,15 @@ private static void addColormaps(ResourceManager manager, Identifier dir, boolea
8284
.distinct()
8385
.collect(toList());
8486
for(Identifier id : files) {
87+
if(!ID_PATTERN.matcher(id.getPath()).matches()) {
88+
log.error("Non-ASCII colormap definition file {}. Please contact resource pack author to fix.", id);
89+
}
8590
try {
8691
PropertyImage pi = PropertyUtil.loadColormap(manager, id, true);
8792
BiomeColormap colormap = new BiomeColormap(pi.properties(), pi.image());
8893
BiomeColormaps.add(colormap);
8994
} catch(InvalidColormapException e) {
90-
log.warn("Error parsing {}: {}", id, e.getMessage());
95+
log.error("Error parsing {}: {}", id, e.getMessage());
9196
}
9297
}
9398
}

0 commit comments

Comments
 (0)