public Fluid setBlock(Block block) { if (this.block == null || this.block == block) { this.block = block; } else if (!ForgeModContainer.forceDuplicateFluidBlockCrash) { FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening."); } else { FMLLog.severe("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening."); throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening.")); } return this; }
public void setName(String name, String modId) { if (name == null) { this.forcedName = null; this.forcedModId = null; return; } String localModId = modId; if (modId == null) { localModId = Loader.instance().activeModContainer().getModId(); } if (modOrdinals.get(localModId).count(name)>0) { FMLLog.severe("The mod %s is attempting to redefine the item at id %d with a non-unique name (%s.%s)", Loader.instance().activeModContainer(), itemId, localModId, name); throw new LoaderException(); } modOrdinals.get(localModId).add(name); this.forcedModId = modId; this.forcedName = name; }
public Fluid setBlockID(int blockID) { if (this.blockID == -1 || this.blockID == blockID) { this.blockID = blockID; } else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash) { FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."); } else { FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."); throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening.")); } return this; }
public static void registerFluidContainers(Class<? extends Catalog> catalogClass) { Field[] fields = catalogClass.getFields(); for (Field field : fields) { try { Object value = field.get(null); if (value instanceof IFluidBlock) { IFluidBlock block = (IFluidBlock)value; if (!block.getFluid().isGaseous()) { registerBucket(block); registerFlask(block.getFluid()); } } } catch (Exception e) { throw new LoaderException(e); } } }
public List<ModContainer> identifyMods() { List<ModContainer> modList = Lists.newArrayList(); for (ModCandidate candidate : candidates) { try { List<ModContainer> mods = candidate.explore(dataTable); if (mods.isEmpty() && !candidate.isClasspath()) { nonModLibs.add(candidate.getModContainer()); } else { modList.addAll(mods); } } catch (LoaderException le) { FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer()); } catch (Throwable t) { Throwables.propagate(t); } } return modList; }
public ASMModParser(InputStream stream) throws IOException { try { ClassReader reader = new ClassReader(stream); reader.accept(new ModClassVisitor(this), 0); } catch (Exception ex) { FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly"); throw new LoaderException(ex); } }
public static VersionRange parseRange(String range) { try { return VersionRange.createFromVersionSpec(range); } catch (InvalidVersionSpecificationException e) { FMLLog.log(Level.ERROR, e, "Unable to parse a version range specification successfully %s", range); throw new LoaderException(e); } }
public static void init() { if (!isDevEnviroment()) throw new RuntimeException("Can't use SideChecker in a non-deobfuscated enviroment."); logger.info("Starting SideChecker Routine"); filter = System.getProperty(propFilter); crashOnWarning = System.getProperty(propCrashWarning) != null; crashOnSeriousError = crashOnWarning || (System.getProperty(propCrashError) != null); String altName = System.getProperty(propClientSafeAnnotation); if (altName != null) { clientSafeName = 'L' + altName.replace('.', '/') + ';'; } files = new ArrayList<File>(); List<URL> urls = classLoader.getSources(); File[] sources = new File[urls.size()]; try { for (int i = 0; i < urls.size(); i++) { sources[i] = new File(urls.get(i).toURI()); if (sources[i].isDirectory()) files.add(sources[i]); } } catch (URISyntaxException e) { FMLLog.log(Level.ERROR, e, "Unable to process our input to locate the minecraft code"); throw new LoaderException(e); } ClassInfo.init(); needsInit = false; }
/** * Called a bit later on during initialization to finish loading mods * Also initializes key bindings * */ @SuppressWarnings("deprecation") public void finishMinecraftLoading() { if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null) { return; } try { Loader.instance().initializeMods(); } catch (CustomModLoadingErrorDisplayException custom) { FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt"); customError = custom; return; } catch (LoaderException le) { haltGame("There was a severe problem during mod loading that has caused the game to fail", le); return; } client.field_71416_A.LOAD_SOUND_SYSTEM = true; // Reload resources client.func_110436_a(); RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.field_78727_a.field_78729_o); loading = false; KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.field_71474_y); }
public List<ModContainer> identifyMods() { List<ModContainer> modList = Lists.newArrayList(); for (ModCandidate candidate : candidates) { try { List<ModContainer> mods = candidate.explore(dataTable); if (mods.isEmpty() && !candidate.isClasspath()) { nonModLibs.add(candidate.getModContainer()); } else { modList.addAll(mods); } } catch (LoaderException le) { FMLLog.log(Level.WARNING, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer()); } catch (Throwable t) { Throwables.propagate(t); } } return modList; }
public ASMModParser(InputStream stream) throws IOException { try { ClassReader reader = new ClassReader(stream); reader.accept(new ModClassVisitor(this), 0); } catch (Exception ex) { FMLLog.log(Level.SEVERE, ex, "Unable to read a class file correctly"); throw new LoaderException(ex); } }
public static VersionRange parseRange(String range) { try { return VersionRange.createFromVersionSpec(range); } catch (InvalidVersionSpecificationException e) { FMLLog.log(Level.SEVERE, e, "Unable to parse a version range specification successfully %s", range); throw new LoaderException(e); } }
/** * Called a bit later on during initialization to finish loading mods * Also initializes key bindings * */ @SuppressWarnings("deprecation") public void finishMinecraftLoading() { if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null) { return; } try { Loader.instance().initializeMods(); } catch (CustomModLoadingErrorDisplayException custom) { FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt"); customError = custom; return; } catch (LoaderException le) { haltGame("There was a severe problem during mod loading that has caused the game to fail", le); return; } client.sndManager.LOAD_SOUND_SYSTEM = true; // Reload resources client.refreshResources(); RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.instance.entityRenderMap); loading = false; KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.gameSettings); }
private static <T extends GeoBlock> T createGeoBlock(Class<T> blockClass, Strength strength, Class<? extends IndustrialMaterial> composition, Material material) { T block = null; try { Constructor<T> constructor = blockClass.getConstructor(Strength.class, Class.class, Material.class); block = constructor.newInstance(strength, composition, material); } catch (Exception e) { Geologica.log.fatal("Failed to construct GeoBlock"); throw new LoaderException(e); } return block; }
private static <T extends Block> T createDerivedBlock(Class<T> blockClass, CompositeBlock modelBlock) { T block = null; try { Constructor<T> constructor = blockClass.getConstructor(CompositeBlock.class); block = constructor.newInstance(modelBlock); } catch (Exception e) { Geologica.log.fatal("Failed to construct derived block"); throw new LoaderException(e); } return block; }
@SuppressWarnings("unchecked") public static <T> List<T> getEntries(Class<? extends Catalog> catalogClass, Class<T> fieldClass) { List<T> items = new ArrayList<T>(); for (Field field : catalogClass.getFields()) { try { Object fieldValue = field.get(null); if (fieldClass.isAssignableFrom(fieldValue.getClass())) { items.add((T)fieldValue); } } catch (Exception e) { throw new LoaderException(e); } } return items; }
@SuppressWarnings("unchecked") public static <T> Map<String,T> getNamedEntries(Class<? extends Catalog> catalogClass, Class<T> fieldClass) { Map<String,T> items = new HashMap<String,T>(); for (Field field : catalogClass.getFields()) { try { Object fieldValue = field.get(null); if (fieldClass.isAssignableFrom(fieldValue.getClass())) { items.put(field.getName(), (T)fieldValue); } } catch (Exception e) { throw new LoaderException(e); } } return items; }