public static TextureAnimation[] getTextureAnimations(IResourcePack[] p_getTextureAnimations_0_) { List list = new ArrayList(); for (int i = 0; i < p_getTextureAnimations_0_.length; ++i) { IResourcePack iresourcepack = p_getTextureAnimations_0_[i]; TextureAnimation[] atextureanimation = getTextureAnimations(iresourcepack); if (atextureanimation != null) { list.addAll(Arrays.asList(atextureanimation)); } } TextureAnimation[] atextureanimation1 = (TextureAnimation[])((TextureAnimation[])list.toArray(new TextureAnimation[list.size()])); return atextureanimation1; }
private static Map makePotionImageProperties(IResourcePack p_makePotionImageProperties_0_, boolean p_makePotionImageProperties_1_) { Map map = new HashMap(); String s = p_makePotionImageProperties_1_ ? "splash/" : "normal/"; String[] astring = new String[] {"mcpatcher/cit/potion/" + s, "mcpatcher/cit/Potion/" + s}; String[] astring1 = new String[] {".png"}; String[] astring2 = ResUtils.collectFiles(p_makePotionImageProperties_0_, astring, astring1); for (int i = 0; i < astring2.length; ++i) { String s1 = astring2[i]; String name = StrUtils.removePrefixSuffix(s1, astring, astring1); Properties properties = makePotionProperties(name, p_makePotionImageProperties_1_, s1); if (properties != null) { String s3 = StrUtils.removeSuffix(s1, astring1) + ".properties"; CustomItemProperties customitemproperties = new CustomItemProperties(properties, s3); map.put(s3, customitemproperties); } } return map; }
public static String[] collectFiles(IResourcePack p_collectFiles_0_, String p_collectFiles_1_, String p_collectFiles_2_, String[] p_collectFiles_3_) { if (p_collectFiles_0_ instanceof DefaultResourcePack) { return collectFilesFixed(p_collectFiles_0_, p_collectFiles_3_); } else if (!(p_collectFiles_0_ instanceof AbstractResourcePack)) { return new String[0]; } else { AbstractResourcePack abstractresourcepack = (AbstractResourcePack)p_collectFiles_0_; File file1 = ResourceUtils.getResourcePackFile(abstractresourcepack); return file1 == null ? new String[0] : (file1.isDirectory() ? collectFilesFolder(file1, "", p_collectFiles_1_, p_collectFiles_2_) : (file1.isFile() ? collectFilesZIP(file1, p_collectFiles_1_, p_collectFiles_2_) : new String[0])); } }
private static String[] collectFilesFixed(IResourcePack p_collectFilesFixed_0_, String[] p_collectFilesFixed_1_) { if (p_collectFilesFixed_1_ == null) { return new String[0]; } else { List list = new ArrayList(); for (int i = 0; i < p_collectFilesFixed_1_.length; ++i) { String s = p_collectFilesFixed_1_[i]; ResourceLocation resourcelocation = new ResourceLocation(s); if (p_collectFilesFixed_0_.resourceExists(resourcelocation)) { list.add(s); } } String[] astring = (String[])((String[])list.toArray(new String[list.size()])); return astring; } }
public static IResourcePack[] getResourcePacks() { ResourcePackRepository resourcepackrepository = minecraft.getResourcePackRepository(); List list = resourcepackrepository.getRepositoryEntries(); List list1 = new ArrayList(); for (Object resourcepackrepository$entry : list) { list1.add(((ResourcePackRepository.Entry)resourcepackrepository$entry).getResourcePack()); } if (resourcepackrepository.getResourcePackInstance() != null) { list1.add(resourcepackrepository.getResourcePackInstance()); } IResourcePack[] airesourcepack = (IResourcePack[])((IResourcePack[])list1.toArray(new IResourcePack[list1.size()])); return airesourcepack; }
public static IResourcePack getDefiningResourcePack(ResourceLocation p_getDefiningResourcePack_0_) { IResourcePack[] airesourcepack = getResourcePacks(); for (int i = airesourcepack.length - 1; i >= 0; --i) { IResourcePack iresourcepack = airesourcepack[i]; if (iresourcepack.resourceExists(p_getDefiningResourcePack_0_)) { return iresourcepack; } } if (getDefaultResourcePack().resourceExists(p_getDefiningResourcePack_0_)) { return getDefaultResourcePack(); } else { return null; } }
public static void resourcesReloaded() { Map map = I18n.getLocaleProperties(); List<String> list = new ArrayList(); String s = "optifine/lang/"; String s1 = "en_US"; String s2 = ".lang"; list.add(s + s1 + s2); if (!Config.getGameSettings().language.equals(s1)) { list.add(s + Config.getGameSettings().language + s2); } String[] astring = (String[])((String[])list.toArray(new String[list.size()])); loadResources(Config.getDefaultResourcePack(), astring, map); IResourcePack[] airesourcepack = Config.getResourcePacks(); for (int i = 0; i < airesourcepack.length; ++i) { IResourcePack iresourcepack = airesourcepack[i]; loadResources(iresourcepack, astring, map); } }
private static void loadResources(IResourcePack p_loadResources_0_, String[] p_loadResources_1_, Map p_loadResources_2_) { try { for (int i = 0; i < p_loadResources_1_.length; ++i) { String s = p_loadResources_1_[i]; ResourceLocation resourcelocation = new ResourceLocation(s); if (p_loadResources_0_.resourceExists(resourcelocation)) { InputStream inputstream = p_loadResources_0_.getInputStream(resourcelocation); if (inputstream != null) { loadLocaleData(inputstream, p_loadResources_2_); } } } } catch (IOException ioexception) { ioexception.printStackTrace(); } }
public static String[] collectFiles(IResourcePack p_collectFiles_0_, String[] p_collectFiles_1_, String[] p_collectFiles_2_, String[] p_collectFiles_3_) { if (p_collectFiles_0_ instanceof DefaultResourcePack) { return collectFilesFixed(p_collectFiles_0_, p_collectFiles_3_); } else if (!(p_collectFiles_0_ instanceof AbstractResourcePack)) { return new String[0]; } else { AbstractResourcePack abstractresourcepack = (AbstractResourcePack)p_collectFiles_0_; File file1 = abstractresourcepack.resourcePackFile; return file1 == null ? new String[0] : (file1.isDirectory() ? collectFilesFolder(file1, "", p_collectFiles_1_, p_collectFiles_2_) : (file1.isFile() ? collectFilesZIP(file1, p_collectFiles_1_, p_collectFiles_2_) : new String[0])); } }
public static void updateIcons(TextureMap p_updateIcons_0_) { blockProperties = (ConnectedProperties[][])null; tileProperties = (ConnectedProperties[][])null; if (Config.isConnectedTextures()) { IResourcePack[] airesourcepack = Config.getResourcePacks(); for (int i = airesourcepack.length - 1; i >= 0; --i) { IResourcePack iresourcepack = airesourcepack[i]; updateIcons(p_updateIcons_0_, iresourcepack); } updateIcons(p_updateIcons_0_, Config.getDefaultResourcePack()); ResourceLocation resourcelocation = new ResourceLocation("mcpatcher/ctm/default/empty"); emptySprite = p_updateIcons_0_.registerSprite(resourcelocation); spriteQuadMaps = new Map[p_updateIcons_0_.getCountRegisteredSprites() + 1]; } }
private static String[] collectFiles(IResourcePack p_collectFiles_0_, String p_collectFiles_1_, String p_collectFiles_2_) { if (p_collectFiles_0_ instanceof DefaultResourcePack) { return collectFilesDefault(p_collectFiles_0_); } else if (!(p_collectFiles_0_ instanceof AbstractResourcePack)) { return new String[0]; } else { AbstractResourcePack abstractresourcepack = (AbstractResourcePack)p_collectFiles_0_; File file1 = ResourceUtils.getResourcePackFile(abstractresourcepack); return file1 == null ? new String[0] : (file1.isDirectory() ? collectFilesFolder(file1, "", p_collectFiles_1_, p_collectFiles_2_) : (file1.isFile() ? collectFilesZIP(file1, p_collectFiles_1_, p_collectFiles_2_) : new String[0])); } }
private static String[] collectFilesDefault(IResourcePack p_collectFilesDefault_0_) { List list = new ArrayList(); String[] astring = getDefaultCtmPaths(); for (int i = 0; i < astring.length; ++i) { String s = astring[i]; ResourceLocation resourcelocation = new ResourceLocation(s); if (p_collectFilesDefault_0_.resourceExists(resourcelocation)) { list.add(s); } } String[] astring1 = (String[])((String[])list.toArray(new String[list.size()])); return astring1; }
private static Map makePotionImageProperties(IResourcePack p_makePotionImageProperties_0_, String p_makePotionImageProperties_1_, int p_makePotionImageProperties_2_) { Map map = new HashMap(); String s = p_makePotionImageProperties_1_ + "/"; String[] astring = new String[] {"mcpatcher/cit/potion/" + s, "mcpatcher/cit/Potion/" + s}; String[] astring1 = new String[] {".png"}; String[] astring2 = ResUtils.collectFiles(p_makePotionImageProperties_0_, astring, astring1); for (int i = 0; i < astring2.length; ++i) { String s1 = astring2[i]; String name = StrUtils.removePrefixSuffix(s1, astring, astring1); Properties properties = makePotionProperties(name, p_makePotionImageProperties_1_, p_makePotionImageProperties_2_, s1); if (properties != null) { String s3 = StrUtils.removeSuffix(s1, astring1) + ".properties"; CustomItemProperties customitemproperties = new CustomItemProperties(properties, s3); map.put(s3, customitemproperties); } } return map; }
public static IResourcePack[] getResourcePacks() { ResourcePackRepository resourcepackrepository = minecraft.getResourcePackRepository(); List list = resourcepackrepository.getRepositoryEntries(); List list1 = new ArrayList(); for (Object resourcepackrepository$entry : list) { list1.add(((ResourcePackRepository.Entry) resourcepackrepository$entry).getResourcePack()); } if (resourcepackrepository.getResourcePackInstance() != null) { list1.add(resourcepackrepository.getResourcePackInstance()); } IResourcePack[] airesourcepack = (IResourcePack[])((IResourcePack[])list1.toArray(new IResourcePack[list1.size()])); return airesourcepack; }
public static void resourcesReloaded() { Map map = I18n.getLocaleProperties(); List<String> list = new ArrayList(); String s = "optifine/lang/"; String s1 = "en_us"; String s2 = ".lang"; list.add(s + s1 + s2); if (!Config.getGameSettings().language.equals(s1)) { list.add(s + Config.getGameSettings().language + s2); } String[] astring = (String[])((String[])list.toArray(new String[list.size()])); loadResources(Config.getDefaultResourcePack(), astring, map); IResourcePack[] airesourcepack = Config.getResourcePacks(); for (int i = 0; i < airesourcepack.length; ++i) { IResourcePack iresourcepack = airesourcepack[i]; loadResources(iresourcepack, astring, map); } }
public static BufferedImage getBedrockImage() { if (TConTextureResourcePackBedrockium.bedrockImage == null) { final ResourceLocation bedrockLocation = new ResourceLocation("minecraft", "textures/blocks/bedrock.png"); try { final DefaultResourcePack mcDefaultResourcePack = (DefaultResourcePack)ObfuscationReflectionHelper.getPrivateValue((Class)Minecraft.class, (Object)Minecraft.getMinecraft(), new String[] { "field_110450_ap", "mcDefaultResourcePack" }); InputStream inputStream = mcDefaultResourcePack.getInputStream(bedrockLocation); final List<ResourcePackRepository.Entry> t = (List<ResourcePackRepository.Entry>)Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries(); for (final ResourcePackRepository.Entry entry : t) { final IResourcePack resourcePack = entry.getResourcePack(); if (resourcePack.resourceExists(bedrockLocation)) { inputStream = resourcePack.getInputStream(bedrockLocation); } } TConTextureResourcePackBedrockium.bedrockImage = ImageIO.read(inputStream); } catch (IOException e) { throw Throwables.propagate((Throwable)e); } } return TConTextureResourcePackBedrockium.bedrockImage; }
@Nonnull public List<IResourcePack> findResourcePacks() { final List<ResourcePackRepository.Entry> repo = Minecraft.getMinecraft().getResourcePackRepository() .getRepositoryEntries(); final List<IResourcePack> foundEntries = new ArrayList<IResourcePack>(); foundEntries.add(new DefaultPack()); // Add a default back for mods that are loaded - there may be a default // configuration privided in the archive for (final ModContainer mod : Loader.instance().getActiveModList()) foundEntries.add(new DefaultPack(mod.getModId())); // Look in other resource packs for more configuration data for (final ResourcePackRepository.Entry pack : repo) { DSurround.log().debug("Resource Pack: %s", pack.getResourcePackName()); if (checkCompatible(pack)) { DSurround.log().debug("Found FootstepsRegistry resource pack: %s", pack.getResourcePackName()); foundEntries.add(pack.getResourcePack()); } } return foundEntries; }
@Override public void init() { // It's a hack - needs refactor AcousticsManager.SWIM = null; this.getBlockMap().clear(); final List<IResourcePack> repo = this.dealer.findResourcePacks(); reloadManifests(repo); reloadAcoustics(repo); reloadPrimitiveMap(repo); seedMap(); this.isolator.setSolver(new Solver(this.isolator)); this.isolator.setGenerator( ModOptions.foostepsQuadruped ? new GeneratorQP(this.isolator) : new Generator(this.isolator)); }
/** * Inject actors skin pack into FML's resource packs list * * It's done by accessing private FMLClientHandler list (via reflection) and * appending actor pack. * * Thanks to diesieben07 for giving the idea. */ @SuppressWarnings("unchecked") private void injectResourcePack(String path) { try { Field field = FMLClientHandler.class.getDeclaredField("resourcePackList"); field.setAccessible(true); List<IResourcePack> packs = (List<IResourcePack>) field.get(FMLClientHandler.instance()); packs.add(actorPack = new ActorsPack()); actorPack.pack.addFolder(path + "/models"); actorPack.pack.addFolder(path + "/downloads"); actorPack.pack.reload(); /* Create steve, alex and fred skins folders */ new File(path + "/models/steve/skins").mkdirs(); new File(path + "/models/alex/skins").mkdirs(); new File(path + "/models/fred/skins").mkdirs(); } catch (Exception e) { e.printStackTrace(); } }
private static void dedupeResourcePacks() { if (Boolean.getBoolean("fz.misc.dupedpacks")) return; Minecraft mc = Minecraft.getMinecraft(); HashSet<File> seen = new HashSet<File>(); int removed = 0; for (Iterator<IResourcePack> iter = mc.defaultResourcePacks.iterator(); iter.hasNext(); ) { IResourcePack pack = iter.next(); File packFile = null; if (pack instanceof AbstractResourcePack) { AbstractResourcePack arp = (AbstractResourcePack) pack; packFile = arp.resourcePackFile; } if (packFile == null) continue; if (seen.add(packFile)) continue; iter.remove(); removed++; } if (removed == 0) return; String thx = removed >= 10 ? " #you'rewelcome" : ""; Core.logWarning(removed + " duplicated resourcepacks were removed." + thx); }
@SuppressWarnings("unchecked") private List<IResourcePack> getOnlyList() { Field[] flds = mc.getClass().getDeclaredFields(); for (Field f : flds) { if (f.getType().equals(List.class) && !Modifier.isStatic(f.getModifiers())) { f.setAccessible(true); try { return (List<IResourcePack>) f.get(mc); } catch (Throwable e) { e.printStackTrace(); } } } return null; }
public static TextureAnimation[] getTextureAnimations(IResourcePack[] rps) { ArrayList list = new ArrayList(); for (int anims = 0; anims < rps.length; ++anims) { IResourcePack rp = rps[anims]; TextureAnimation[] tas = getTextureAnimations(rp); if (tas != null) { list.addAll(Arrays.asList(tas)); } } TextureAnimation[] var5 = (TextureAnimation[])((TextureAnimation[])list.toArray(new TextureAnimation[list.size()])); return var5; }
public static IResourcePack[] getResourcePacks() { ResourcePackRepository rep = minecraft.getResourcePackRepository(); List entries = rep.getRepositoryEntries(); ArrayList list = new ArrayList(); Iterator rps = entries.iterator(); while (rps.hasNext()) { ResourcePackRepository.Entry entry = (ResourcePackRepository.Entry)rps.next(); list.add(entry.getResourcePack()); } IResourcePack[] rps1 = (IResourcePack[])((IResourcePack[])list.toArray(new IResourcePack[list.size()])); return rps1; }
public static String getResourcePackNames() { IResourcePack[] rps = getResourcePacks(); if (rps.length <= 0) { return getDefaultResourcePack().getPackName(); } else { String[] names = new String[rps.length]; for (int nameStr = 0; nameStr < rps.length; ++nameStr) { names[nameStr] = rps[nameStr].getPackName(); } String var3 = arrayToString((Object[])names); return var3; } }
public static IResourcePack getDefiningResourcePack(ResourceLocation loc) { IResourcePack[] rps = getResourcePacks(); for (int i = rps.length - 1; i >= 0; --i) { IResourcePack rp = rps[i]; if (rp.resourceExists(loc)) { return rp; } } if (getDefaultResourcePack().resourceExists(loc)) { return getDefaultResourcePack(); } else { return null; } }
private static String[] collectFiles(IResourcePack rp, String prefix, String suffix) { if (rp instanceof DefaultResourcePack) { return collectFilesDefault(rp); } else if (!(rp instanceof AbstractResourcePack)) { return new String[0]; } else { AbstractResourcePack arp = (AbstractResourcePack)rp; File tpFile = ResourceUtils.getResourcePackFile(arp); return tpFile == null ? new String[0] : (tpFile.isDirectory() ? collectFilesFolder(tpFile, "", prefix, suffix) : (tpFile.isFile() ? collectFilesZIP(tpFile, prefix, suffix) : new String[0])); } }
private static String[] collectFilesDefault(IResourcePack rp) { ArrayList list = new ArrayList(); String[] names = getDefaultCtmPaths(); for (int nameArr = 0; nameArr < names.length; ++nameArr) { String name = names[nameArr]; ResourceLocation loc = new ResourceLocation(name); if (rp.resourceExists(loc)) { list.add(name); } } String[] var6 = (String[])((String[])list.toArray(new String[list.size()])); return var6; }
@Inject(method = "refreshResources", at = @At(value = "INVOKE", target = "Ljava/util/List;addAll(Ljava/util/Collection;)Z", ordinal = 0, remap = false), locals = LocalCapture.CAPTURE_FAILEXCEPTION) private void loadPastResourcePack(CallbackInfo callbackInfo, List<IResourcePack> list) { list.add(Past.getInstance().getResourcePack()); }
public void registerRendering() { //Entities ModEntities.initModels(); //Register animator resource pack, where models and textures are stored, externally from the jar List<IResourcePack> resourcePackList = ObfuscationReflectionHelper.getPrivateValue(FMLClientHandler.class, FMLClientHandler.instance(), "resourcePackList"); resourcePackList.add(new AnimationResourcePack()); }
public void refreshResources() { List<IResourcePack> list = Lists.newArrayList(this.defaultResourcePacks); for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries()) { list.add(resourcepackrepository$entry.getResourcePack()); } if (this.mcResourcePackRepository.getResourcePackInstance() != null) { list.add(this.mcResourcePackRepository.getResourcePackInstance()); } try { this.mcResourceManager.reloadResources(list); } catch (RuntimeException runtimeexception) { logger.info((String)"Caught error stitching, removing all assigned resourcepacks", (Throwable)runtimeexception); list.clear(); list.addAll(this.defaultResourcePacks); this.mcResourcePackRepository.setRepositories(Collections.<ResourcePackRepository.Entry>emptyList()); this.mcResourceManager.reloadResources(list); this.gameSettings.resourcePacks.clear(); this.gameSettings.field_183018_l.clear(); this.gameSettings.saveOptions(); } this.mcLanguageManager.parseLanguageMetadata(list); if (this.renderGlobal != null) { this.renderGlobal.loadRenderers(); } }
public static void update() { textureAnimations = null; IResourcePack[] airesourcepack = Config.getResourcePacks(); textureAnimations = getTextureAnimations(airesourcepack); if (Config.isAnimatedTextures()) { updateAnimations(); } }
public static void updateIcons(TextureMap p_updateIcons_0_) { itemProperties = (CustomItemProperties[][])null; enchantmentProperties = (CustomItemProperties[][])null; useGlint = true; if (Config.isCustomItems()) { readCitProperties("mcpatcher/cit.properties"); IResourcePack[] airesourcepack = Config.getResourcePacks(); for (int i = airesourcepack.length - 1; i >= 0; --i) { IResourcePack iresourcepack = airesourcepack[i]; updateIcons(p_updateIcons_0_, iresourcepack); } updateIcons(p_updateIcons_0_, Config.getDefaultResourcePack()); if (itemProperties.length <= 0) { itemProperties = (CustomItemProperties[][])null; } if (enchantmentProperties.length <= 0) { enchantmentProperties = (CustomItemProperties[][])null; } } }
private static Map makeAutoImageProperties(IResourcePack p_makeAutoImageProperties_0_) { Map map = new HashMap(); map.putAll(makePotionImageProperties(p_makeAutoImageProperties_0_, false)); map.putAll(makePotionImageProperties(p_makeAutoImageProperties_0_, true)); return map; }