Skip to content

Commit

Permalink
Add a warning when trying to add multiple textures with the same name…
Browse files Browse the repository at this point in the history
… so this doesn't happen again.
  • Loading branch information
leMaik committed Aug 25, 2024
1 parent 8d7592f commit 03430e2
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import se.llbit.chunky.renderer.scene.PlayerModel;
import se.llbit.chunky.renderer.scene.sky.Sun;
import se.llbit.chunky.resources.texturepack.*;
import se.llbit.log.Log;

import java.lang.reflect.Field;
import java.util.*;
Expand Down Expand Up @@ -3663,6 +3664,10 @@ private static void addSimpleTexture(String file, Texture texture) {
}

private static void addSimpleTexture(String name, String file, Texture texture) {
if (ALL_TEXTURES.containsKey(name)) {
Log.warnf("Duplicate texture %s (path %s). This is probably a bug, please report it at https://github.com/chunky-dev/chunky/issues", name, file);
addSimpleTexture(name + "_duplicate", file, texture);
}
ALL_TEXTURES.put(name, new SimpleTexture(file, texture));
}
}

0 comments on commit 03430e2

Please sign in to comment.