the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 86 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "FileTexturePack.h" 3 4FileTexturePack::FileTexturePack(DWORD id, File *file, TexturePack *fallback) : AbstractTexturePack(id, file, file->getName(), fallback) 5{ 6 // 4J Stu - These calls need to be in the most derived version of the class 7 loadIcon(); 8 loadName(); 9 loadDescription(); 10} 11 12void FileTexturePack::unload(Textures *textures) 13{ 14#if 0 15 super.unload(textures); 16 17 try { 18 if (zipFile != null) zipFile.close(); 19 } 20 catch (IOException ignored) 21 { 22 } 23 zipFile = null; 24#endif 25} 26 27InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //throws IOException 28{ 29#if 0 30 loadZipFile(); 31 32 ZipEntry entry = zipFile.getEntry(name.substring(1)); 33 if (entry == null) { 34 throw new FileNotFoundException(name); 35 } 36 37 return zipFile.getInputStream(entry); 38#endif 39 return NULL; 40} 41 42bool FileTexturePack::hasFile(const wstring &name) 43{ 44#if 0 45 try { 46 loadZipFile(); 47 48 return zipFile.getEntry(name.substring(1)) != null; 49 } catch (Exception e) { 50 return false; 51 } 52#endif 53 return false; 54} 55 56void FileTexturePack::loadZipFile() //throws IOException 57{ 58#if 0 59 if (zipFile != null) { 60 return; 61 } 62 63 zipFile = new ZipFile(file); 64#endif 65} 66 67bool FileTexturePack::isTerrainUpdateCompatible() 68{ 69#if 0 70 try { 71 loadZipFile(); 72 73 Enumeration<? extends ZipEntry> entries = zipFile.entries(); 74 while (entries.hasMoreElements()) { 75 ZipEntry entry = entries.nextElement(); 76 if (entry.getName().startsWith("textures/")) { 77 return true; 78 } 79 } 80 } catch (Exception ignored) { 81 } 82 boolean hasOldFiles = hasFile("terrain.png") || hasFile("gui/items.png"); 83 return !hasOldFiles; 84#endif 85 return false; 86}