diff --git a/client/source/graphics/TextureAtlas.cpp b/client/source/graphics/TextureAtlas.cpp index d0f5f6bd1..cc3ca3b8a 100644 --- a/client/source/graphics/TextureAtlas.cpp +++ b/client/source/graphics/TextureAtlas.cpp @@ -37,8 +37,10 @@ void TextureAtlas::addFile(const std::string &path, const std::string &filename) return; SurfacePtr surface{IMG_Load((path + filename).c_str()), &SDL_FreeSurface}; - if(!surface) - throw EXCEPTION("Failed to load texture:", path + filename); + if(!surface) { + DEBUG("WARNING: Failed to load texture:", path + filename); + return; + } if (!m_tileSize) m_tileSize = surface->w; @@ -104,6 +106,8 @@ void TextureAtlas::packTextures() { } void TextureAtlas::loadFromRegistry() { + addFile("mods/default/textures/blocks/", "undefined.png"); + for (auto &block : Registry::getInstance().blocks()) { const TilesDef &tiles = block->tiles(); for (auto &textureFilename : tiles.textureFilenames()) @@ -128,7 +132,7 @@ void TextureAtlas::loadFromRegistry() { u16 TextureAtlas::getTextureID(const std::string &filename) const { auto it = m_textureMap.find(filename); if (it == m_textureMap.end()) { - throw EXCEPTION("Unable to find texture in atlas:", filename); + return 0; } return it->second; diff --git a/mods/default/textures/blocks/undefined.png b/mods/default/textures/blocks/undefined.png new file mode 100644 index 000000000..d8561e90e Binary files /dev/null and b/mods/default/textures/blocks/undefined.png differ diff --git a/mods/default/textures_mc/blocks/undefined.png b/mods/default/textures_mc/blocks/undefined.png new file mode 100644 index 000000000..1f3fabd3d Binary files /dev/null and b/mods/default/textures_mc/blocks/undefined.png differ