Suppress UncheckedIOException thrown by loading alex and steve skin image.

This commit is contained in:
huanghongxun 2019-04-25 11:28:49 +08:00
parent 20c612c660
commit 6ac32a40c7

View File

@ -137,8 +137,12 @@ public final class TexturesLoader {
// ==== Skins ====
private final static Map<TextureModel, LoadedTexture> DEFAULT_SKINS = new EnumMap<>(TextureModel.class);
static {
loadDefaultSkin("/assets/img/steve.png", TextureModel.STEVE);
loadDefaultSkin("/assets/img/alex.png", TextureModel.ALEX);
try {
loadDefaultSkin("/assets/img/steve.png", TextureModel.STEVE);
loadDefaultSkin("/assets/img/alex.png", TextureModel.ALEX);
} catch (UncheckedIOException e) {
throw new NoClassDefFoundError("Steve and alex default skin image is not found");
}
}
private static void loadDefaultSkin(String path, TextureModel model) {
try (InputStream in = TexturesLoader.class.getResourceAsStream(path)) {