Skip to content

Commit a89c73c

Browse files
committed
Add error handling for texture id typos in resource packs.
1 parent d4ec781 commit a89c73c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

chunky/src/java/se/llbit/chunky/block/jsonmodels/ResourcepackBlockProvider.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,12 @@ private static class JsonModelFace {
508508
private int tintindex;
509509

510510
public JsonModelFace(String direction, JsonObject face, Vector3 from, Vector3 to) {
511-
if (face.get("texture").stringValue("").length() < 2) {
511+
String texture = face.get("texture").stringValue("");
512+
if (!texture.startsWith("#")) {
513+
// sometimes the '#' is missing in resourcepacks
514+
texture = "#" + texture;
515+
}
516+
if (texture.length() < 2) {
512517
throw new RuntimeException(face.toCompactString());
513518
}
514519
this.texture = face.get("texture").stringValue("").substring(1);

0 commit comments

Comments
 (0)