codechicken.core.launch.CodeChickenCorePlugin Java Examples
The following examples show how to use
codechicken.core.launch.CodeChickenCorePlugin.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CCUpdateChecker.java From CodeChickenCore with MIT License | 6 votes |
public static void updateCheck(final String mod, final String version) { updateCheck("http://www.chickenbones.net/Files/notification/version.php?" + "version=" + mcVersion() + "&" + "file=" + mod, new Function<String, Void>() { @Override public Void apply(String ret) { if (!ret.startsWith("Ret: ")) { CodeChickenCorePlugin.logger.error("Failed to check update for " + mod + " returned: " + ret); return null; } ComparableVersion newversion = new ComparableVersion(ret.substring(5)); if (newversion.compareTo(new ComparableVersion(version)) > 0) addUpdateMessage("Version " + newversion + " of " + mod + " is available"); return null; } }); }
Example #2
Source File: ClassDiscoverer.java From CodeChickenCore with MIT License | 6 votes |
private void checkAddClass(String resource) { try { String classname = resource.replace(".class", "").replace("\\", ".").replace("/", "."); byte[] bytes = Launch.classLoader.getClassBytes(classname); if (bytes == null) return; ClassNode cnode = ASMHelper.createClassNode(bytes); for (String superclass : superclasses) if (!cnode.interfaces.contains(superclass) && !cnode.superName.equals(superclass)) return; addClass(classname); } catch (IOException e) { CodeChickenCorePlugin.logger.error("Unable to load class: " + resource, e); } }
Example #3
Source File: ClassDiscoverer.java From CodeChickenCore with MIT License | 6 votes |
private void findClasspathMods() { List<ModContainer> mods = Loader.instance().getActiveModList(); HashSet<String> searched = new HashSet<String>(); for (ModContainer mod : mods) { File source = mod.getSource(); if(source == null || searched.contains(source.getAbsolutePath())) continue; searched.add(source.getAbsolutePath()); if (source.isFile()) { CodeChickenCorePlugin.logger.debug("Found a mod container %s, examining for codechicken classes", source.getAbsolutePath()); try { readFromZipFile(source); } catch (Exception e) { CodeChickenCorePlugin.logger.error("Failed to scan " + source.getAbsolutePath() + ", the zip file is invalid", e); } } else if (source.isDirectory()) { CodeChickenCorePlugin.logger.debug("Found a minecraft related directory at %s, examining for codechicken classes", source.getAbsolutePath()); readFromDirectory(source, source); } } }
Example #4
Source File: CCUpdateChecker.java From CodeChickenCore with MIT License | 5 votes |
public static void updateCheck(String url, Function<String, Void> handler) { try { new ThreadUpdateCheck(new URL(url), handler).start(); } catch (MalformedURLException e) { CodeChickenCorePlugin.logger.error("Malformed URL: "+url, e); } }
Example #5
Source File: ClassDiscoverer.java From CodeChickenCore with MIT License | 5 votes |
private void addClass(String classname) { try { Class<?> class1 = Class.forName(classname, true, modClassLoader); classes.add(class1); } catch (Throwable t) { CodeChickenCorePlugin.logger.error("Unable to load class: " + classname, t); } }
Example #6
Source File: NEICorePlugin.java From NotEnoughItems with MIT License | 4 votes |
@Override public String[] getASMTransformerClass() { CodeChickenCorePlugin.versionCheck(CodeChickenCorePlugin.mcVersion, "NotEnoughItems"); return new String[]{"codechicken.nei.asm.NEITransformer"}; }
Example #7
Source File: NEIModContainer.java From NotEnoughItems with MIT License | 4 votes |
@Override public Set<ArtifactVersion> getRequirements() { Set<ArtifactVersion> deps = new HashSet<ArtifactVersion>(); deps.add(VersionParser.parseVersionReference("CodeChickenCore@["+CodeChickenCorePlugin.version+",)")); return deps; }
Example #8
Source File: NEIModContainer.java From NotEnoughItems with MIT License | 4 votes |
@Override public VersionRange acceptableMinecraftVersionRange() { return VersionParser.parseRange(CodeChickenCorePlugin.mcVersion); }
Example #9
Source File: GuiModListScroll.java From CodeChickenCore with MIT License | 4 votes |
private static void register(ModContainer mod) { if (!RenderUtils.checkEnableStencil()) CodeChickenCorePlugin.logger.error("Unable to do mod description scrolling due to lack of stencil buffer"); else scrollMods.add(mod); }
Example #10
Source File: CodeChickenCoreModContainer.java From CodeChickenCore with MIT License | 4 votes |
public static void loadConfig() { if(config == null) config = new ConfigFile(new File(CodeChickenCorePlugin.minecraftDir, "config/CodeChickenCore.cfg")).setComment("CodeChickenCore configuration file."); }
Example #11
Source File: CodeChickenCoreModContainer.java From CodeChickenCore with MIT License | 4 votes |
@Override public VersionRange acceptableMinecraftVersionRange() { return VersionParser.parseRange(CodeChickenCorePlugin.mcVersion); }