mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-30 07:32:55 +00:00
Add pack texture size check method
This commit is contained in:
parent
4b2b9094d2
commit
025e93b582
|
|
@ -327,6 +327,21 @@ void AbstractTexturePack::loadName()
|
|||
{
|
||||
}
|
||||
|
||||
void AbstractTexturePack::checkTexSize() {
|
||||
BufferedImage* img = getImageResource(L"dirt.png", true);
|
||||
if (img != NULL) {
|
||||
int width = img->getWidth();
|
||||
int height = img->getHeight();
|
||||
if (width != height) {
|
||||
app.DebugPrintf("Warning: Texture pack contains texture with bad size: %d x %d\n", width, height);
|
||||
} else
|
||||
texSize = width;
|
||||
delete img;
|
||||
} else {
|
||||
texSize = 16;
|
||||
}
|
||||
}
|
||||
|
||||
InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFallback) //throws IOException
|
||||
{
|
||||
app.DebugPrintf("texture - %ls\n",name.c_str());
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public:
|
|||
private:
|
||||
const DWORD id;
|
||||
const wstring name;
|
||||
int texSize;
|
||||
|
||||
protected:
|
||||
File *file;
|
||||
|
|
@ -50,6 +51,7 @@ protected:
|
|||
virtual void loadComparison();
|
||||
virtual void loadDescription();
|
||||
virtual void loadName();
|
||||
void checkTexSize();
|
||||
|
||||
public:
|
||||
virtual InputStream *getResource(const wstring &name, bool allowFallback); //throws IOException
|
||||
|
|
|
|||
Loading…
Reference in a new issue