diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/FileTexturePack.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/FileTexturePack.cpp')
| -rw-r--r-- | Minecraft.Client/FileTexturePack.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/Minecraft.Client/FileTexturePack.cpp b/Minecraft.Client/FileTexturePack.cpp new file mode 100644 index 00000000..af58dc1e --- /dev/null +++ b/Minecraft.Client/FileTexturePack.cpp @@ -0,0 +1,86 @@ +#include "stdafx.h" +#include "FileTexturePack.h" + +FileTexturePack::FileTexturePack(DWORD id, File *file, TexturePack *fallback) : AbstractTexturePack(id, file, file->getName(), fallback) +{ + // 4J Stu - These calls need to be in the most derived version of the class + loadIcon(); + loadName(); + loadDescription(); +} + +void FileTexturePack::unload(Textures *textures) +{ +#if 0 + super.unload(textures); + + try { + if (zipFile != null) zipFile.close(); + } + catch (IOException ignored) + { + } + zipFile = null; +#endif +} + +InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //throws IOException +{ +#if 0 + loadZipFile(); + + ZipEntry entry = zipFile.getEntry(name.substring(1)); + if (entry == null) { + throw new FileNotFoundException(name); + } + + return zipFile.getInputStream(entry); +#endif + return NULL; +} + +bool FileTexturePack::hasFile(const wstring &name) +{ +#if 0 + try { + loadZipFile(); + + return zipFile.getEntry(name.substring(1)) != null; + } catch (Exception e) { + return false; + } +#endif + return false; +} + +void FileTexturePack::loadZipFile() //throws IOException +{ +#if 0 + if (zipFile != null) { + return; + } + + zipFile = new ZipFile(file); +#endif +} + +bool FileTexturePack::isTerrainUpdateCompatible() +{ +#if 0 + try { + loadZipFile(); + + Enumeration<? extends ZipEntry> entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + if (entry.getName().startsWith("textures/")) { + return true; + } + } + } catch (Exception ignored) { + } + boolean hasOldFiles = hasFile("terrain.png") || hasFile("gui/items.png"); + return !hasOldFiles; +#endif + return false; +}
\ No newline at end of file |
